BarsSinceExit always reports 0  [SOLVED]

Questions about MultiCharts and user contributed studies.
Luto
Posts: 9
Joined: 18 May 2022
Has thanked: 3 times

BarsSinceExit always reports 0

Postby Luto » 25 Jun 2022

Any Help is appreciated.

I can't seem to get BarsSinceExit to return any value besides 0
The backtester report show 6 trades in my test chart .
It seems that the last bar of the day would report a value besides 0. In fact, BarsSinceExit never shows a value besides 0 on all bars of the test day.

Does it only work when there is a live feed or autotrade'ing?

Thank You in Advance

Code: Select all

If Open < Close and range > 5 then Buy next bar Market; setprofittarget_pt (5); Print (timetoString (datetime), " BarsSinceExit", value1, " ", Value2, " ", Value3, " ", Value4); If marketposition = 0 then begin value1 = barssinceexit(0); value2 = barssinceexit_checked(0); end;

User avatar
Kate MultiCharts
Posts: 575
Joined: 21 Oct 2020
Has thanked: 7 times
Been thanked: 144 times

Re: BarsSinceExit always reports 0  [SOLVED]

Postby Kate MultiCharts » 06 Jul 2022

Hello Luto,

barssinceexit(0) is an open position, it’ll return 0. Please try using 1,2,3,etc.
Some more info here.


Return to “MultiCharts”