Open Forex4you Account

Server รัน EA 1000 / ปี

สั่งชื้อคู่มือการโปรแรกม MQL4

Author Topic: วิธีเขียนให้อีเอทำงานต่อจากเราครับ ไม้แรกเราเปิดเอง  (Read 7603 times)

akalak

  • Newbie
  • *
  • Posts: 12
ตามหัวข้อเลยครับ ไม้แรกเราเปิดเอง ที่เหลือให้อีเอมาติงเกลเองหรือเป็นกริดต่อ

void OnTick(){
CheckedExpired();             
     
           if(CountOrder(OP_BUYLIMIT) == 0)
         if(CountOrder(OP_BUY)>0)OpenBuyLimit();
      if(CountOrder(OP_SELLLIMIT) == 0)
         if(CountOrder(OP_SELL)> 0)OpenSellLimit();   
         
      // ------- Modify TP step 3
      ModityTP(OP_BUY);
      ModityTP(OP_SELL);   
     
      // ------- Delete Pending step 4
      if(CountOrder(OP_SELLLIMIT) == 1 && CountOrder(OP_SELL) == 0)DeletePending(OP_SELLLIMIT);
      if(CountOrder(OP_BUYLIMIT) == 1 && CountOrder(OP_BUY) == 0)DeletePending(OP_BUYLIMIT);
         
     
      //TriailingStop();   
   
} // end main

//+------------------------------------------------------------------+

ผมเขียนแบบนี้มันไม่ทำงานต่อครับ
หรือต้องใช้ int Start(){}

tanakrit99

  • Newbie
  • *
  • Posts: 23
ตัวอย่าง

ให้นับไม้ก่อนว่าได้เท่าไหร่ ที่นี้เงื่อนไขด้านล่างบอกว่า ถ้ามันมากกว่า 0 มันก็จะเริ่มทำงานต่อไป 

 if(Cntbuy>0)
     {
         if(Ask<Lastbuy-(step*Point))
           {
            Lotbuy=Lastlotbuy*gain;
            Ticket=OrderSend(Symbol(),OP_BUY,Lotbuy,Ask,3,0,0,"",0,0,Green);
           }
     }
   if(Cntsell>0)
     {
         if(Bid>Lastsell+(step*Point))
           {
            Lotsell=Lastlotsell*gain;
            Ticket=OrderSend(Symbol(),OP_SELL,Lotsell,Bid,3,0,0,"",0,0,Red);
           }
     }

D_Diamond

  • Hero Member
  • *****
  • Posts: 673
    • Expert Forex Trading
ถ้าเขียนแค่นั้นมันก็ไม่ทำงานอยู่แล้วครับ   ไม่มีโค้ดนับออเดอร์  ไม่มีโค้ดเปิดออเดอร์

หรือถ้าคุณเขียนแล้วแต่ไม่เอามาให้ดู  ก็ไม่รู้ว่ามันผิดตรงไหน