/*[[ Name := RSI-ZigZag Expert 1 Author := Copyright © 2005 Alejandro Galindo Link := http://tradingstuff.pisem.net Lots := 1.00 Stop Loss := 999 Take Profit := 999 Trailing Stop := 15 ]]*/ Define: mm(0); Define: risk(12); Define: Slippage(5); Variable : shift(0), rsi1(0), textVar(" "); var: myFileName(" "),myFile(0); var: alertTime(""); var: Lotsi(0); var: cnt(0); var: zigzag(0); var: rsi2(0), rsi(0); if mm<>0 then Lotsi=Ceil(Balance*risk/10000)/10 else Lotsi=Lots; zigzag = iCustom("zigzag",mode_first,1); if zigzag>0 then { rsi1 = iRSIEx(14,0,PRICE_WEIGHTED,MODE_FIRST,1); rsi2 = iRSIEx(14,0,PRICE_WEIGHTED,MODE_FIRST,2); rsi = iRSIEx(14,0,PRICE_WEIGHTED,MODE_FIRST,0); } else { rsi1 = 0; }; If (TotalTrades<1) then { if (rsi1 > 0) then { If (zigzag=Low[1]) then //If (rsi2>rsi1 and rsi>rsi1) then { SetOrder(OP_BUY,Lotsi,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,Blue); SetArrow(CurTime, LOW - 15 * Point, 233, BLUE); Exit; }; If (zigzag=High[1]) then //If (rsi20 and rsi20 then { If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop) then { If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then { ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Yellow); Exit; }; }; }; }; if (OrderValue(cnt,VAL_TYPE) == OP_SELL) then { If (zigzag=Low[1]) then //If (rsi1>0 and rsi2>rsi1 and rsi>rsi1) then { CloseOrder(OrderValue(cnt,VAL_TICKET),Lotsi,Ask,Slippage,green); Exit; }; If TrailingStop>0 then { If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then { If OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingStop) then { ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Purple); Exit; }; }; }; }; }; };