//+------------------------------------------------------------------+ //| | //| | //| www.arabictrader.com/vb | //| | //| mrdollar.cs@gmail.com | //+------------------------------------------------------------------+ #property copyright "MR.dollarEA" #property link "mrdollar.cs@gmail.com" input double USDProfit=200; input double USDLoss=0; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit() { CreatePanel("Panel_Info_Info1",OBJ_EDIT,"www.ArabicTrader.com",10,25,190,20,DodgerBlue,White,DodgerBlue,11,true,false,0,ALIGN_CENTER); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| FUNCTION DEFINITIONS deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { ObjectDelete(0,"Panel_Info_Info1"); } //+------------------------------------------------------------------+ //| FUNCTION DEFINITIONS Start function | //+------------------------------------------------------------------+ void OnTick() { if(Profit()>=USDProfit) { CloseOrders(); } if(Profit()<=-1*(MathAbs(USDLoss)) && USDLoss!=0) { CloseOrders(); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int orderscnt(int type) { int cnt=0; for(int i=0;i=0; cnt--) { bool select=OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()==Symbol()) { if(OrderType()==OP_BUY) { bool close=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),30); } else if(OrderType()==OP_SELL) { close=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),30); } } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double Profit() { double p; for(int i=0;i