How to Filter for Slope of Alpha on a daily time frame & Divergence?

Hi - I want to run an exploration to filter for stocks where there is rising Alpha in past X days. My understanding is that is the linear reg slope is positive then there is a rising trend.

But when I run exploration I am getting all tickers as Negative values in linear reg of Alpha.


So Am not able to identify stocks where there is rising slope of Alpha in past X days.

How Can I fix it please?

Appreciate any help please.

//Alpha, Beta, R2 Formula
Ticker = ParamStr("MKT Ticker", "ASIANPAINT"); 
MKT = Foreign(Ticker,"C",1);
AP=Param("Alpha Period",200,100,300,5);
//AP=Optimize("Alpha Period",200,100,300,5);
Beta=((AP * Sum(ROC( C,1) * ROC(MKT,1),AP)) - (Sum(ROC(C,1),AP) * Sum(ROC( MKT,1),AP)))
    / ((AP * Sum((ROC(MKT,1)^2 ),AP)) - (Sum(ROC(MKT,1 ),AP)^2 ));
    Alpha=AP*(Sum(ROC( C,1) ,AP) - (Beta) * Sum( ROC(MKT,1),AP )) / AP;
    //Chart Settings
    dynamic_color = IIf( ALPHA > 0, colorDarkGreen, colorDarkRed );
    Plot(Alpha, "Alpha", dynamic_color,    styleHistogram | styleThick );
    Lslope = LinRegSlope(Alpha,30) > 0;
    Filter = Lslope ;
    AddColumn( Lslope , "Lslope " );

1 Like

@Ankur, you have defined Lslope as a LOGICAL value, not a "value".

Try the change indicated below.

    Lslope = LinRegSlope(Alpha,30);
    Filter = Lslope > 0;
    AddColumn( Lslope , "Lslope " );

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.