Hello,
am trying to do a customized version of the relative performance indicator in AFL to have values shown in analysis explore and normalize to a certain date instead of first visible bar.
this is my code
_SECTION_BEGIN("Relative Performance");
Filter = 1;
startdate = ParamDate( "Start date", "2017-4-02");
fv=ValueWhen(DateNum() == startdate, BarIndex(), n = 1);
fvb=LastValue( fv);
fc = C;
RelativePerformance = 0;
RelativePerformance = (100 * ( fc - fc[ fvb ] )/ fc[ fvb ]);
Plot( RelativePerformance,"C", colorLightOrange, styleLine);
AddColumn(RelativePerformance, "Relative Performance" );
PlotGrid( 0, colorYellow );
_N( Title = "{{NAME}} - Relative Performance [%]: {{VALUES}}" );
_SECTION_END();
However, the plot value of this indicator on a certain day is different from that printed at the explore window no matter how i try.
P.S am sure they both started same date, i explored results for a certain asset and saw values.
what did i miss ?