+91-0000000000

}

Monday – Friday : 9:00 AM – 6:30 PM

Mann-Kendall-Trend-Detection

The Mann-Kendall-Trend-Detection AFL in Amibroker focuses on detecting trends using the Mann-Kendall statistical test. Leveraging amibroker data feed functionalities enables traders to analyze and identify trends in market data. This AFL assists traders in understanding the direction and significance of trends, facilitating informed decision-making processes.

/
_SECTION_BEGIN("Mann-Kendall");
SetChartBkColor(ParamColor("Background Color",ColorRGB(0,0,0)));
Length= Param( "Period", 21, 5, 200, 1 ); 
function Trend(Price,Length) {
 Price=C;
    Result = 0;
 
     
 
    for (k=Length;k= 0) {
            zScore=((S-1)/StdDev);
        }else {
            zScore=(S+1)/StdDev;
        }
 
        Result[k] = 0; //0- no trend, -1 - decreasing trend, 1 - increasing trend
 
        isTrend = False;
        if ((zScore>=1.65)||(zScore<=-1.65)) { 
            isTrend=True;
        }
 
        if (isTrend)    {       
            if (S<0){
                Result[k] = -1;
            }else {
                Result[k] = 1;
            }
        }
 
    }
 
    return Result;
}
Plot(C,"",colorBrightGreen,styleCandle);
Plot(Trend(C,Length),"",colorBlue,styleLine+styleThick|styleOwnScale);
Title =EncodeColor( colorWhite) + " Trend Detection   " + EncodeColor(36)+  Title = Name() + "     " + EncodeColor(36) + Date() ;

//Plot(1,"",colorRed,styleLine,styleThick);
//Plot(0,"",colorRed,styleDashed,styleThick);
//Plot(-1,"",colorRed,styleLine,styleThick);
_SECTION_END();

Open chat
1
Hi, how can I help you?