
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
During testing of Expert Advisors:
Exp_TEMA.mq5, from the article: "Creation of an Expert Advisor that trades on different symbols". , expression Told[] Tnew[1]gets the following values:
Told[] Expression could not be evaluated
Tnew[1] Invalid array range.
And My_First_EA.mq5, from the article: "A Step-by-Step Guide to Writing MQL5 Expert Advisors for Beginners", the expression
New_Time[1] gets the value:Invalid array range
What do the values Expression could not be evaluated,Invalid array range, and how do they affect the experts' results?
Told - empty array with no size
Tnew[1] - out of array, the array is described as Tnew[1], so its elements can only be accessed as Tnew[0], because the index starts at zero.
Told - empty array with no size
Tnew[1] - out of array, the array is described as Tnew[1], so its elements can only be accessed as Tnew[0], because the index starts at zero.
Please tell me how to open only one trade per condition. With my code, the terminal opens several deals on this condition, but I need only one.
The result is the following picture:
How do I check if a deal has been done with this condition or not? I tried it this way, but it doesn't work:
Please tell me how to open only one trade per condition. With my code, the terminal opens several deals on this condition, but I need only one.
The result is the following picture:
How do I check if a deal has been done with this condition or not? I tried it this way, but it doesn't work:
And why arranging search in the loop if there is such a wonderful thing as PositionSelect?
We just check existence of position on the interesting symbol and if it is true, we go to drink cognac and smoke cigars... :)
PS
As I understand it PositionGetString withoutPositionSelect should not work. We don't need to know the symbols of all open poses, right?
There is no need to search in the loop when there is such a wonderful thing as PositionSelect?
Simply check presence of a position on the tool we are interested in and if it comes back true we go quietly to drink cognac and smoke cigars... :)
PS
As I understand it PositionGetString withoutPositionSelect should not work. We don't need to know the symbols of all open poses, right?
This code takes into account the presence of an open position:
But it continues to open positions when the Buy_Signal condition is met. What I want is that before Sell_Signal occurs a position at Buy_Signal will not open again. I'm trying to implement it this way:
It's not going.Such code takes into account the presence of an open position:
But it continues to open positions when Buy_Signal condition is met. I need to make sure that before Sell_Signal condition occurs no more positions will be opened by Buy_Signal. I am trying to implement it this way:
It does not.Why this code? It hardly looks like what I meant (I doubt that everything is correct there).
And I meant something like this:
At the very least it could be done in a block
Why this particular code? It's not even remotely similar to what I meant (I don't think it's right at all).
And I meant something like this:
At the very least everything can be done in a block.
This and above code does not open a position until it is closed, but opens anew after closing on the next bar if the condition is fulfilled. I have implemented it this way:
Thank you! I have taken all your wishes into account and everything is now working. I have posted the Expert Advisor for publication. I can make some more changes in the code. There is no limit to the seduction)))