Forums › ProRealTime English forum › ProOrder support › Confirmation of Trend using Neural Networks (by kind permission of Leo) › Reply To: Confirmation of Trend using Neural Networks (by kind permission of Leo)
08/29/2018 at 11:44 AM
#79288
Vonasi proposed so here it is … SPTRD on 1 Min TF 100k bars, spread = 4
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 |
DEFPARAM CUMULATEORDERS = False //Variables: candlesback=5 ProfitRiskRatio=2 spread=1.5 myATR=average[20](range)+std[20](range) ExtraStopLoss=MyATR //ExtraStopLoss=3*spread*pipsize //for long trades classifierlong=0 FOR scanL=1 to candlesback DO IF classifierlong[scanL]=1 then BREAK ENDIF LongTradeLength=ProfitRiskRatio*(close[scanL]-(low[scanL]-ExtraStopLoss[scanL])) IF close[scanL]+LongTradeLength < high-spread*pipsize then IF lowest[scanL+1](low) > low[scanL]-ExtraStopLoss[scanL]+spread*pipsize then classifierlong=1 //candleentrylong=barindex-scanL BREAK ENDIF ENDIF NEXT IF classifierlong=1 and Close > Average[120](close)then //DRAWSEGMENT(candleentrylong,close[barindex-candleentrylong],barindex,close[barindex-candleentrylong]+LongTradeLength) COLOURED(0,150,0) //DRAWELLIPSE(candleentrylong-1,low[barindex-candleentrylong]-ExtraStopLoss,barindex+1,high+ExtraStopLoss) COLOURED(0,150,0) Buy 2 Contract at Market ENDIF //for short trades classifiershort=0 FOR scanS=1 to candlesback DO IF classifiershort[scanS]=1 then BREAK ENDIF ShortTradeLength=ProfitRiskRatio*((high[scanS]-close[scanS])+ExtraStopLoss[scanS]) IF close[scanS]-ShortTradeLength > low+spread*pipsize then IF highest[scanS+1](high) < high[scanS]+ExtraStopLoss[scanS]-spread*pipsize then classifiershort=1 //candleentryshort=barindex-scanS BREAK ENDIF ENDIF NEXT IF classifiershort=1 and Close < Average[120](close) then //DRAWSEGMENT(candleentryshort,close[barindex-candleentryshort],barindex,close[barindex-candleentryshort]-ShortTradeLength) COLOURED(150,0,0) //DRAWELLIPSE(candleentryshort-1,high[barindex-candleentryshort]+ExtraStopLoss,barindex+1,low-ExtraStopLoss) COLOURED(150,0,0) SellShort 2 Contract at Market ENDIF SET TARGET PROFIT 70 SET STOP PLOSS 35 |