Forums › ProRealTime English forum › ProOrder support › 1 TRADE PER DAY › Reply To: 1 TRADE PER DAY
10/18/2021 at 6:18 PM
#179884
OTD (One Trade per Day) works fine for me:
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 |
// Definition of code parameters DEFPARAM CumulateOrders = False // Cumulating positions deactivated // Conditions to enter long positions indicator1 = (DHigh(1) + DLow(1) + DClose(1))/3-(DHigh(1)-DLow(1)) c1 = (close <= indicator1) indicator2 = RSI[14](close) c2 = (indicator2 <= 30) indicator3 = MACDline[12,26,9](close) c3 = (indicator3 <= -0.0015) indicator4 = DLow(1)-2*(DHigh(1)-(DHigh(1) + DLow(1) + DClose(1))/3) c4 = (close >= indicator4) //if intradaybarindex=0 or day<>day[1] then //count=0 //endif //if ( (not onmarket and onmarket[1] and not onmarket[2]) or (tradeindex(1)=tradeindex(2) and tradeindex(1)=barindex[1] and tradeindex(1)>0) or (not onmarket and onmarket[1])) then //count=count+1 //endif OTD = (Barindex - TradeIndex(1) > IntradayBarIndex) //OR 1 // initiate a new BUY order //if c1 AND c2 AND c3 AND c4 and count<1 THEN if c1 AND c2 AND c3 AND c4 and OTD THEN BUY 10 CONTRACT AT MARKET endif // Conditions to exit long positions indicator5 = MACDline[12,26,9](close) c5 = (indicator5 >= 0) IF c5 THEN SELL AT MARKET ENDIF // Conditions to enter short positions indicator6 = MACDline[12,26,9](close) c6 = (indicator6 >= 0.0015) indicator7 = RSI[14](close) c7 = (indicator7 >= 70) indicator8 = (DHigh(1) + DLow(1) + DClose(1))/3+(DHigh(1)-DLow(1)) c8 = (close >= indicator8) indicator9 = DHigh(1)+2*((DHigh(1) + DLow(1) + DClose(1))/3-DLow(1)) c9 = (close <= indicator9) //IF c6 AND c7 AND c8 AND c9 and count<1 THEN IF c6 AND c7 AND c8 AND c9 and OTD THEN SELLSHORT 10 CONTRACT AT MARKET ENDIF // Conditions to exit short positions indicator10 = MACDline[12,26,9](close) c10 = (indicator10 <= -0.0015) IF c10 THEN EXITSHORT AT MARKET ENDIF // Stops and targets SET STOP pLOSS 6 SET TARGET pPROFIT 32 |
try backtesting the same code, just removing the two comment slashes from line 21.