How to calculate the number of points (pips) won the day?
Please...
sell order: open price-close price
buy order: close price-open price
SDC:
sell order: open price-close price
buy order: close price-open price
for the hole day u need to loop in the orderhistory, filter only closed trades from today, calculate the profit of each order
it's a good day so here you go (not tested) just fastly written here, but you should get a general idea.
i assumed that if one symbol is on subpip mode every symbol it is.
static datetime d1=0; datetime tmp=iTime(Symbol(),PERIOD_D1,0); double profit=0; if(d1!=tmp){ for(int i=0;i<OrdersHistoryTotal();i++){ OrderSelect(i,SELECT_BY_POS,MODE_HISTORY); if(OrderCloseTime()!=0 && OrderOpenTime()>=d1 && (OrderType()==OP_BUY || OrderType()==OP_SELL)){ if(OrderType()==OP_BUY){ profit+=(OrderClosePrice()-OrderOpenPrice())/MarketInfo(Symbol(),MODE_POINT); } if(OrderType()==OP_SELL){ profit+=(OrderOpenPrice()-OrderClosePrice())/MarketInfo(OrderSymbol(),MODE_POINT); } } } d1=tmp; } if(Digits==5||Digits=3){ profit=profit/10; } Alert(profit);
It worked. Thanks!
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register