I am creating a custom indicator and I have the "update on every tick" checked. I have many lines of code, but there is a certain portion of my code where I only want it process the very first tick of each bar. For example, process the first tick at the start of a 5 minute bar, but don't process the ticks thereafter. When the next 5 minute bar starts, only process its first tick too. and so on... I have tried the following code, but it doesn't seem to work perfectly. It will "leak" extra ticks into the if statement. Code: if time<>cb then begin do first thing do second thing do third thing end; cb=time; Does anyone know what's wrong or what I need to do?
thanks. i'm using 2000i. do you think the code below will work. i cannot test it until the market opens on Monday. the easylanguage help says barstatus is generally used with activitybar studies. Code: if barstatus(1)=0 then begin do first thing do second thing end; a more general programming question. if you keep passing values into an if statement, does the if statement block the next value until it has processed the first one? or does it let several of them through at once and process them together?
"but there is a certain portion of my code where I only want it process the very first tick of each bar" The first tick of any bar is a built-in variable called the Open, e.g., if (Open . . . ) then . . . AnyVariable = Open + xyz; etc.
how can i code this in easylanguage: if current tick=first tick of current bar then... i could not get barstatus to work because the open flag refers to the open for the next bar. does anyone know of a workaround?
If you are using a 1 minute chart you can plot a tick chart and use time<>time[1] you can construct your own minute bar from ticks.