Forums › ProRealTime English forum › ProOrder support › Unable to back test RSI and Hull average strategy › Reply To: Unable to back test RSI and Hull average strategy
05/21/2020 at 8:00 PM
#132689
I have coded after your kind help. A few queries……….
- It runs but only buys and not sells
- I would like to also add additional trades say after the initial buy ( in this case) after the RSI and initial 15/30 Hull crossover (adding to the initial trade). These additional trades would be added on every subsequent 15/30 Hull cross over on the buy side and all exit together once RSI (71) and 15/30 Hull crossover create the signal to exit the trade. So cumulative trades. Vice versa for when going short.
- I have copied and inserted the code below using the Insert PRT button……but I do not appear to be able to catch line numbers like you guys have?
-
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsif RSI[14](close) crosses under 29 thenflag = 1endifPerioda= 15innera = 2*weightedaverage[round( Perioda/2)](close)-weightedaverage[Perioda](close)HULLa = weightedaverage[round(sqrt(Perioda))](innera)Periodb= 30innerb = 2*weightedaverage[round( Periodb/2)](close)-weightedaverage[Periodb](close)HULLb = weightedaverage[round(sqrt(Periodb))](innerb)c2 = HULLa crosses over HULLbIF flag = 1 AND c2 THENBUY 1 PERPOINT AT MARKETflag = 0ENDIF// Conditions to exit long positionsif RSI[14](close) crosses over 71 thenflag = 2endifPerioda= 15innera = 2*weightedaverage[round( Perioda/2)](close)-weightedaverage[Perioda](close)HULLa = weightedaverage[round(sqrt(Perioda))](innera)Periodb= 30innerb = 2*weightedaverage[round( Periodb/2)](close)-weightedaverage[Periodb](close)HULLb = weightedaverage[round(sqrt(Periodb))](innerb)c4 = HULLa crosses under HULLbIF flag = 2 AND c4 THENSELL 1 PERPOINT AT MARKETflag = 0ENDIF// Conditions to enter short positionsif RSI[14](close) crosses over 71 thenflag = 3endifPerioda= 15innera = 2*weightedaverage[round( Perioda/2)](close)-weightedaverage[Perioda](close)HULLa = weightedaverage[round(sqrt(Perioda))](innera)Periodb= 30innerb = 2*weightedaverage[round( Periodb/2)](close)-weightedaverage[Periodb](close)HULLb = weightedaverage[round(sqrt(Periodb))](innerb)c6 = HULLa crosses under HULLbIF flag = 3 AND c6 THENSELL 1 PERPOINT AT MARKETflag = 0ENDIF// Conditions to exit short positionsif RSI[14](close) crosses under 29 thenflag = 4endifPerioda= 15innera = 2*weightedaverage[round( Perioda/2)](close)-weightedaverage[Perioda](close)HULLa = weightedaverage[round(sqrt(Perioda))](innera)Periodb= 30innerb = 2*weightedaverage[round( Periodb/2)](close)-weightedaverage[Periodb](close)HULLb = weightedaverage[round(sqrt(Periodb))](innerb)c8 = HULLa crosses over HULLbIF flag = 4 AND c8 THENBUY 1 PERPOINT AT MARKETflag = 0ENDIF