Open Forex4you Account

Server ѹ EA 1000 /

觪ͤ͡á MQL4

Author Topic: EA modify order  (Read 92 times)

Sittiphon

  • Newbie
  • *
  • Posts: 1
EA modify order
« on: Զع¹ 01, 2019, 08:36:04 am »
ʴդѺءҹ ʹջѭ EA Modify Order ѺѺ

ѭѹԴ÷Ѵ͡ѹ( //*****************************) ӧҹѺ
concept ͧ Դ order buy sell ѹ Order buy TP Order sell Modify Order Ѻ
ҡ Order buy TP ҡ Order sell Modify Order Ѻ ѹ͹ Error 4051 Ѻ ͹ "Ҿͧѧѹ١ͧ" ͼͧǡҨüԴѺ úǹءҹйӡ䢴¤Ѻ ͺسѺ

ͧ back test ҿԹ UC Ѻ (Ҿԧ ҹҧѺ)
1.ٻẺҿ
https://drive.google.com/open?id=18LYpIq-T0aqVVdOmMkUV0aO6oj3Kk6IE
2.setting ͹ backtest
https://drive.google.com/open?id=1W1u84GnP1KNZGITR_aBZ4aiv6wxQfC4X
3.Error ͹
https://drive.google.com/open?id=1NqDeMO1z6u3-kjAtJ0iRftd6fC8qIHex

int start()
{
   static double pbuy = MarketInfo(Symbol(),MODE_ASK);
   static double psell = MarketInfo(Symbol(),MODE_BID);
   
   if(OrdersTotal()==0)
   {
   int ticketb1 = OrderSend(Symbol(),OP_BUY,0.20,pbuy,3,pbuy-500*Point,pbuy+100*Point,"Ea", 1234,0,Green);
   int tickets1 = OrderSend(Symbol(),OP_SELL,0.20,psell,3,psell+500*Point,psell-100*Point,"Ea", 1234,0,Red);
       
   }
   
      int BuyOrder=0;
      int SellOrder=0;
     
       for(int i=0 ;i<OrdersTotal();i++)
      {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);   
         if(OrderType()==OP_BUY)
         BuyOrder++;
         if(OrderType()==OP_SELL)
         SellOrder++;
         
            if(BuyOrder == 0 && SellOrder == 1)
            {
   
               OrderModify(tickets1,psell,psell+500*Point,psell-300*Point,0,Red);    //*****************************
             
            }
      }
 
 
   
return(0);
}
« Last Edit: Զع¹ 10, 2019, 10:19:23 am by Sittiphon »