Bars is not a reliable way to detect new bar. It has been stated a zillion times on the forum, please do some search before posting.
Alain Verleyen:
Bars is not a reliable way to detect new bar. It has been stated a zillion times on the forum, please do some search before posting.
what is a better way...please advise
Bars is not a reliable way to detect new bar. It has been stated a zillion times on the forum, please do some search before posting.
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 and MetaTrader 4 -
MQL4 programming forum.) Always use time.
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
New candle - MQL4 and MetaTrader 4 - MQL4 programming forum
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
New candle - MQL4 and MetaTrader 4 - MQL4 programming forum
This code works in real time //+------------------------------------------------------------------+ //| t2018_21.mq5 | //| Copyright 2018, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2018, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" datetime New_Time=0; bool New_Bar=false; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- Fun_New_Bar(); if (New_Bar==false) return; } //+------------------------------------------------------------------+ void Fun_New_Bar() { New_Bar=false; datetime ThisBar = (datetime)SeriesInfoInteger(_Symbol,PERIOD_CURRENT,SERIES_LASTBAR_DATE); if (New_Time !=ThisBar) { New_Bar=true; Alert ("New bar"); New_Time = ThisBar; } }
Hi can anyone flash with the EA code, so before opening a trade he was waiting for a confirmation for opening an order and when the situation sent a push notification ...
farhat1986: can anyone flash with the EA code
- Don't hijack other threads with your off topic posts.
- Don't double post!
General rules and best pratices of the Forum. - General - MQL5 programming forum - farhat1986: i can anyone flash with the EA code,...d
?
- Search for it,
- learn to code it. If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
- Beg at Coding help - MQL4 and MetaTrader 4 - MQL4 programming forum or Need help with coding - General - MQL5 programming forum or Free MQL4 To MQL5 Converter - General - MQL5 programming forum or Requests & Ideas (MQL5 only!),
- or pay (Freelance) someone to code it.
No free help
urgent help.

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