Hello!
I have a script that I want to run immediately at start, and also when the bars finished - even the first one!
If I do this:
the code will run immediately, but won't run again at the end of the first bar.
My solution is this:
bool runStuff = false;
int runCounter = 0;
...
function run(){
if (is(LOOKBACK)){
runCounter++;
}
if (runCounter >= LookBack){
runStuff = true;
}
if (runStuff){
//...run the stuff
}
}
Is there a more elegant way for doing an immediate run and also a normal run? Maybe a flag for it, like
or something like this?
So runstuff would be just this:
if (!is(LOOKBACK) || (is(LASTLOOKBACK)){
//...run the stuff
}
Thank you!