//+------------------------------------------------------------------+ //| LBS V 1.0.mq4 | //| Jacob Yego | //| | //+------------------------------------------------------------------+ #property copyright "Jacob Yego" #property link "PointForex" extern int LotSize = 10000; //Currency amount per Lot extern int Leverage = 0; //Set to your Risk tolerance extern int TrailingStop= 20; extern int Slippage = 5; extern int TakeProfit=100; extern int Triggertime=9; extern int Lots=1; // initialize internal variables double OpenBuy,SlBuy,OpenSell,SlSell,TpBuy,TpSell; //double SS1,SS2,SS3,S1,S2,S3;//for use to develop 3 wave system //double BS1,BS2,BS3,B1,B2,B3;// for use to develop 3 wave system double ATR,h,m,total,cnt,ticket,Spread; double time,NewPrice=0; double PriceOpen, Buy_Sl, Buy_Tp, LotMM; string symbol; //int gear1=2;//develop strategy to open 2nd order with take profit TP*gear1 //int gear2=3; //develop strategy to open 3rd order with take profit TP*gear2 //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { ATR = iATR(NULL,0,3,1); //---- ///////////////////////////////////////////////// // SetLotsMM ///////////////////////////////////////////////// if ( Leverage > 0 ) LotMM = MathMax(MathFloor(AccountBalance()*Leverage/LotSize),1)*LotSize/100000; else LotMM = Lots; if ( AccountFreeMargin() < LotSize/AccountLeverage()*LotMM ) { Alert("Not enough money to open trade. Free Margin = ", AccountFreeMargin(),". Number of Lots in trade = ",LotMM); return(-1); } //+------------------------------------------------------------------+ //Place New Order //+------------------------------------------------------------------+ symbol=Symbol(); Spread = MarketInfo (symbol, MODE_ASK) - MarketInfo (symbol, MODE_BID); time=TimeHour(CurTime()); total=OrdersTotal(); if(total>0) { for(cnt=0;cnt0) { if(Bid-OrderOpenPrice()>Point*TrailingStop) { if(OrderStopLoss()0) { if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) { if(OrderStopLoss()>Ask+(Point*TrailingStop)) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(Point*TrailingStop),OrderTakeProfit(),0,Lime); return(0); } } } } } } return(0); } }