Hello, i try to get out the pips of the closed trades, i had the idea, to count the difference between order openprice and orderclose preise
can someone tell me, why this isnt working?
amando
void OnTick() { double Profit_Buy; double Profit_Sell; double Profit; // retrieving info from trade history for(i=0;i<OrdersHistoryTotal();i++) { Select = OrderSelect(i,SELECT_BY_POS,MODE_HISTORY); if(OrderSymbol() ==_Symbol) { Profit = Profit + OrderOpenPrice()-OrderClosePrice(); if (OrderType() == OP_BUY ) Profit ++; if (OrderType() == OP_SELL) Profit ++; } } Print(Profit); }
Thats all? Shame on my head,
in this case, then this must also work right?
void OnTick() { double Profit_Buy; double Profit_Sell; double Profit; // retrieving info from trade history for(i=0;i<OrdersHistoryTotal();i++) { Select = OrderSelect(i,SELECT_BY_POS,MODE_HISTORY); if(OrderSymbol() ==_Symbol) { //Profit = Profit + OrderOpenPrice()-OrderClosePrice(); if (OrderType() == OP_BUY ) Profit_Buy = Profit_Buy + OrderClosePrice()-OrderOpenPrice(); if (OrderType() == OP_SELL) Profit_Sell = Profit_Sell + OrderOpenPrice() - OrderClosePrice(); } } Print(Profit_Buy); Print(Profit_Sell); }
- reviews: 17
- www.mql5.com
Thanks for help, both is working,
i have another question to this, how i insert de actual day? means to collect the pips from today (servertime)
Thanks for help, both is working,
i have another question to this, how i insert de actual day? means to collect the pips from today (servertime)
for(i=OrdersHistoryTotal();i>=0;i--)
{
if(OrderCloseTime()<iTime(Symbol(),PERIOD_D1,0)) break;
no, i tryed this and get no result
void OnTick() { double Profit_Buy; double Profit_Sell; // retrieving info from trade history for(i=OrdersHistoryTotal();i>=0;i--) { if(OrderCloseTime()<iTime(Symbol(),PERIOD_D1,0)) break; Select = OrderSelect(i,SELECT_BY_POS,MODE_HISTORY); if(OrderSymbol() ==_Symbol ) { if (OrderType() == OP_BUY ) Profit_Buy = Profit_Buy + OrderClosePrice()-OrderOpenPrice(); if (OrderType() == OP_SELL) Profit_Sell = Profit_Sell + OrderOpenPrice() - OrderClosePrice(); } } Print(Profit_Buy); Print(Profit_Sell); }
no, i tryed this and get no result
switch(TimeDayOfWeek(TimeCurrent())) { case 0:// Sunday break; case 1:// Monday break; case 2:// Tuesday break; case 3:// Wednesday break; case 4:// Thursday break; case 5:// Friday break; case 6:// Saturday break; }
Please be clear about what you want to do.
Pips from each order? pips from all orders? pips from buy orders today? pips from sell orders today? pips from buy and sell orders today? pips from order or orders yesterday?
Be specific.
no, i tryed this and get no result
its just 0
Profit_buy = 0
Profit_Sell = 0
its just 0
Profit_buy = 0
Profit_Sell = 0
:))))
Select = OrderSelect(i,SELECT_BY_POS,MODE_HISTORY); if(OrderSymbol() ==_Symbol ) {
if(OrderCloseTime()<iTime(Symbol(),PERIOD_D1,0)) break;
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, i try to get out the pips of the closed trades, i had the idea, to count the difference between order openprice and orderclose preise
can someone tell me, why this isnt working?
amando