//+-------------------------------------------------------------------+ //| Made/Modified by Alejandro Galindo | //| | //| If this work/modification is helpful to you | //| send me a PayPal donation to ag@elcactus.com | //| any help is apreciated :) | //| Thanks. | //+-------------------------------------------------------------------+ /*[[ Name := Alejandro Galindo Author := Copyright © 2005, Alejandro Galindo. Link := Lots := 1.00 Stop Loss := 999 Take Profit := 999 Trailing Stop := 999 ]]*/ Define: mm(0); Define: risk(12); Define: ATR(50); Define: Coeficient(3); var: cnt(0),tmp(0); var: lotsi(0); var: NRTRBUY(0), NRTRSELL(0); var: OpenTrades(0); var: Slippage(5); var: OpenBuy(false), OpenSell(false), CloseBuy(false), CloseSell(false); //var: SuperSignalF(0), SuperSignalS(0); //If TimeYear(time)<2005 then Exit; if Curtime - LastTradeTime < 15 then exit; if mm<>0 then lotsi=Ceil(Balance*risk/10000)/10 else lotsi=Lots; OpenBuy=False; OpenSell=False; CloseBuy=False; CloseSell=False; NRTRBUY= iCustom("NRTR_ATR_STOP",ATR,Coeficient,MODE_FIRST,1); NRTRSELL= iCustom("NRTR_ATR_STOP",ATR,Coeficient,MODE_SECOND,1); OpenTrades=0; For cnt=1 to TotalTrades { If (OrderValue(cnt,VAL_SYMBOL) == symbol) then OpenTrades++; }; print("NRTRBUY=",NRTRBUY," NRTRSELL=",NRTRSELL); If NRTRBUY0 then { CloseSell=True; OpenBuy=True; }; If NRTRSELL>High[1] and NRTRSELL>0 then { CloseBuy=True; OpenSell=True; }; // if we have opened positions we take care of them for cnt=1 to TotalTrades { if OrderValue(cnt,VAL_SYMBOL) == Symbol then { if OrderValue(cnt,VAL_TYPE) == OP_BUY then { if CloseBuy then { CloseOrder(OrderValue(cnt,VAL_TICKET),Lotsi,Bid,Slippage,green); Exit; }; }; if OrderValue(cnt,VAL_TYPE) == OP_SELL then { if CloseSell then { CloseOrder(OrderValue(cnt,VAL_TICKET),Lotsi,Ask,Slippage,green); Exit; }; }; }; }; If OpenTrades<1 and OpenBuy then { SetOrder(OP_BUY,Lotsi,Ask,Slippage,0,0,Blue); SetArrow(CurTime, Low - 15 * Point, 233, BLUE); Exit; }; If OpenTrades<1 and OpenSell then { SetOrder(OP_SELL,Lotsi,Bid,Slippage,0,0,Red); SetArrow(CurTime, High + 15 * Point, 234, RED); Exit; };