[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 874
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 time of a new candle is Time[0].
and how do I further determine the arrival of a new candle?
and how do you further determine the arrival of a new candle?
memorise the previous one in a variable and compare.
I'm going to try it now...
and how to identify the arrival of a new candle?
There are several options, here are a couple of them:
1. when starting the Expert Advisor, remember the total number of bars on the chart and monitor the changes in the number of bars during the execution of the Expert Advisor:
2. remember the time of the last bar to open; the code is about the same,
use datetime last=Time[0];
and compare last==Time[0] --> if the last open time is the same as last time, if it is not equal, it means that we have a new bar
i don't know which scheme is more efficient 1 or 2 - i have doubts about the automatic downloading of history to the terminal, but i don't see any problems
There are several options, here are a couple of them:
1. when starting the Expert Advisor, remember the total number of bars on the chart and monitor the changes in the number of bars during the execution of the Expert Advisor:
it won't work. the number of bars is limited.
This works, because the total number does not matter, we are only interested in the moment when the number of bars on the chart has changed, at this moment the variable bar != counted, pay attention, I purposely remember int bar = Bars; - not to lose the value of Bars, and then compare and assign this value counted = bar; - and you could do everything with Bars without the extra variable - but I decided to double-check
I also mentioned that there may be a small kazutz during the history auto-pumping - may be it's good or may be it's bad, if we use bar open time, it will definitely work - bar open time will never change
only interested in the moment when the number of bars on the chart changed
After reaching the maximum value set in the settings, the number of bars on the chart should not increase. although it may jump, I haven't checked, then it may be possible to catch it, but this is already an undocumented option.
That was the question. I checked when the maximum is reached... Bars does not change, but stays equal to Max bars in the window (see properties).
that was the question. I have checked when the maximum is reached... Bars does not change, but remains equal to Max bars in the window (see properties).
Well, that's the way it should be. so the first option won't work.
Yes, the first option doesn't work, though I'm working on a non-standard timeframe, the second one does. Thank you all!