Can you give me a hint? There is a button "MQL4.community" in the terminal and clicking on it opens Word with the corresponding page, but when I try to click on any link, a window pops up saying that there is a restriction on my computer! ???
void start()
{
double tickvalue = MarketInfo(Symbol(), MODE_TICKVALUE);
double profitbuy, profitsell;
for(int i = OrdersTotal()-1; i >= 0;i--)
{
if(!OrderSelect(i,SELECT_BY_POS)) continue;
if(OrderSymbol()!=Symbol() || OrderType() >= 2) continue;
if(OrderType() == 0)
profitbuy +=((Bid - OrderOpenPrice())/Point*tickvalue*OrderLots())+OrderCommission()+OrderSwap();
if(OrderType() == 1)
profitsell+=((OrderOpenPrice() - Ask)/Point*tickvalue*OrderLots())+OrderCommission()+OrderSwap();
}
Comment(profitbuy+profitsell);
}
В чем прикол, не могу правильно рассчитать суммарный профит для всех ордеров по одной паре, в терминале пишет одно, а у меня получается другое?
Итак, мои домыслы, своп в терминале нужно нормализовать обязательно, там точность больше двух бывает - это проверил, но как нормализовать - для каждого ордера или суммарно? Непонятно в общем...
Я уже всяко перепробовал, минимальная разница доходила до 0.02 центов, но это все равно не то, что нужно.
Вопрос, как мне мой код подогнать под работу функции - AccountProfit()?
I see what you mean, am I counting wrong? I will explain: I have trades opened only on one pair, I run this script on this pair and it outputs a different result than the one returned by the account profit function. The solution proposed by you does not suit me, because instead of asc and bid I will put the new data, is that clear?
How do you deal with it? Thank you.
See https://www.mql5.com/ru/code/10653
Ah see what you mean, am I counting wrong?
No, I meant
Вопрос, как мне мой код подогнать под работу функции - AccountProfit()?It seems to be well explained there.
And try normalizing the expression (OrderOpenPrice() - Ask)/Point to an integer.
No, I meant
It seems to be well explained there.
And try normalizing the expression (OrderOpenPrice() - Ask)/Point to an integer
What's not working out? Where is the discrepancy?
Or is it my alert that's frozen and yours that's not?
And you, did it add up?What's not working? Where is the discrepancy?
I switched the ask and bid, and now it's like this:
That's better :)))