Hull average cross over strategy – where I am going wrong?
Forums › ProRealTime English forum › ProOrder support › Hull average cross over strategy – where I am going wrong?
- This topic has 52 replies, 4 voices, and was last updated 4 years ago by
8ficusst.
-
-
04/22/2021 at 8:07 PM #167823
working in ProOrder due to GRAPH
Been working outside all day, think the sun has got to me … I haven’t put it in ProOrder yet! 🙂
I cobbled 8ficusst code together while eating my tea (sorry Vonasi, dinner!) and was surprised at the results … hence I posted it.
04/23/2021 at 8:05 AM #167834GraHa: Anyway, why can’t / don’t you trade your backtest version … it contains Buy and Sellshort and you say it is the same as the Auto version??
Hi again – thanks for all your efforts – they are much appreciated.
I really wish I knew more about how the AUTO software runs a code, but the manual does not reveal this in detail. I have tried ELSE and many other instructions in the conditions part of the code, but to no avail. The manual is far too sparse when it comes to describing crossover models designed for AUTO TRADING. Maybe someone in these ProRealCode forums has already solved a similar problem, but I don’t know how to search through all these thousands of posts — maybe there is a way to do this that you know about?
But just for clarity: As far as my understanding goes, BackTest codes with multiple variables and multiple conditions cannot be used exactly as they are for AUTO trading, as the variables and conditions must be detailed individually so that the AUTO software can choose which elements to match to the price action at any specific time.
Still trying!!
04/23/2021 at 8:32 AM #167835GraHal wrote:
Did you try below …
123456789if not shortonmarket and AnyOfTheShorts and OpposingLongs thensellshort at close stopendif//////// LONGS ///////////////////////if not longonmarket and AnyOfTheLongs and OpposingShorts thenbuy at close stopendifI did already try this combo, thanks.
MODERATORS COMMENT:
- Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.
Your post has been edited.
04/23/2021 at 9:33 AM #167856BackTest codes with multiple variables and multiple conditions cannot be used exactly as they are for AUTO trading
Above is what we all do else what is the point in backtesting / optimising if not to refine a strategy so as to make profit running in Live.
Okay I know some use the backtest platform to watch forward running live then take manual trades when conditions are met etc.
My hunch on why your Auto-System code is taking trades at every bar is that the conditions are so loose that conditions are met for an opposing trade / reversal at every bar?
You could test my hunch by using below and you should get a trade every 10 bars?
You would need to add code to get the 1st trade open so as to get the party started! 🙂
123456789if barindex - tradeindex > 10 AND AnyOfTheShorts and OpposingLongs thensellshort at close stopendif//////// LONGS ///////////////////////if barindex - tradeindex > 10 AND AnyOfTheLongs and OpposingShorts thenbuy at close stopendif04/23/2021 at 9:40 AM #167858I have also tried this format, where ELSE is used. (In the conditions at the bottom of the page)
But that never worked either………
Using ELSE123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466defparam cumulateorders = falsedefparam preloadbars = 5000//defparam flatbefore = 125000//defparam flatafter =155800//SET TARGET PPROFIT (80)//SET STOP PLOSS (20)a = S200 or S220 or S240 or S260 or S280 or S300 or S320 or S340 or S360 or S380 or S400 or S420 or S440 or S460 or S480 or S500 or S520 or S540 or S560 or S580 or S600 or S620 or S640 or S660 or S680m200=momentum[200](close)h1=HullAverage[110](momentum[200](close))h2=HullAverage[120](momentum[200](close))S200 = h1 < h2m220=momentum[220](close)h3=HullAverage[110](momentum[220](close))h4=HullAverage[120](momentum[220](close))S220 = h3 < h4m240=momentum[240](close)h5=HullAverage[110](momentum[240](close))h6=HullAverage[120](momentum[240](close))S240 = h5 < h6m260=momentum[260](close)h7=HullAverage[110](momentum[260](close))h8=HullAverage[120](momentum[260](close))S260 = h7 < h8m280=momentum[280](close)h9=HullAverage[110](momentum[280](close))h10=HullAverage[120](momentum[280](close))S280 = h9 < h10m300=momentum[300](close)h11=HullAverage[110](momentum[300](close))h12=HullAverage[120](momentum[300](close))S300 = h11 < h12m320=momentum[320](close)h13=HullAverage[110](momentum[320](close))h14=HullAverage[120](momentum[320](close))S320 = h13 < h14m340=momentum[340](close)h15=HullAverage[110](momentum[340](close))h16=HullAverage[120](momentum[340](close))S340 = h15 < h16m360=momentum[360](close)h17=HullAverage[110](momentum[360](close))h18=HullAverage[120](momentum[360](close))S360 = h17 < h18m380=momentum[380](close)h19=HullAverage[110](momentum[380](close))h20=HullAverage[120](momentum[380](close))S380 = h19 < h20m400=momentum[400](close)h21=HullAverage[110](momentum[400](close))h22=HullAverage[120](momentum[400](close))S400 = h21 < h22m420=momentum[420](close)h23=HullAverage[110](momentum[420](close))h24=HullAverage[120](momentum[420](close))S420 = h23 < h24m440=momentum[440](close)h25=HullAverage[110](momentum[440](close))h26=HullAverage[120](momentum[440](close))S440 = h25 < h26m460=momentum[460](close)h27=HullAverage[110](momentum[460](close))h28=HullAverage[120](momentum[460](close))S460 = h27 < h28m480=momentum[480](close)h29=HullAverage[110](momentum[480](close))h30=HullAverage[120](momentum[480](close))S480 = h29 < h30m500=momentum[500](close)h31=HullAverage[110](momentum[500](close))h32=HullAverage[120](momentum[500](close))S500 = h31 < h32m520=momentum[520](close)h33=HullAverage[110](momentum[520](close))h34=HullAverage[120](momentum[520](close))S520 = h33 < h34m540=momentum[540](close)h35=HullAverage[110](momentum[540](close))h36=HullAverage[120](momentum[540](close))S540 = h35 < h36m560=momentum[560](close)h37=HullAverage[110](momentum[560](close))h38=HullAverage[120](momentum[560](close))S560 = h37 < h38m580=momentum[580](close)h39=HullAverage[110](momentum[580](close))h40=HullAverage[120](momentum[580](close))S580 = h39 < h40m600=momentum[600](close)h41=HullAverage[110](momentum[600](close))h42=HullAverage[120](momentum[600](close))S600 = h41 < h42m620=momentum[620](close)h43=HullAverage[110](momentum[620](close))h44=HullAverage[120](momentum[620](close))S620 = h43 < h44m640=momentum[640](close)h45=HullAverage[110](momentum[640](close))h46=HullAverage[120](momentum[640](close))S640 = h45 < h46m660=momentum[660](close)h47=HullAverage[110](momentum[660](close))h48=HullAverage[120](momentum[660](close))S660 = h47 < h48m680=momentum[680](close)h49=HullAverage[110](momentum[680](close))h50=HullAverage[120](momentum[680](close))S680 = h49 < h50//////////////////////////////////////////b = l200 or l220 or l240 or l260 or l280 or l300 or l320 or l340 or l360 or l380 or l400 or l420 or l440 or l460 or l480 or l500 or l520 or l540 or l560 or l580 or l600 or l620 or l640 or l660 or l680c200=momentum[200](close)k1=HullAverage[110](momentum[200](close))k2=HullAverage[120](momentum[200](close))L200 = k1 > k2c220=momentum[220](close)k3=HullAverage[110](momentum[220](close))k4=HullAverage[120](momentum[220](close))L220 = k3 > k4c240=momentum[240](close)k5=HullAverage[110](momentum[240](close))k6=HullAverage[120](momentum[240](close))L240 = k5 > k6c260=momentum[260](close)k7=HullAverage[110](momentum[260](close))k8=HullAverage[120](momentum[260](close))L260 = k7 > k8c280=momentum[280](close)k9=HullAverage[110](momentum[280](close))k10=HullAverage[120](momentum[280](close))L280 = k9 > k10c300=momentum[300](close)k11=HullAverage[110](momentum[300](close))k12=HullAverage[120](momentum[300](close))L300 = k11 > k12c320=momentum[320](close)k13=HullAverage[110](momentum[320](close))k14=HullAverage[120](momentum[320](close))L320 = k13 > k14c340=momentum[340](close)k15=HullAverage[110](momentum[340](close))k16=HullAverage[120](momentum[340](close))L340 = k15 > k16c360=momentum[360](close)k17=HullAverage[110](momentum[360](close))k18=HullAverage[120](momentum[360](close))L360 = k17 > k18c380=momentum[380](close)k19=HullAverage[110](momentum[380](close))k20=HullAverage[120](momentum[380](close))L380 = k19 > k20c400=momentum[400](close)k21=HullAverage[110](momentum[400](close))k22=HullAverage[120](momentum[400](close))L400 = k21 > k22c420=momentum[420](close)k23=HullAverage[110](momentum[420](close))k24=HullAverage[120](momentum[420](close))L420 = k23 > k24c440=momentum[440](close)k25=HullAverage[110](momentum[440](close))k26=HullAverage[120](momentum[440](close))L440 = k25 > k26c460=momentum[460](close)k27=HullAverage[110](momentum[460](close))k28=HullAverage[120](momentum[460](close))L460 = k27 > k28c480=momentum[480](close)k29=HullAverage[110](momentum[480](close))k30=HullAverage[120](momentum[480](close))L480 = k29 > k30c500=momentum[500](close)k31=HullAverage[110](momentum[500](close))k32=HullAverage[120](momentum[500](close))L500 = k31 > k32c520=momentum[520](close)k33=HullAverage[110](momentum[520](close))k34=HullAverage[120](momentum[520](close))L520 = k33 > k34c540=momentum[540](close)k35=HullAverage[110](momentum[540](close))k36=HullAverage[120](momentum[540](close))L540 = k35 > k36c560=momentum[560](close)k37=HullAverage[110](momentum[560](close))k38=HullAverage[120](momentum[560](close))L560 = k37 > k38c580=momentum[580](close)k39=HullAverage[110](momentum[580](close))k40=HullAverage[120](momentum[580](close))L580 = k39 > k40c600=momentum[600](close)k41=HullAverage[110](momentum[600](close))k42=HullAverage[120](momentum[600](close))L600 = k41 > k42c620=momentum[620](close)k43=HullAverage[110](momentum[620](close))k44=HullAverage[120](momentum[620](close))L620 = k43 > k44c640=momentum[640](close)k45=HullAverage[110](momentum[640](close))k46=HullAverage[120](momentum[640](close))L640 = k45 > k46c660=momentum[660](close)k47=HullAverage[110](momentum[660](close))k48=HullAverage[120](momentum[660](close))L660 = k47 > k48c680=momentum[680](close)k49=HullAverage[110](momentum[680](close))k50=HullAverage[120](momentum[680](close))L680 = k49 > k50if s200 and NOT b thensellshort at close stopelseif s220 and NOT b thensellshort at close stopelseif s240 and NOT b thensellshort at close stopelseif s260 and NOT b thensellshort at close stopelseif s280 and NOT b thensellshort at close stopelseif s300 and NOT b thensellshort at close stopelseif s320 and NOT b thensellshort at close stopelseif s340 and NOT b thensellshort at close stopelseif s360 and NOT b thensellshort at close stopelseif s380 and NOT b thensellshort at close stopelseif s400 and NOT b thensellshort at close stopelseif s420 and NOT b thensellshort at close stopelseif s440 and NOT b thensellshort at close stopelseif s460 and NOT b thensellshort at close stopelseif s480 and NOT b thensellshort at close stopelseif s500 and NOT b thensellshort at close stopelseif s520 and NOT b thensellshort at close stopelseif s540 and NOT b thensellshort at close stopelseif s560 and NOT b thensellshort at close stopelseif s580 and NOT b thensellshort at close stopelseif s600 and NOT b thensellshort at close stopelseif s620 and NOT b thensellshort at close stopelseif s640 and NOT b thensellshort at close stopelseif s660 and NOT b thensellshort at close stopelseif s680 and NOT b thensellshort at close stopendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendif///////////////////////////////////////if l200 and NOT a thenbuy at close stopelseif l220 and NOT a thenbuy at close stopelseif l240 and NOT a thenbuy at close stopelseif l260 and NOT a thenbuy at close stopelseif l280 and NOT a thenbuy at close stopelseif l300 and NOT a thenbuy at close stopelseif l320 and NOT a thenbuy at close stopelseif l340 and NOT a thenbuy at close stopelseif l360 and NOT a thenbuy at close stopelseif l380 and NOT a thenbuy at close stopelseif l400 and NOT a thenbuy at close stopelseif l420 and NOT a thenbuy at close stopelseif l440 and NOT a thenbuy at close stopelseif l460 and NOT a thenbuy at close stopelseif l480 and NOT a thenbuy at close stopelseif l500 and NOT a thenbuy at close stopelseif l520 and NOT a thenbuy at close stopelseif l540 and NOT a thenbuy at close stopelseif l560 and NOT a thenbuy at close stopelseif l580 and NOT a thenbuy at close stopelseif l600 and NOT a thenbuy at close stopelseif l620 and NOT a thenbuy at close stopelseif l640 and NOT a thenbuy at close stopelseif l660 and NOT a thenbuy at close stopelseif l680 and NOT a thenbuy at close stopendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendifendif04/23/2021 at 9:52 AM #16785904/23/2021 at 10:07 AM #16786504/23/2021 at 10:10 AM #167867I will try your code suggestion and will report back, thanks Gra.
I understand that “looseness” could trigger too many trades, but the fact is this problem does not occur with BACKTEST using the exact same code.
So maybe the BACKTEST system needs different coding expressions than the AUTO system??
04/23/2021 at 10:31 AM #167869Gra, do you know if the AUTO system uses the same methodology as the BackTest system uses at each bar as it progresses?
It would help a lot if you could find out. I’m not asking for proprietary code/information or anything remotely like that, but it would be helpful to know how the AUTO system selects the options that I load into my codes. Otherwise we are battling in the dark here.
04/23/2021 at 10:40 AM #16787104/23/2021 at 5:36 PM #16791104/24/2021 at 10:54 AM #16795204/26/2021 at 10:09 AM #16803904/26/2021 at 10:33 AM #168044I have also tried this format,
I tested the version shown in the post above.
04/26/2021 at 1:29 PM #168067 -
AuthorPosts
