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.
Does anyone know what's wrong or what I need to do?
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?