How to get Manual Drawed Vertical Line Date in AFL

Hi everybody, help please:
I need to know a Drawed Vertical Line Date with no 'Selected Value' or 'Begin Value' help. Need to get a univocal value for every chart.

I tried this, plotted on a panel already filled with price:

VerticalLine = Study("OB", GetChartID() );

StartX = LastValue( ValueWhen( ExRem( VerticalLine, 0 ), DateTime() ) );
EndX = LastValue( ValueWhen( VerticalLine, DateTime() ) );
//StartY = LastValue( ValueWhen( ExRem( VerticalLine, 0 ), VerticalLine ) );
//EndY = LastValue( ValueWhen( VerticalLine, VerticalLine ) );

if( StartX == 0 )
  Title = "No Vertical Line drawn - please draw it and use 'OB' as study ID";
else
  Title = "Vertical Line at Date (EndX) = " + WriteVal( EndX, formatDateTime );

It gives me back the day before the Vertical Line. It's not possibile just to sum '1' to date cause holidays, please, can you help me?

SOLVED

Changed row 'EndX = ...'

VerticalLine = Study("OB", GetChartID() );

StartX = LastValue( ValueWhen( ExRem( VerticalLine, 0 ), DateTime() ) );
EndX = (ValueWhen(IsNull(VerticalLine), DateTime()));
//StartY = LastValue( ValueWhen( ExRem( VerticalLine, 0 ), VerticalLine ) );
//EndY = LastValue( ValueWhen( VerticalLine, VerticalLine ) );

if( StartX == 0 )
  Title = "No Vertical Line drawn - please draw it and use 'OB' as study ID";
else
  Title = "Vertical Line at Date (EndX) = " + WriteVal( EndX, formatDateTime );

Thanks.

1 Like