I thought the start() executes every time a new bar is formed :( What could I write so that it's following the logic only after the bar? Every tick is when the price changes, right? And the bar is a bar for a certain time period, like M1, M5 and so on? Am I understanding it correctly?
I thought the start() executes every time a new bar is formed :( What could I write
so that it's following the logic only after the bar? Every tick is when the price
changes, right? And the bar is a bar for a certain time period, like M1, M5 and
so on? Am I understanding it correctly?
Time[0] is opening time of a new bar, you can set your logic around this code.
Here is a little "indicator" to illuminate those thoughts:
datetimeoldBarTime; // declared in global space so init and start can both see it
intinit(){oldBarTime = Time[0]; // get the time of the current bar on startup}
intdeinit(){return(0); // deinit code is run on exit
}
intstart(){staticinttickCount; // static variable is initialized only one time
tickCount++; // count executions of "start'
Comment("Tick # ", tickCount, " has arrived");
if(oldBarTime != Time[0]){
Alert("New Bar Has Arrived");
oldBarTime = Time[0]; // set oldBarTime to current bar time for future comparison
}
return(0);
}
Hi Phy, I'm trying to create an indicator which will showing an arrow simply when
D+ and D- from adx indicator crossing each other, but it's failed to do so. What's
wrong with it?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I thought the start() executes every time a new bar is formed :( What could I write so that it's following the logic only after the bar? Every tick is when the price changes, right? And the bar is a bar for a certain time period, like M1, M5 and so on? Am I understanding it correctly?
I thought the start() executes every time a new bar is formed :( What could I write so that it's following the logic only after the bar? Every tick is when the price changes, right? And the bar is a bar for a certain time period, like M1, M5 and so on? Am I understanding it correctly?
Start() is executed on every tick
Your code can determine when a new bar arrives
Here is a little "indicator" to illuminate those thoughts:
Thank you
ExtMapBuffer1[i]=Low[i]-nShift*Point;
ExtMapBuffer2[i]=High[i]+nShift*Point;
ExtMapBuffer1[i]=Low[i]-nShift*Point;
ExtMapBuffer2[i]=High[i]+nShift*Point;
Thank you