- email alert need pls help
- Newbie needs help on Alert during CURRENT Bar coss
- RSI-Alert-Indicator: Need help from coders!
MM
start() { if (Volume[0]==1) // On first tick of current bar only { // Do stuff here to evaluate } return(0); }
Good Luck
-BB-
if (Volume[0]==1)
[...]
Being pedantic, it depends whether mixtermind wants to process signals only at the start of a bar, or only once per bar. The former is a specific subset of the latter. The check on Volume[0] will mean that the EA only places trades if it is running when a bar's first tick comes in (and is vulnerable to missing trades if MT4 misses ticks because it's busy, or the internet connection is slightly flaky). If the EA is e.g. running on an H1 chart, and it is started at e.g. 12:00:01 and there has already been a tick, then it won't place any trades before 13:00:00. This may or may not be desirable, depending on exactly what mixtermind is after.
If the requirement is for an EA which more broadly only examines signals once per bar, then the usual method recommended on this forum is something like the following:
// Store the start time of the most recent bar which has been examined, in a static variable which persists // across calls to start() - but ***not*** across reloads of the EA... static int MostRecentBarStart = 0; // See if this bar is new if (Time[0] > MostRecentBarStart) { // Store the time of the current bar, preventing further action during this bar MostRecentBarStart = Time[0]; ...process potential signals here }
> Being pedantic, it depends whether mixtermind wants to process signals only at the start of a bar
Indeed :)
Though the implication was 'once at start' as he is processing prior bar values :)
I take the good points re the vulnerability of 'first tick' but, as they say 'is simples' :)
-BB-
Thanks guys!!
Appreciate the help.
Ken
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use