Check this code
When you run this on ohlc and uncomment the newbar function it returns different results? Can anyone explain what it skips on 1minute ohlc??
what do you mean fun it on OHLC, you surely just mean a chart?
define the problem, what do you mean by different results?
if you simply mean why does it not process all the code, that is because if it is not a new M1 bar it returns the function as written, but surely that is what you mean to do, so what is the problem?define the problem, what do you mean by different results...
if you simply mean why does it not process all the code, that is because if it is not a new M1 bar it returns the function but surely tha tis what you mean to do so what is the problem?What im trying to see whats the difference when you add this function in 1 minute ohlc. When i add this it checks for new bar and then run the code, so when i deactivate this i get a different result. So my question is, is ohlc 1minute the same as newbar??
What im trying to see whats the difference when you add this function in 1 minute ohlc. When i add this it checks for new bar and then run the code, so when i deactivate this i get a different result. So my question is, is ohlc 1minute the same as newbar??
no.... OHLC is short for Open, High, Low, Close
a new bar is when a new bar starts to be formed, in your case on the M1 timeframe.
when you comment it out, it will process the rest of the code every tick instead of once every bar
So you’re running it in the tester, why didn’t you say that in the first place!
Dont worry I did some reading and understand now and added this
Print("before new bar bid ",SymbolInfoDouble(Symbol(), SYMBOL_BID), " Open ", iOpen(_Symbol, TimePeriod, 0), " High ", iHigh(_Symbol, TimePeriod, 0), " Low ", iLow(_Symbol, TimePeriod, 0), " Close ", iClose(_Symbol, TimePeriod, 0)); if (!IsNewBar(_Symbol, PERIOD_M1))return; Print("after new bar bid ",SymbolInfoDouble(Symbol(), SYMBOL_BID), " Open ", iOpen(_Symbol, TimePeriod, 1), " High ", iHigh(_Symbol, TimePeriod, 1), " Low ", iLow(_Symbol, TimePeriod, 1), " Close ", iClose(_Symbol, TimePeriod, 1));

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check this code
When you run this on ohlc and uncomment the newbar function it returns different results? Can anyone explain what it skips on 1minute ohlc??