Hello all,

This sample code is from the manual, it works fine just as it is.

var HighsDn[10] = { 1,1,1,2,1,1,1,3,1,1 }; // mind the reverse order
var LowsUp[10] = { 1,1,1,0.7,1,1,1,0.5,1,1 };

function main()
{
printf("\nSlope dn %.3f",slope(PEAK,HighsDn,10));
printf("\nSlope up %.3f",slope(VALLEY,LowsUp,10));
plot("DPO", HighsDn[10], LINE, BLUE);
plot("DPOd", LowsUp[10], LINE, RED);
}


However, when I use slope function on price series instead of HighsDn or LowsUp I don't get any values.

Do you have a sample for using slope function with price series?

Such as below:


function run()
{
BarPeriod=5;
LookBack = 100;
StartDate = 20210103;
EndDate = 20210104;

var* Price = series(price());

vars MM2 = series(SMA(Price,20));

printf("\n+");

printf("\nPEAK %.3f",slope(PEAK,MM2,5));
printf("\nVALLEY %.3f",slope(VALLEY,MM2,5));
}

zorro image that is result of running my script is below:
https://prnt.sc/117scg1

Thank you.