- close and open metatrader
- Coding help
- Average through range
if (IsNewBarOnTimeframe(PERIOD_M1)==true)Print("New bar Period M1 found"); if (IsNewBarOnTimeframe(PERIOD_M5)==true)Print("New bar Period M5 found"); if (IsNewBarOnTimeframe(PERIOD_M15)==true)Print("New bar Period M15 found"); if (IsNewBarOnTimeframe(PERIOD_M30)==true)Print("New bar Period M30 found"); if (IsNewBarOnTimeframe(PERIOD_H1)==true)Print("New bar Period H1 found"); if (IsNewBarOnTimeframe(PERIOD_H4)==true)Print("New bar Period H4 found"); if (IsNewBarOnTimeframe(PERIOD_D1)==true)Print("New bar Period D1 found"); if (IsNewBarOnTimeframe(PERIOD_W1)==true)Print("New bar Period W1 found"); if (IsNewBarOnTimeframe(PERIOD_MN1)==true)Print("New bar Period MN found");
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
New candle - MQL4 programming forum #3 2014.04.04
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum 2011.05.06
Your code will never work.
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
New candle - MQL4 programming forum #3 2014.04.04
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum 2011.05.06
Your code will never work.
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
New candle - MQL4 programming forum #3 2014.04.04
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum 2011.05.06
Your code will never work.
Don't be an enemy of progress by using such pessimistic words. My code will work.
Don't be an enemy of progress by using such pessimistic words. My code will work.
Your code will not work.
You even say so yourself.
Hi guys and complements. The following is a code is designed to show true if a new candle is seen for the given time frame (Not necessarily the current timeframe) . However it does not branch to the 'true' section, only to all the 'false' sections. What could be wrong with the code pls. Thanks in advance.
Your code is so strange that I cannot work out what you are trying to do.
Maybe you should consider storing all the last bar times in an array.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use