Donchian channel

Kindly provide me code for following situation
Signal when sma 5 crosses over donchian channel middle line.
Also provide algo for when sma 6 crossover of sma 9 happens above the donchian channel middle line.

1 Like

Sir pls reply, 3 days ago i asked

Check the below given amibroker AFL code for donchain channel

_SECTION_BEGIN(“Donchian Channel”);
// Plots a 20 period Donchian channel

pds=20;
DU =HHV(Ref(H,-1),pds);
DM = LLV(Ref(L,-1),pds);
DL = (DU+DM)/2;

Plot(DU,“DU”,colorBlue,styleLine);
Plot(Close,“close”,colorWhite,styleLine);
Plot(DM,“DM”,colorGreen,styleLine);
Plot(DL,“DL”,colorRed,styleLine);
_SECTION_END();

Plot (C, “Close”, IIf(Close > Open, colorGreen, colorRed), styleBar);

Buy = Cross (Ref (C, -1), Ref(DU,-1));
PlotShapes(shapeUpArrowBuy,colorGreen);
Sell = Cross (Ref (C, -1), Ref(DL, -1));
PlotShapes(shapeDownArrow
Sell,colorRed);
//for Long Entry AND Short Exit, set “Price” field to:
//HiLevel(@,20)[–1]
//for Short Entry AND Long Exit, set “Price” field to:
//LoLevel(@,20)[–1]