EA Programing => ปัญหาที่พบในการเขียน EA => Topic started by: sherlockh on กันยายน 16, 2014, 12:44:51 pm

Title: เช็ค ค่า Profit
Post by: sherlockh on กันยายน 16, 2014, 12:44:51 pm
เราจะเช็ค ค่า Profit รวมของออเดอร์ BUY ที่เปิดอยู่ หรือ Profit รวมของออเดอร์ SELL


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


ขอบคุรครับ ;)
Title: Re: เช็ค ค่า Profit
Post by: admin 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);
  }
Title: Re: เช็ค ค่า Profit
Post by: sherlockh on กันยายน 16, 2014, 01:57:04 pm
ขอบคุณมากๆครับท่านแอดมิน