here is the amibroker afl , buy and hold during greenbars no position during black bars and short in case of red bars , (using this technique )
_SECTION_BEGIN ("abhi market trend");
Plot(C, "", IIf(ADX(14)> MA(ADX(14),9) AND EMA(C,3)>EMA(C,13) , colorGreen, IIf(ADX(14)>MA(ADX(14),9)AND EMA(C,13)>EMA(C,3) ,colorRed, colorBlack)), ParamStyle("Price
Style",styleBAR,stylethick));
MYcolor = IIf(ADX(14)> MA(ADX(14),9)AND EMA(C,3)>EMA(C,13) , colorGreen, IIf(MA(ADX(14),9)>ADX(14)AND EMA(C,13)>EMA(C,3),colorRed, colorBlack));
PlotOHLC( Open, High, Low, Close, "", Mycolor, styleBar);
_SECTION_END();
:clap: