I've already thought of this, but this is not a good solution. When I want to show a session (with rectangle) and MetaTrader colored me the previous bar (not in my favorite session), that's not so good.
I've already thought of this, but this is not a good solution. When I want to show a session (with rectangle) and MetaTrader colored me the previous bar (not in my favorite session), that's not so good.
Is this rectangle placed on the chart by you or by code?
Is this rectangle placed on the chart by you or by code?
The problem is with both methods!
If you are placing the object on the chart yourself, why are you trying to place it with the time co-ordinate of a bar that you know will not exist?
There is no 22:00 on a Sunday with your broker.
If it is being placed by code, then modify the code so that this doesn't happen.
There is no 22:00 on a Sunday with your broker.
If it is being placed by code, then modify the code so that this doesn't happen.
How can I use the next bar? I try to check the bar Sunday 22:00, but if the bar doesn't exist, then use the next bar right side (22:15), but what if, when the next bar also not exist?
How can I use the next bar? I try to check the bar Sunday 22:00, but if the bar doesn't exist, then use the next bar right side (22:15), but what if, when the next bar also not exist?
How can I use the next bar? I try to check the bar Sunday 22:00, but if the bar doesn't exist, then use the next bar right side (22:15), but what if, when the next bar also not exist?
You use iBarShift with exact =true to try to find the 22:00 candle
If the candle doen't exist, then iBarShift exact will return -1
If that is the case use iBarShift again without the exact setting and it will return the shift of the candle prior to 22:00
This shift, minus 1 will give you the shift of the first candle after 22:00
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
if I draw a rectangle from Sunday (e.g. 09th March) to Monday, the rectangle is drawn already on Fridays last bar.
Its a bug?
Maybe its a problem with no quotes on Sunday with some demo-accounts?
Regards
Burkhard