/*[[ Name := Reversal_EA_MT3 Author := Copyright © 2005, Metex Investments Inc. Link := http://www.metexinvest.com/ Lots := 1.00 Stop Loss := 15 Take Profit := 10 Trailing Stop := 5 ]]*/ Defines: Slippage(3); Defines: risklevel(3); var: temp(0),lotss(0),i(0); var: OpenTrades(0); var: cnt(0); lotss=Ceil((Balance*risklevel*PriceAsk)/100000); if ((O[2]>C[2] and C[1]>O[1] and C[2]=O[1]) and O[2]-C[2]> 1*Point and C[1]-O[1]>1*Point) then { OpenTrades = 0; For i = 1 to TotalTrades { if OrderValue(i,VAL_SYMBOL) = Symbol then OpenTrades++; }; If OpenTrades<1 then { SetOrder(OP_BUY,lots,ask,Slippage,ask-StopLoss*point,ask+TakeProfit*Point,Blue); }; }; If TrailingStop>0 then { for cnt=1 to TotalTrades { If Ord(cnt,VAL_TYPE)=OP_BUY and Ord(cnt,VAL_SYMBOL)=Symbol then { If (Bid-Ord(cnt,VAL_OPENPRICE))>(TrailingStop*Point) then { If Ord(cnt,VAL_STOPLOSS)<(Bid-TrailingStop*Point) then { ModifyOrder(Ord(cnt,VAL_TICKET),Ord(cnt,VAL_OPENPRICE), Bid-TrailingStop*Point,Ord(cnt,VAL_TAKEPROFIT),Blue); Exit; }; }; }; }; if ((C[2]>O[2] and O[1]>C[1] and C[2]=O[1]) and C[2]-O[2]> 1*Point and O[1]-C[1]>1*Point) then { OpenTrades = 0; For i = 1 to TotalTrades { if OrderValue(i,VAL_SYMBOL) = Symbol then OpenTrades++; }; If OpenTrades<1 then { SetOrder(OP_SELL,lots,bid,Slippage,bid+StopLoss*point,bid-TakeProfit*Point,red); }; }; for cnt=1 to TotalTrades { If Ord(cnt,VAL_TYPE)=OP_SELL and Ord(cnt,VAL_SYMBOL)=Symbol then { If (Ord(cnt,VAL_OPENPRICE)-Ask)>(TrailingStop*Point) then { If Ord(cnt,VAL_STOPLOSS)>(Ask+TrailingStop*Point) or Ord(cnt,VAL_STOPLOSS)=0 then { ModifyOrder(Ord(cnt,VAL_TICKET),Ord(cnt,VAL_OPENPRICE), Ask+TrailingStop*Point,Ord(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; }; };