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/22/2020 at 10:53 AM
#132793
GraHal thanks for that.
Unfortunately, it only SELLS now and does not BUY,
The idea is say when it sells and reaches the point where it exits (NB the exit is now the signal to go long – in the long criteria). The trade is then long until it exits which would trigger the short and so forth………………….I think i have explained it in my gibberish – LOL.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
// Definition of code parameters DEFPARAM CumulateOrders = False // Cumulating positions deactivated // Conditions to enter long positions if RSI[14](close) crosses under 29 then flag = 1 endif Perioda= 15 innera = 2*weightedaverage[round( Perioda/2)](close)-weightedaverage[Perioda](close) HULLa = weightedaverage[round(sqrt(Perioda))](innera) Periodb= 30 innerb = 2*weightedaverage[round( Periodb/2)](close)-weightedaverage[Periodb](close) HULLb = weightedaverage[round(sqrt(Periodb))](innerb) c2 = HULLa crosses over HULLb IF flag = 1 AND c2 THEN BUY 1 PERPOINT AT MARKET flag = 0 ENDIF // Conditions to exit long positions if RSI[14](close) crosses over 71 then flag = 2 endif Perioda= 15 innera = 2*weightedaverage[round( Perioda/2)](close)-weightedaverage[Perioda](close) HULLa = weightedaverage[round(sqrt(Perioda))](innera) Periodb= 30 innerb = 2*weightedaverage[round( Periodb/2)](close)-weightedaverage[Periodb](close) HULLb = weightedaverage[round(sqrt(Periodb))](innerb) c4 = HULLa crosses under HULLb IF flag = 2 AND c4 THEN SELL 1 PERPOINT AT MARKET flag = 0 ENDIF // Conditions to enter short positions if RSI[14](close) crosses over 71 then flag = 3 endif Perioda= 15 innera = 2*weightedaverage[round( Perioda/2)](close)-weightedaverage[Perioda](close) HULLa = weightedaverage[round(sqrt(Perioda))](innera) Periodb= 30 innerb = 2*weightedaverage[round( Periodb/2)](close)-weightedaverage[Periodb](close) HULLb = weightedaverage[round(sqrt(Periodb))](innerb) c6 = HULLa crosses under HULLb IF flag = 3 AND c6 THEN sellshort 1 PERPOINT AT MARKET flag = 0 ENDIF // Conditions to exit short positions if RSI[14](close) crosses under 29 then flag = 4 endif Perioda= 15 innera = 2*weightedaverage[round( Perioda/2)](close)-weightedaverage[Perioda](close) HULLa = weightedaverage[round(sqrt(Perioda))](innera) Periodb= 30 innerb = 2*weightedaverage[round( Periodb/2)](close)-weightedaverage[Periodb](close) HULLb = weightedaverage[round(sqrt(Periodb))](innerb) c8 = HULLa crosses over HULLb IF flag = 4 AND c8 THEN exitshort 1 PERPOINT AT MARKET flag = 0 ENDIF |