Just like with non-history, only in the OrderSelect(int index, int select, int pool=MODE_TRADES) functionput MOD E_HISTORY instead of MODE_TRADES and use OrdersTotal() instead of OrdersHistoryTotal().
Variables declared in the Expert Advisor have zero value. Suppose that the Expert Advisor has been working for a week, the variables have changed their value, and now I need to make changes in its code. I make changes, recompile, start trading. My question is: What values will be set for global variables? Are they zero, or are they the same as they were before the compilation?
exactly the same as for non-history, only in function OrderSelect(int index, int select, int pool=MODE_TRADES)you put MODE_HISTORY instead ofMODE_TRADES
yes that's how this point is well known to me...
Please write a piece with last week's ticket request from history...and I'll use it to catch the logic...
Variables declared in the Expert Advisor have zero value. Suppose that the Expert Advisor has been working for a week, the variables have changed their value, and now I need to make changes in its code. I make changes, recompile, start trading. My question is: What values will be set for global variables? Are they zero, or are they the same as they were before the compilation?
If you use functions - those that were before compilation. To change their value, go to the service tab in the terminal.there in the global variables tab and manually change the values of the variables to what you need (0)
Another question. In which folder are the values of global variables stored? If I, for example, move the terminal to another computer, then in order not to copy the whole thing every time, I will need to reset the file with global variables so that the other terminal picks up their values.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
r772ra
Yes! The compiler passed without any errors.
Respect!
can you teach me how to refer to history?
is this how to get the last ticket out of there?
Just like with non-history, only in the OrderSelect(int index, int select, int pool=MODE_TRADES) function put MOD E_HISTORY instead of MODE_TRADES and use OrdersTotal() instead of OrdersHistoryTotal().
Another theoretical question.
Variables declared in the Expert Advisor have zero value. Suppose that the Expert Advisor has been working for a week, the variables have changed their value, and now I need to make changes in its code. I make changes, recompile, start trading. My question is: What values will be set for global variables? Are they zero, or are they the same as they were before the compilation?
is there a MODULAR concept in the code ? so that -2 and 2 equals 2 ?
Yes, but not in the code, but in the mathematical functions,
double MathAbs( double value)
The function returns the absolute value (modulo value) of the number passed to it
Parameters:
value - Numeric value.
exactly the same as for non-history, only in function OrderSelect(int index, int select, int pool=MODE_TRADES)you put MODE_HISTORY instead ofMODE_TRADES
yes that's how this point is well known to me...
Please write a piece with last week's ticket request from history...and I'll use it to catch the logic...
Another theoretical question.
Variables declared in the Expert Advisor have zero value. Suppose that the Expert Advisor has been working for a week, the variables have changed their value, and now I need to make changes in its code. I make changes, recompile, start trading. My question is: What values will be set for global variables? Are they zero, or are they the same as they were before the compilation?
If you use functions - those that were before compilation. To change their value, go to the service tab in the terminal.there in the global variables tab and manually change the values of the variables to what you need (0)
rigonich
Great! Finally got what I needed!
Thanks to all, even Taras! )))
MISTIC!!!
this one
-----------------------------------------------------------------------------
pp_sell=(-(PriceOpenLastClosePos()-PriceCloseLastPos())*100000); // for currencies with EUR dimension
Print (pp_sell);
------------------------------------------------------------------------------------
Prints -10, as it should be, since the last SELL trade has a profit of 10
but if you insert several DIFFICULT TIMES BETWEEN PRINT AND VARIABLE, e.g.
----------------------------------------------------------------------------
pp_sell=(-(PriceOpenLastClosePos()-PriceCloseLastPos())*100000); // for currencies with EUR dimension
if ( Hour()>=10 && Hour()<20)
{
if ( Stoch_1>Stoch_2) return(0);
else {
if(OrdersTotal()==0)
{ PlaySound("ok.wav");
if ( GetTypeLastClosePos()==1) Print (pp_sell);
}
Print("___");
}
}
return(0);
}
------------------------------------------------------------------------------------
it works, but prints -9 !!!!
what's the secret?