The Bars function returns the number of bars. When we need to get the index of a bar with index 9 (sorry for the tautology), it will return 10, because the index of the first bar is 0.
Right, thanks. All in all, it's a good addition-notice. True, I do not really bother, I just know that it is the number of bars. And if the program needs an index, only then I subtract one.
Vasiliy Pushkaryov: Here are two variants of the iBarShift() analogue: post #5 and post #7
Simple variant:
Bars(NULL, 0, t, 32000000000)-1;
the shortest and fastest solution for iBarShift analog for current symbol and timeframe and requires no additional functions. However, for non-current ones too, you just need to fill in the first two parameters instead of null ones.
The Bars function returns the number of bars. When we need to get the index of a bar with index 9 (sorry for the tautology), it will return 10, because the index of the first bar is 0.
Here are two variants of the iBarShift() analogue: post #5 and post #7
Just a variant:
Only it won't work correctly in all cases. GetBarShift() from fxsaber is more versatile.
Try to put TimeCurrent() instead of t in your function, you'll see the result.
Only it won't work correctly in all cases. GetBarShift() by fxsaber is more universal.
Try putting TimeCurrent() instead of t in your function, you'll see the result.
The result will be the same.
You haven't even checked.
I've tested it many times before, so I just know. But you haven't even tried it yourself.
Here's the script.
It just hangs. Forcibly removing it from the chart gets the result.
So I tried it, that's why I advised you too. But since you used it and it suits you, I won't change your mind.
That's fine, too