/*[[ Name := TrendScalper Author := Copyright © 2003, Smoky Link := http://www.company.com/ Notes := 2 ema I use 5 minute on EUR Update on every tick := Yes Positions := Long & Short Enable Alerts := Yes Disable alert once hit := No Lots := 1 Stop Loss := 40 Take Profit := 360 Trailing Stop := 15 ]]*/ Defines: Slip(5), tp(10), risk(10), sp(30), mm(-1), munth(9), ts(2.0); vars: direction(0),Opentrades(0), orders(0), first(0), mode(0), cnt(0), Ilo(0), sym(0), b(0); vars: b4signal(0),Signal(0),Triggerline(0),b4Triggerline(0),Nowsignal(0),NowTriggerline(0),sl(0); Signal =iCustom("Trend Trigger Modified",15,5,0.7,0,1000,0,MODE_FIRST,1); b4signal=iCustom("Trend Trigger Modified",15,5,0.7,0,1000,0,MODE_FIRST,2); NowSignal=iCustom("Trend Trigger Modified",15,5,0.7,0,1000,0,MODE_FIRST,0); Triggerline =iCustom("Trend Trigger Modified",15,5,0.7,0,1000,0,MODE_SECOND,1); b4Triggerline =iCustom("Trend Trigger Modified",15,5,0.7,0,1000,0,MODE_SECOND,2); NowTriggerline =iCustom("Trend Trigger Modified",15,5,0.7,0,1000,0,MODE_SECOND,0); Print("Signal=",Signal," Triggerline=",Triggerline); Comment ("TriggerLine ",triggerline,"signal ",signal); Comment("TriggerLine ",triggerline,"signal ",signal, "\n","Account: ",AccNum," - ",AccName, "\n"," StopLoss ", b, "\n"," Lots ",Ilo); //if month < munth then exit; If TakeProfit<10 then Exit; If IsIndirect(Symbol)=TRUE then Exit; If CurTime - LastTradeTime < 300 Then Exit; b=5*Point+iATR(3,1)*ts; /**********************************Money and Risk Management*************************************** Changing the value of mm will give you several money management options mm = 0 : Single 1 lot orders. mm = -1 : Fractional lots/ balance X the risk factor.(use for Mini accts) mm = 1 : Full lots/ balance X the risk factor up to 100 lot orders.(use for Regular accounts) *************************************************************************************************** RISK FACTOR: risk can be anything from 1 up. Factor of 5 adds a lot for every $20,000.00 added to the balance. Factor of 10 adds a lot with every $10.000.00 added to the balance. The higher the risk, the easier it is to blow your margin.. **************************************************************************************************/ if mm < 0 then { Ilo = ceil(Round(Balance*Risk/1000))/100; If Ilo > 100 then { Ilo = 100; } } else { Ilo = lots; }; if mm > 0 then { Ilo = ceil(Balance*Risk/10000)/10; If Ilo > 1 then { Ilo = ceil(Ilo); } if Ilo < 1 then { Ilo = 1; } If Ilo > 100 then { Ilo = 100; } }; //------------------------------------------------------------------------------------------------ Opentrades=0; for cnt=1 to Totaltrades Begin If Ordervalue(cnt,Val_Symbol)=Symbol then {Opentrades=Opentrades+1; };end; If Opentrades=0 and iATR(10,1)>8*Point //and iATR(1,3)<40*Point then { If b4TriggerLine>=100 and High[1]>iBands(100,2,mode_High,1) //and High[2]>iBands(100,2,mode_High,1) //and Close[0]>iBands(100,2,mode_Main,0) and TriggerLine<100 and NowTriggerLine<100 then { SetOrder( OP_SELL, ILO, Bid, Slip, Bid+Stoploss*Point, Bid-TakeProfit*Point, Red); Exit; }; If b4TriggerLine<=(-100) and Low[1](-100) and NowTriggerLine>(-100) then { SetOrder( OP_BUY, ILO, Ask, Slip, Ask-Stoploss*Point, Ask+TakeProfit*Point, White); Exit; }; }; //----------------------------------------Order Control------------------------------------------- orders=0; sym=0; For cnt=1 to TotalTrades begin If Ord(cnt,Val_Symbol)=Symbol then { sym=cnt; orders=1; }; mode=Ord(sym,VAL_TYPE); If mode=OP_BUY & Ord(sym,VAL_SYMBOL)=Symbol then { If (Ord(sym,Val_OPENPRICE)>Ord(sym,VAL_STOPLOSS) & Bid-Ord(sym,Val_OPENPRICE)>tp*Point & Triggerline<100) then { CloseOrder( Ord(sym,VAL_TICKET), Ord(sym,VAL_LOTS), Bid, Slip, Red); Exit; }; If (Bid-Ord(sym,VAL_OPENPRICE))>(b)then { If Ord(sym,VAL_STOPLOSS)<(Bid-b) then { ModifyOrder( Ord(sym,VAL_TICKET), Ord(sym,VAL_OPENPRICE), Bid-b, Ord(sym,VAL_TAKEPROFIT), LimeGreen); Exit; }; }; }; If mode=OP_SELL & OrderValue(sym,VAL_SYMBOL)=Symbol then { If (Ord(sym,Val_OPENPRICE)tp*Point & Triggerline>(-100)) then { CloseOrder( Ord(sym,VAL_TICKET), Ord(sym,VAL_LOTS), Ask, Slip, Red); Exit; }; If (Ord(sym,VAL_OPENPRICE)-Ask)>(b) then { If Ord(sym,VAL_STOPLOSS)>(Ask+b) then { ModifyOrder( Ord(sym,VAL_TICKET), Ord(sym,VAL_OPENPRICE), Ask+b, Ord(sym,VAL_TAKEPROFIT), HotPink); Exit; }; }; }; End;