I am trying to develop a system where you take a buy above the PivotHighVSBar.
However everytime I try to add it to the chart I get an error - "Trying access at data to future. Bars reference value: -1."
The code I am using is
Code: Select all
inputs: Price( High ), LeftStrength( 3 ), RightStrength( 3 ) ;
value1 = PivotHighVSBar( 1, Price, LeftStrength, RightStrength, RightStrength + 1 );
value2 = High[value1];
condition1 = PivotHighVSBar( 1, Price, LeftStrength, RightStrength, RightStrength + 1 ) <> -1 ;
if condition1 then
if XAverage(Close, 30) > XAverage(Close, 50) AND XAverage(Close, 50) > XAverage(Close, 100) then
if Close > value2 then buy next bar at market;
Thanks