Respected Members,
I want to calculate the length2 in the below code which is the difference between lastbardate and a paramdate.
I referred the function DateTimeDiff( arg1, arg2 ) but not able to understand the inputs of arg1 and arg2 any help is much appreciated.
_SECTION_BEGIN("Comparison");
comparativeTickerId = ParamStr( "Comparative Symbol", "Nifty 50");
length1 = Param( "Period", 310, 2, 200, 1 );
**length2 = Difference between Lastbardate and ParamDate("Date","01-01-2020",0);**
( 11-05-2021 - 01-01-2020)
Plot( 0, "Zero Line", colorRed, styleDashed );
//Current Symbol Gain-1
closeGain1 = C / Ref (C, -length1);
//Base Ticker Gain-1
SetForeign(comparativeTickerId);
baseGain1 = C / Ref (C, -length1);
RestorePriceArrays();
//Current Symbol Gain-2
closeGain2 = C / Ref (C, -length2);
//Base Ticker Gain-2
SetForeign(comparativeTickerId);
baseGain2 = C / Ref (C, -length2);
RestorePriceArrays();
//Line
res1 = closeGain1/baseGain1 -1;
res2 = closeGain2/baseGain2 -1;
Plot( res1, "Res1", IIf(res1>0,colorGreen,colorRed), styleLine | styleThick );
Plot( res2, "Res1", IIf(res2>0,colorGreen,colorRed), styleLine | styleThick );
GraphLabelDecimals = 2;
_SECTION_END();
Thank you