currentbar & barstatus  [SOLVED]

Questions about MultiCharts and user contributed studies.
kagein
Posts: 55
Joined: 12 Oct 2017
Has thanked: 16 times
Been thanked: 10 times

currentbar & barstatus

Postby kagein » 03 Nov 2017

When i set barstatus to 0, currentbar returns 0, if i set barstaus to 2, currentbar seems to work. What is the reason for this?

Code: Select all

vars: barnum(0);
if barstatus(1)=0 then
barnum = currentbar -1;

plot1(barnum);

User avatar
Anna MultiCharts
Posts: 560
Joined: 14 Jul 2017
Has thanked: 42 times
Been thanked: 140 times

Re: currentbar & barstatus  [SOLVED]

Postby Anna MultiCharts » 06 Nov 2017

Hello, kagein!

If you’re referring to backtesing then the calculations are carried out on the bar close (barstatus = 2) that is why you have the results.
Barstatus = 0 or 1 which represent bar open or inside status will not work in backtesting, only in realtime.


Return to “MultiCharts”