Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 192
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
Thanks for the answer, but I've only just started learning for a couple of weeks, how to implement this in code, or tell me where to read please. Or according to Igor Kim?
And yet it will open a position, not according to the system, when just starting its work, your condition does not avoid this problem.
And if you think about it? Why doesn't it avoid the problem?
When he starts work, and if he has not worked before (in general the first run), then there has not been his position yet, and logic will show that the last closed position simply does not exist yet. This means that it could not have been closed at either stop or take, which in turn gives permission to open a position on the signal.
Isn't it?
And if you think about it? Why doesn't it avoid the problem?
When it starts working, and if it has not worked before (first run at all), there has not yet been a position, and logic will show that the last closed position simply does not exist yet. This means that it could not have been closed at either stop or take, which in turn gives permission to open a position on the signal.
Isn't it?
That is the thing: by a signal! But the condition may be met not on bar 2 (as soon as the indicator has changed the buffer) but on any second bar (after that everything works through the system of course). The problem is in the condition to open orders, how should we fix it only on the 2nd bar after the change of the indicator buffer?
void OnTick()
}
Well, the point is that it is based on the signal! But the condition may satisfy not on the 2nd bar (as soon as the indicator has changed the buffer) but on any second bar (after that everything works with the system of course). The problem is in the condition to open orders, how to fix it but on the 2nd bar after the change of the indicator buffer?
void OnTick()
}
That's the point! But the condition may be met not on bar 2 (as soon as the indicator has changed the buffer), but on any second bar (after that everything works with the system of course). The problem is in the condition to open orders, how to fix it but on the 2nd bar after the change of the indicator buffer?
1. this is what the code would look like if inserted correctly. There's a reason the developers came up with this...
2. a subtle hint: where are Open[4] and Close[4] relative to the indicator values?
If we insert your condition " This means that it could not be closed at either stop or take, which in turn gives permission to open a position on the signal. "
And my signal is"if(CountSell() == 0 && Bid < dntr && Open[3] < dntr && Close[3] < dntr)" (together with the shift in the indicator n=3),
It turns out that if it is placed immediately on the chart, it will open on a downtrend, from the moment of start on the 3rd candle, and then, if there is a signal, it will open as needed.
If we insert your condition " This means that it could not be closed at either stop or take, which in turn gives permission to open a position on the signal. "
And my signal is"if(CountSell() == 0 && Bid < dntr && Open[3] < dntr && Close[3] < dntr)" (together with the shift in the indicator n=3),
It turns out that if it is placed immediately on the chart it opens on a downtrend at the moment of start on the 3rd candle, and then, if there is a signal, it opens as required.
I do not understand anything. What do you have that you do not understand? You cannot determine that the last position was closed at stop or take? You cannot find a place in your code where to check this condition?
Or what can't you do?
How can it open on the third candle? Or explain what "it will open on the third candle" means? What does that even mean?each time an order opens on some indicator signal, how do I store the type of this signal in a variable?
There is a bug (when I run the EA), the order does not open at the start of a trend (not according to a change in the colour of the indicator), because my condition does not refer to specific candles, but says if the trend is up or down opens at the start of 3 candles
Good afternoon to all.
I am wondering how to analyse work statistics in EXCEl
Who can tell me what can be pulled through DDE from mt4 and where can I get all permissible functions for transferring to excel
Will be very grateful for help
Good afternoon to all.
I am wondering how to analyse work statistics in EXCEl
Who can tell me what can be pulled through DDE from mt4 and where can I get all permissible functions for transferring to excel
Will be very grateful for help