/*[[ Name := TrendScalper_TR Author := Smoky's Trendscalper modified by TR_n00btrader@frisurf.no Link := http://www.company.com/ Notes := Update on every tick := Yes Positions := Long & Short Enable Alerts := Yes Disable alert once hit := No Lots := 0.1 Stop Loss := 40 Take Profit := 999 Trailing Stop := 999 ]]*/ Defines: Slip(5), tp(999), risk(40), mm(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),LastOpByExpert(0),LastBarChecked(0); Comment("Account: ",AccNum," - ",AccName, "\n"," StopLoss ", b, " Tick no. ", v[0], "\n"," Lots ",Ilo); //if month < munth then exit; //if day<26 then exit; If TakeProfit<10 then Exit; If IsIndirect(Symbol)=TRUE then Exit; If CurTime < LastTradeTime + 20 Then exit; //If CurTime - LastOpByExpert < 300 Then Exit; /**********************************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(Balance*Risk/10000)/10; 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 TimeToStr(Time[1]) = "2004.06.17 14:30" or TimeToStr(Time[1]) = "2004.06.17 14:15" then Print (TimeToStr(Time[1])," ", iCustom("TrendScalpIndic",15,0,5,0.7,0,1000,0,MODE_SECOND,1)," ", iCustom("TrendScalpIndic",15,0,5,0.7,0,1000,0,MODE_FIRST,1)," ", V[0]); If Opentrades=0 //and iATR(5,2)iBands(100,1,mode_High,1) and not Low[1]=100 and High[1]>iBands(100,1,mode_High,1) //(High[0]>iBands(100,2,mode_High,0) or High[1]>iBands(100,2,mode_High,1)) //(High[0]>iBands(100,2,mode_High,0) or High[1]>iBands(100,2,mode_High,1) or High[2]>iBands(100,2,mode_High,2)) and TriggerLine<100 //and iATR(10,1)>6*Point then { SetOrder( OP_SELL, ILO, Bid, Slip, Bid+Stoploss*Point, Bid-TakeProfit*Point, Red); LastOpByExpert=Curtime; // Print (TimeToStr(Time[1])," ", Triggerline); Exit; }; If b4TriggerLine<=(-100) and Low[1](-100) //and iATR(10,1)>6*Point then { SetOrder( OP_BUY, ILO, Ask, Slip, Ask-Stoploss*Point, Ask+TakeProfit*Point, White); LastOpByExpert=Curtime; Exit; }; }; //----------------------------------------Order Control------------------------------------------- orders=0; sym=0; For cnt=1 to TotalTrades begin If Ord(cnt,Val_Symbol)=Symbol then { sym=cnt; orders=1; NowTriggerline =iCustom("TrendScalpIndic",15,0,5,0.7,0,1000,0,MODE_SECOND,0); b=5*Point+iATR(3,1)*4; }; 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 & NowTriggerline<100|High[1]>iBands(100,1.5,mode_High,1)& NowTriggerline<100)) then { CloseOrder( Ord(sym,VAL_TICKET), Ord(sym,VAL_LOTS), Bid, Slip, Red); LastOpByExpert=Curtime; 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); LastOpByExpert=Curtime; Exit; }; }; }; If mode=OP_SELL & OrderValue(sym,VAL_SYMBOL)=Symbol then { If Ord(sym,Val_OPENPRICE)tp*Point & NowTriggerline>(-100)| Low[1](-100))) then { CloseOrder( Ord(sym,VAL_TICKET), Ord(sym,VAL_LOTS), Ask, Slip, Red); LastOpByExpert=Curtime; 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); LastOpByExpert=Curtime; Exit; }; }; }; End;