Strategy SR Dow J Day
Forums › ProRealTime English forum › ProOrder support › Strategy SR Dow J Day
- This topic has 18 replies, 4 voices, and was last updated 3 years ago by Mauro T. “Algorithm System”.
-
-
06/27/2020 at 4:46 PM #137304
Daily strategy with indicator created by Roberto Gozzi.
This strategy has been optimized with tick by tick mode until December 2017.
To the indicator created by Roberto I added two trend indicators being based only on long purchases, to this I put a monthly stop to not increase the Drawdown in case of sudden and prolonged sales …. (as it is in 2020).1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253// Strategy SR Dow J. Day indicator by roberto gozziDEFPARAM CumulateOrders = falseindicator1 = ADX[10]indicator2 = ADXR[14]c2 = (indicator1[1] > indicator2[1])indicator11 = ADX[10]c1 = (indicator11[1] >= 15)ONCE PrezzoC = 0ONCE PrezzoB = 0ONCE PrezzoA = 0Prezzo = CALL SRtestIF Prezzo > 0 THENPrezzoA = PrezzoBPrezzoB = PrezzoCPrezzoC = PrezzoENDIFIf longonmarket and (barindex-tradeindex)>=43 thenSELL AT MARKETENDIFLossMonth =200once StopMonth=1IF Month <> Month[1] THENProfitMonth=strategyprofitStopMonth=1endifIf strategyprofit<=ProfitMonth-LossMonth thenStopMonth=0endifCond = PrezzoB > PrezzoA AND PrezzoB > PrezzoCIF StopMonth=1 and close CROSSES UNDER PrezzoB AND C2 AND C1 AND Cond > 0 THENBUY 1 Contract At MarketSET TARGET PROFIT 5* averagetruerange[1](close)SET STOP %LOSS 8ENDIFTrailinglong = 2* averagetruerange[5](close)Trailingsteplong = 5* averagetruerange[1](close)TGL = TrailinglongSTPL = Trailingsteplongif not onmarket thenMAXPRICE = 0PREZZOUSCITA = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL thenPREZZOUSCITA = MAXPRICE-STPLENDIFENDIFif onmarket and PREZZOUSCITA>0 thenEXITSHORT AT PREZZOUSCITA STOPSELL AT PREZZOUSCITA STOPENDIF06/27/2020 at 5:06 PM #137310Over 1000% gains are due to low initial capital.
I think € 10,000 would be a correct figure, to cope with drawdown + margin + safety buffer.
Still it performs quite good. Thank you for sharing.
06/27/2020 at 5:12 PM #137311Hi Roberto, 2500 are put only for the drawdown since in the nine years not optimized it has remained unchanged ….
06/27/2020 at 5:20 PM #13731506/28/2020 at 9:31 AM #137342Your strategy uses STOP and TARGET orders so you must test it with tick by tick on. You are not doing this. Tick by tick on the DJI only allows us to test from 2010 onwards.
Also you are using a spread of 2 for the DJI. 3.8 is the norm I believe for end of day trades when positions are opened. Spread might however be lower if STOP or TARGET orders are hit during the trading day.
Even with these changes the equity curve is quite pretty though.
Just for interest I decided to add my ‘Strategy Every Bar’ code to your strategy as it is a prime candidate as trades can be on the market for quite some time and so misses other possible trades. My first test was with just 31 tests (one for each day of the month). This increased the number of trades tested to 102 from 65 out of a maximum of 120 possible trades. So we went from testing only 54% of all trades to testing 85% of all trades. Despite this the total profit only increased by 1.24%. The win rate dropped by 3.94% and the average gain per trade dropped by £97.16
So although profitable performance is not as good as it first appears.
This is the code I used. dn must be optimised from 0 to 31.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465// Strategy SR Dow J. Day indicator by roberto gozziDEFPARAM CumulateOrders = falsedefparam preloadbars = 0tradeon = 0if day = dn or dn = 0 thentradeon = 1endifindicator1 = ADX[10]indicator2 = ADXR[14]c2 = (indicator1[1] > indicator2[1])indicator11 = ADX[10]c1 = (indicator11[1] >= 15)ONCE PrezzoC = 0ONCE PrezzoB = 0ONCE PrezzoA = 0Prezzo = CALL SRtestIF Prezzo > 0 THENPrezzoA = PrezzoBPrezzoB = PrezzoCPrezzoC = PrezzoENDIFIf longonmarket and (barindex-tradeindex)>=43 thenSELL AT MARKETENDIFLossMonth =200once StopMonth=1IF Month <> Month[1] THENProfitMonth=strategyprofitStopMonth=1endifIf strategyprofit<=ProfitMonth-LossMonth thenStopMonth=0endifCond = PrezzoB > PrezzoA AND PrezzoB > PrezzoCIF tradeon and StopMonth=1 and close CROSSES UNDER PrezzoB AND C2 AND C1 AND Cond > 0 THENtrades = trades + 1if not onmarket thenBUY 1 Contract At MarketSET TARGET PROFIT 5* averagetruerange[1](close)SET STOP %LOSS 8endifENDIFTrailinglong = 2* averagetruerange[5](close)Trailingsteplong = 5* averagetruerange[1](close)TGL = TrailinglongSTPL = Trailingsteplongif not onmarket thenMAXPRICE = 0PREZZOUSCITA = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL thenPREZZOUSCITA = MAXPRICE-STPLENDIFENDIFif onmarket and PREZZOUSCITA>0 thenEXITSHORT AT PREZZOUSCITA STOPSELL AT PREZZOUSCITA STOPENDIFgraph trades06/28/2020 at 9:55 AM #137349Hi Vonasi, thanks for your work …. above it has been tested tick by tick since 2010 …. then done without since 2003 because I saw that it did not change … the stop is 8% on the same bar cannot be taken …. Thanks again good day …
06/28/2020 at 10:07 AM #137354I just realised that I forgot to add DEFPARAM PRELOADBARS = 0 to the above code so the possible trade count is wrong. There were actually only 100 possible trades. I’m not sure how separating it into 31 strategies then created 102 trades! Anyway we tested all possible trades and the return from the strategy was barely better so it seems your back test just got lucky and hit all the good trades and missed all the bad trades.
I have edited the code in my post to add the correction.
06/28/2020 at 10:08 AM #137360the stop is 8% on the same bar cannot be taken ….
The stop is 8% from the trades opening price and not just in the same bar.
06/28/2020 at 10:12 AM #13736206/28/2020 at 10:18 AM #137366Yes you are right …. the one has been tick by tick since 2010 …
06/28/2020 at 10:35 AM #137372I’m also not a massive fan of the bit where it closes any trade after 43 days as it has a strong chance of curve fitting. I checked it with other values than 43 and got the attached chart. It seems closing any trades over 31 days returns a similar result. So I did a SEB test with that condition to close after 43 days removed. The results were much worse so it seems that giving up on trades that have been open for a long time is worthwhile in this strategy but it worries me that this exit condition makes such a difference especially as so few trades are actually closed by it.
06/28/2020 at 10:40 AM #13737943 days has been put without being tested …. it’s two months of trading, often I use a time stop.
06/28/2020 at 10:43 AM #137383Being a strategy only LONG …. daily I wanted to give time to continue in the current trend …. but it can also be removed, I think it changes little.
06/28/2020 at 11:12 AM #137385I added a “TR” filter …. First Chart without Time Stop (43 Days) the second with Time Stop inserted.
Always Tick By Tick Optimized to 2017.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354// Strategy SR Dow J. Day indicator by roberto gozziDEFPARAM CumulateOrders = falseindicator1 = ADX[10]indicator2 = ADXR[14]c2 = (indicator1[1] > indicator2[1])indicator11 = ADX[10]c1 = (indicator11[1] >= 15)c30 =TR(close)>25ONCE PrezzoC = 0ONCE PrezzoB = 0ONCE PrezzoA = 0Prezzo = CALL SRtestIF Prezzo > 0 THENPrezzoA = PrezzoBPrezzoB = PrezzoCPrezzoC = PrezzoENDIFIf longonmarket and (barindex-tradeindex)>=43 thenSELL AT MARKETENDIFLossMonth =200once StopMonth=1IF Month <> Month[1] THENProfitMonth=strategyprofitStopMonth=1endifIf strategyprofit<=ProfitMonth-LossMonth thenStopMonth=0endifCond = PrezzoB > PrezzoA AND PrezzoB > PrezzoCIF StopMonth=1 and close CROSSES UNDER PrezzoB AND C2 AND C1 AND C30 AND Cond > 0 THENBUY 1 Contract At MarketSET TARGET PROFIT 5* averagetruerange[1](close)SET STOP %LOSS 8ENDIFTrailinglong = 2* averagetruerange[5](close)Trailingsteplong = 5* averagetruerange[1](close)TGL = TrailinglongSTPL = Trailingsteplongif not onmarket thenMAXPRICE = 0PREZZOUSCITA = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL thenPREZZOUSCITA = MAXPRICE-STPLENDIFENDIFif onmarket and PREZZOUSCITA>0 thenEXITSHORT AT PREZZOUSCITA STOPSELL AT PREZZOUSCITA STOPENDIF06/28/2020 at 2:40 PM #137404I ran SEB tests on the code with the new TR filter.
Without the time based selling the code performs terribly in the SEB test. With time based selling there is not much to see because the normal backtest sees almost all the possible trades due to the low number of trades.
What this tells us is that the strategy is very dependent on buying and holding and selling after a certain amount of time in what has been a very up trending market during the test period. Buying and holding will always work in this market!
Without the time based selling it just gets lucky in the normal back test and hits all the good trades and misses all the bad trades because it is already on the market.
-
AuthorPosts
Find exclusive trading pro-tools on