[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 644
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
The matter is that I'm not really good at MQL programming and my EA is based on the BASIC principles =) A variable is assigned to an open order. The terminal says that I have been re-logged and the value of this variable disappears when the order is opened. I think what should be done if the order is re-logged? If this happens, the terminal should check for the open positions and assign those values to the variables that have been assigned by the robot. And the Expert Advisor shows good readings in the test.
Depending on what you want to store (what information), different options can be used:
If you don't mind, here's an example. As far as I understand, the data will not be updated until the loop is executed?
Will only the same data be used during this endless cycle? Will the data be updated with the new tick or not?
The thing is that I'm not very good at MQL programming and my EA is based on Bacyca principles =) A variable is assigned to an open order. The terminal says that I have been re-logged and the value of this variable disappears when the order is opened. I wonder how to make it check for open positions if there is an overlog and assign those values to the variables that have been assigned by a robot.
Are you talking about magic number? Not enough information to help you... what's the variable and how it's assigned - that's where you need to start from.
But my Expert Advisor is showing good results in the test.
Will only the same data be used during this endless cycle? Will the data be updated with a new tick or not?
Will only the same data be used during this endless cycle? Will the data be updated with the new tick or not?
Please advise if there is a built-in function, that I can run some function, written by me, just at opening of each bar, not on each tick. It is not so difficult to write by hand, but when some code is executed by ticks and some by bars, the program gets very confusing) Thanks a lot)
so you just determine when a new bar opens and perform your function.
You can determine the appearance of a new bar by memorising the opening time of the bar and then comparing it with the current time of bar 0. If the new time is longer than the previous time, then we have a new bar.
sergeev thanks for the advice, it seems to work)
Ok, one more thing.
In my EA I have this branching:
if(period=="M15")
{
//check to open buy
Alert(buysell);
if(buysell=="buy")
Alert(1);
.............
}
Basically, nested if. BUT. condition if(period=="M15") is fulfilled and Alert gives a result, and buy, but condition if(buysell=="buy") is not fulfilled and Alert(1) command is not even started. hell, both conditions are even syntactically the same, but why one is fulfilled and the other is not?
so you just determine when a new bar opens and perform your function.
You can determine the appearance of a new bar by memorising the opening time of the bar and then comparing it with the current time of bar 0. If the new time is longer than the previous time, then you have a new bar.
I will describe it here: