Long term MA-Trailing-Stop strategy with Adjustable Signal Strength to beat Buy&Hold strategy
None of the strategies that I tested can beat the long term Buy&Hold strategy. That's the reason why I wrote this strategy.
Purpose: beat Buy&Hold strategy with around 10 trades. 100% capitalize sold trade into new trade.
My buy strategy is triggered by the fast buy (blue) crossing over the slow buy curve (orange) and the fast buy has a certain up strength.
My sell strategy is triggered by either one of these conditions:
- the (6) of the close value is crossing under the trailing stop value (green) or
- the fast sell (navy) is crossing under the slow sell curve (red) and the fast sell has a certain down strength.
ATR(15) is the (15) value of the difference between the high and low values.
The scripts shows a lot of graphical information:
- The close value is shown in light-green. When the close value is lower then the buy value, the close value is shown in light-red. This way it is possible to evaluate the virtual losses during the trade.
- the trailing stop value is shown in dark-green. When the sell value is lower then the buy value, the last color of the trade will be red (best viewed when zoomed)(in the example, there are 2 trades that end in gain and 2 in loss (red line at end))
- the and values for both buy and sell signals are shown as a line
- the buy and sell(close) signals are labeled in blue
How to use this strategy?
Every stock has it's own "DNA", so first thing to do is tune the right parameters to get the best strategy values voor , , Strength for both buy and sell and the Trailing Stop (#ATR).
Look in the strategy tester overview to optimize the values Percent Profitable and Net Profit (using the strategy settings icon, you can increase/decrease the parameters)
Then keep using these parameters for future buy/sell signals only for that particular stock.
Do the same for other stocks.
Important: optimizing these parameters is no guarantee for future winning trades!
Here are the parameters:
- Fast Buy: buy trigger when Fast Buy crosses over the Slow Buy value (use values between 10-20)
- Slow Buy: buy trigger when Fast Buy crosses over the Slow Buy value (use values between 30-100)
- Minimum Buy Strength: minimum upward trend value of the Fast Buy value (directional coefficient)(use values between 0-120)
- Fast Sell: sell trigger when Fast Sell crosses under the Slow Sell value (use values between 10-20)
- Slow Sell: sell trigger when Fast Sell crosses under the Slow Sell value (use values between 30-100)
- Minimum Sell Strength: minimum downward trend value of the Fast Sell value (directional coefficient)(use values between 0-120)
- Trailing Stop (#ATR): the trailing stop value as a multiple of the ATR(15) value (use values between 2-20)
Example parameters for different stocks (Start capital: 1000, Order=100% of equity, Period 1/1/2005 to now) compared to the Buy&Hold Strategy(=do nothing):
- BEKB(Bekaert): EMA-Buy=12, SMA-Buy=44, Strength-Buy=65, EMA-Sell=12, SMA-Sell=55, Strength-Sell=120, Stop#ATR=20
NetProfit: 996%, #Trades: 6, %Profitable: 83%, Buy&HoldProfit: 78%
- BAR(Barco): EMA-Buy=16, SMA-Buy=80, Strength-Buy=44, EMA-Sell=12, SMA-Sell=45, Strength-Sell=82, Stop#ATR=9
NetProfit: 385%, #Trades: 7, %Profitable: 71%, Buy&HoldProfit: 55%
- AAPL( Apple ): EMA-Buy=12, SMA-Buy=45, Strength-Buy=40, EMA-Sell=19, SMA-Sell=45, Strength-Sell=106, Stop#ATR=8
NetProfit: 6900%, #Trades: 7, %Profitable: 71%, Buy&HoldProfit: 2938%
- TNET(Telenet): EMA-Buy=12, SMA-Buy=45, Strength-Buy=27, EMA-Sell=19, SMA-Sell=45, Strength-Sell=70, Stop#ATR=14
NetProfit: 129%, #Trade
Sejalan dengan semangat TradingView, penulis skrip ini telah mempublikasikannya secara open-source, sehingga para trader dapat memahami dan memverifikasinya. Salut untuk sang penulis! Anda dapat menggunakannya secara gratis, tetapi penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk dapat menggunakannya didalam sebuah chart.
Since I only recently discovered what people mean by "repainting", I have to say that this script DOES NOT REPAINT.
For those who don't know what repaint means in this context.
There are some scripts on this site like the ANN scripts and derivatives who promise 100% profit.
When you look at the results, you start to believe it is, until you look at the script=code.
Scripts like ANN and others cheat by "looking into the future".
ANN scripts use close values of the end of the day. Since these values are not known before the end of the day, you cannot use these scripts for intra-day trading using periods smaller than one day.
This is called "repainting".
My script does not rely on values in the future. It is meant for inter-day trading (smallest atom is 1 day), although you could tune it's parameters to be used for intra-day trading, since it uses the values of the trading period, not the day-values as ANN does.
For bitcoin you have to use these parameters:
BTCUSD(BTCUSD): EMA-Buy=2, SMA-Buy=16, Strength-Buy=42, EMA-Sell=8, SMA-Sell=22, Strength-Sell=52, Stop#ATR=3
NetProfit: 18586%, #Trades: 26, %Profitable: 62%, Buy&HoldProfit: 6345%
You can see that the Net Profit is 3 times higher than the Buy&Hold Profit: 18586% vs 6345%