philipina

BTC and ETH Long strategy - version 1

I will start with a small introduction about myself. I'm now trading cryto currencies manually for almost 2 years. I decided to start after watching a documentary on the TV showing people who made big money during the Bitcoin pump which happened at the end of 2017.

The next day, I asked myself "Why should I not give it a try and learn how to trade".
This was in February 2018 and the price of Bitcoin was around 11500USD.
I didn't know how to trade. In fact, I didn't know the trading industry at all.
So, my first step into trading was to open an account with a broken. Then I directly bought 200$ worst of BTC . At that time, I saw the graph and thought "This can only go back in the upward direction!" :)
I didn't know anything about Stop loss, Take profit and Risk management.

Today, almost 2 years after, I think that I know how to trade and can also confirm that I still hold this bag of 200$ of bitcoin from 2018 :)

I did spend the 2 last years to learn technical analysis , risk management and leverage trading.
Today (14/ 05 /2020), I know what I'm doing and I'm happy to see that the 2 last years have been positive in terms of gains. Of course, I did not make crazy money with my saving but at least I made more than if I would have kept it in my bank account.

Even if I like trading, I have a full time job which requires my full energy and lots of focus, so, the biggest problem I had is that I didn't have enough time to look at the charts.
Also, I realized that sometimes, neither technical analysis , nor fundamentals worked with crypto currency (at least for short time trading). So, as I have a developer background I decided to try to have a look at algo trading.
The goal for me was neither to make complex algos nor to beat the market but just to automate my trading with simple bot catching the big waves.

I then started to take a look at TV pine script and played with it.

I did my first LONG script in February 2020 to Long the BTC Market. It has some limitations but works well enough for me for the time being. Even if the real trades will bring me half of what the back testing shows, this will still be a lot more than what I was used to win during the last 2 years with my manual trading.

So, here we are! Below you will find some details about my first LONG script. I'm happy to share it with you.
Feel free to play with it, give your comments and bring improvements to it.
But please note that it only works fine with the candle size and crypto pair that I have mentioned below. If you use other settings this algo might loose money!

- Crypto pairs : XBTUSD and ETHXBT
- Candle size: 2 Hours
- Indicator used: Volatility , MACD (12, 26, 7), SMA (100), SMA (200), EMA (20)
- Default StopLoss: -1.5%

- Entry in position if: Volatility < 2%
AND MACD moving up
AND AME (20) moving up
AND SMA (100) moving up
AND SMA (200) moving up
AND EMA (20) > SAM (100)
AND SMA (100) > SMA (200)

- Exit the postion if: Stoploss is reached
OR EMA (20) crossUnder SMA (100)

Here is a summary of the results for this script:
XBTUSD : 01 / 01 /2019 --> 14/ 05 /2020 = +107%
ETHXBT : 01 / 01 /2019 --> 14/ 05 /2020 = +39%
ETHUSD : 01 / 01 /2019 --> 14/ 05 /2020 = +112%

It is far away from being perfect. There are still plenty of things which can be done to improve it but I just wanted to share it :) .

Enjoy playing with it....
Open-source Skript

Ganz im Sinne von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es verstehen und überprüfen können. Ein Hoch auf den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Publikation unterliegt den Hausregeln. Sie können das Skript den Favoriten hinzufügen, um es auf dem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?

Kommentare

Do not forget to press the LIKE button if you have enjoyed reading this article :)
Antworten
Thanks for sharing :)
Keep searching and improving !
Antworten
can this be used for equity and derivatives stocks also ?
Antworten
philipina rahul3681
@rahul3681, You have to test it
Antworten
i tweaked your code a little bit.

i changed:
strategy.entry("myPosition", strategy.long, qty=stockPositionSize, comment="BUY at " + tostring(currentPrice))
to
strategy.entry("myPosition", strategy.long, comment="BUY at " + tostring(currentPrice))
(remove qty=stockPositionSize because it's not using compounding)

Changed backtest settings to use 100% of my balance instead and tested the results against BTCUSDT and ETHUSDT Binance, and the results are all good 👌
Antworten
philipina daryledesilva
@daryledesilva, Yes this was already foreseen in the script ;). You can test this just by uncommenting the line --> //positionSize := positionSize + ((stockPositionSize * currentPrice) - (positionSize*leverage)) this automatically adjusts the position size to consider compounding effect. With this you can also backtest with leverage and see the impact of drawdown. You can control the leverage in top of the script, there is a variable definition set to 1 by default. Enjoy ;)
+2 Antworten
Starting Equity (BTC) : 0,274098
Last Equity (BTC) : 0,206548
Loss : %24,66

Starting Equity (USD) 1.000
Last Equity (USD) 1.968
Profit : % 96,81

HODL :
Last Equity (USD) 2.611,60
Last Equity (BTC) 0,274098

or

Find a way to rise your BTC amount.
Best Regards.
Antworten
philipina alsatTR
@alsatTR, Which Currency pair did you test to have a loss of 24%? BTCUSD is for sure profitable in 2 hours candles with this script.
Antworten
philipina philipina
@alsatTR Also, if you want to hold BTC and grow your BTC amount this script is also working for BTCETH. It would have grown the BTC equity by +27% over the same period.
Antworten
nice job :)
Antworten