Open Forex4you Account

Server รัน EA 1000 / ปี

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

Author Topic: เช็ค ค่า Profit  (Read 7361 times)

sherlockh

  • Newbie
  • *
  • Posts: 9
เช็ค ค่า Profit
« on: กันยายน 16, 2014, 12:44:51 pm »
เราจะเช็ค ค่า Profit รวมของออเดอร์ BUY ที่เปิดอยู่ หรือ Profit รวมของออเดอร์ SELL


จะทำได้ไหมครับ


ขอบคุรครับ ;)

admin

  • Administrator
  • Hero Member
  • *****
  • Posts: 2386
Re: เช็ค ค่า Profit
« Reply #1 on: กันยายน 16, 2014, 01:35:05 pm »
int start()
  {  double Pbuy,Psell;
     for(int i=0;i<OrdersTotal();i++)
     { int a=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
       if(OrderType()==OP_BUY)
        {
          Pbuy=Pbuy+OrderProfit();
        }
         if(OrderType()==OP_SELL)
        {
          Psell=Psell+OrderProfit();
        }
     
     }
     Print("Profit BUY : ",Pbuy);
      Print("Profit SELL : ",Psell);
     
   return (0);
  }

sherlockh

  • Newbie
  • *
  • Posts: 9
Re: เช็ค ค่า Profit
« Reply #2 on: กันยายน 16, 2014, 01:57:04 pm »
ขอบคุณมากๆครับท่านแอดมิน