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/28/2020 at 4:30 PM #137408
Hi Vonasi,
When I make the optimizations of my trading systems I ALWAYS stop in December 2017 for any Time Frame, so the computer cannot know beyond that date what happened …. in the attached graph it starts Without the time-based sale from 1 January 2018. …… clearly I try to have the odds in my favor certainty does not exist in anything …..
I thank you for your work and I wish you a good evening …06/28/2020 at 8:59 PM #137432the set target profit needs to be straight below the buy order because it uses average range & close.
It can not be put on the bottom. It’s placed correct and uses the close when conditions are true to go long.
however, you do not use not longonmarket, so, if your are long and conditions are true to go long again are ignored (because DEFPARAM CumulateOrders = false) , it updates the target with the new close of that bar which is incorrect. To have it correct I think you have to use not longonmarket?
If you add not longonmarket performance goes down, however, if you take every signal when in a long and losing position to close & reenter again long, it’s much better.
here again a but, because not sure why the code below makes such a difference.
1234if condbuy[1] thenbuy positionsize contract at marketSET TARGET PROFIT 5* averagetruerange[1](close)endifor
1234if condbuy[1] thenbuy positionsize contract at marketSET TARGET PROFIT 5* averagetruerange[1](close)[1]endif123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118// Strategy SR Dow J. Day indicator by roberto gozziDEFPARAM CumulateOrders = falseonce tradetype = 2 // [1]long & short; [2]long only; [3]short onlyonce reenter = 0 // [0]off; [1]reenter based on positionperftypeonce positionperftype = 0 // [0]perf<>ppv; [1]perf<ppv; [2]perf>ppvonce positionperfvalue = 0indicator1 = 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 = PrezzoENDIFpositionsize=1LossMonth =200once StopMonth=1IF Month <> Month[1] THENProfitMonth=strategyprofitStopMonth=1endifIf strategyprofit<=ProfitMonth-LossMonth thenStopMonth=0endifCond = PrezzoB > PrezzoA AND PrezzoB > PrezzoCcondbuy=StopMonth=1 and close CROSSES UNDER PrezzoB AND C2 AND C1 AND C30 AND Cond > 0// CONDBUY=CONDBUY AND NOT LONGONMARKETcondsell=1ctime=1// entry criteriaif ctime thenif (tradetype=1 or tradetype=2) thenif condbuy thenbuy positionsize contract at marketSET TARGET pPROFIT 5* averagetruerange[1](close)endifendifif (tradetype=1 or tradetype=3) thenif condsell and not shortonmarket thensellshort positionsize contract at marketendifendifif reenter thenif positionperftype=1 thenpositionperformance=positionperf(0)*100<-positionperfvalue // in losselsif positionperftype=2 thenpositionperformance=positionperf(0)*100>positionperfvalue // in profitelsepositionperformance=((positionperf(0)*100)<-positionperfvalue or (positionperf(0)*100)>positionperfvalue) // in loss or profitendifif (tradetype=1 or tradetype=2) thenif condbuy and longonmarket and positionperformance thensell at marketendifif condbuy[1] thenbuy positionsize contract at marketSET TARGET PROFIT 5* averagetruerange[1](close) // or [1] at the end?endifendifif (tradetype=1 or tradetype=3) thenif condsell and shortonmarket and positionperformance thenexitshort at marketendifif condsell[1] and not shortonmarket thensellshort positionsize contract at marketendifendifendifelseif longonmarket and condsell then//sell at marketendifif shortonmarket and condbuy then//exitshort at marketendifendifIf longonmarket and (barindex-tradeindex)>=43 then//SELL AT MARKETENDIFTrailinglong = 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 STOPENDIFSET STOP %LOSS 806/28/2020 at 9:18 PM #137436however, you do not use not longonmarket, so, if your are long and conditions are true to go long again are ignored (because DEFPARAM CumulateOrders = false) , it updates the target with the new close of that bar which is incorrect. To have it correct I think you have to use not longonmarket?
Well spotted Paul. When I added my SEB testing code to the strategy I encased the STOP and TARGET orders in an IF NOT ONMARKET condition so that I could count all possible trades outside of that condition – so my version did not behave the same as the original. I should try to find time to retest with the varying stop and target orders. Bit busy at the moment as leaving the harbour to go sailing for the summer in a few days time and so lots of jobs to do – including hours and hours of fixing my back-up navigation laptop. Who would think it could be so difficult to get a netbook working on XP!
1 user thanked author for this post.
06/29/2020 at 9:09 AM #137458Hello Paul,
The operation from 1 January 2018 is identical …. and it is the only important thing …… if we had put in real since that date in both ways we would have had the same results.
Thank you(I am attaching the graph of your variant from January 2018.)
-
AuthorPosts
Find exclusive trading pro-tools on