[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 177
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
I need it so that the EA can start calculating itself.
Help to understand:
The task is to count losing buy/sell orders individually. Code:
int w = OrdersHistoryTotal()-1;
if (OrderSelect(w, SELECT_BY_POS, MODE_HISTORY))
{
if (OrderProfit() < 0)
{
if (OrderType()==OP_BUY) i = i + 1;
if (OrderType()==OP_SELL) y = y + 1;
Print("i, y", i, " ", y);
Print("OrderProfit()", OrderProfit());
}
}
The code itself is a snippet from an EA. The Expert Advisor is running and consistently generating losses. There are a lot of losing orders (I print them elsewhere), all of which are logged. But in this code fragment, the Expert Advisor does not enter the
if (OrderProfit() < 0)
What am I doing wrong?
Do you have an EA that only opens positions? Each copy (version) should have its own magician and each will only monitor its own positions.
Got it. Thank you very much!
Help to understand:
The task is to count losing buy/sell orders individually. Code:
int w = OrdersHistoryTotal()-1;
if (OrderSelect(w, SELECT_BY_POS, MODE_HISTORY))
{
if (OrderProfit() < 0)
{
if (OrderType()==OP_BUY) i = i + 1;
if (OrderType()==OP_SELL) y = y + 1;
Print("i, y", i, " ", y);
Print("OrderProfit()", OrderProfit());
}
}
The code itself is a snippet from an EA. The EA is running and consistently generating losses. There are a bunch of losing orders (I print them elsewhere) all of which are logged. But in this code fragment, the Expert Advisor does not enter the
if (OrderProfit() < 0)
What am I doing wrong?
Try
I'm losing my mind, what's wrong with my mql4?
Why does the software perform the following condition on each cycle? It is written that the "i" should only be printed when a new order is closed!
w = OrdersHistoryTotal();
if (i!=w)
{
i = w;
Print ("i :", i);
}
I'm going crazy, what's wrong with my mql4?
Why does the program execute the following condition on each cycle? It is written to print "i" only when a new order is closed!
w = OrdersHistoryTotal();
if (i!=w)
{
i = w;
Print ("i :", i);
}
If i is not a static variable, it will be printed at every tick.
If i is not a static variable it will still print on every tick.
Ooh, I was wondering why I have several pieces in my program working through the ass! =)
So all working variables whose values I use in different ticks must be declared static?
Ooh, I was wondering why I've got a few pieces of software working through my butt! =)
So all the working variables whose values I use in different instants have to be declared static?
It's hard to say. Look at the properties of the variables, and then think about what to declare and how to do it.
The OrderModify() function doesn't allow comments to be changed. Is there any other way to do this?
The OrderModify() function doesn't allow comments to be changed. Is there any other way to do this?
Only from the terminal.