Hello,
The following code is the trade system of Donchian Channel which I would like to know any logic error in this code.
Buy signal = the highest price breaks the highest high price of 20 days
Buy Price = buy at that highest high price of 20 days
Short signal = the lowest price breaks the lowest low price of 20 days
Short Price = Short at that lowest low price of 20 days
SetTradeDelays(0, 0, 0, 0);
DonchianUpper =HHV(Ref(H,-1),20);
DonchianLower = LLV(Ref(L,-1),20);
DonchianMiddle = (DonchianUpper+DonchianLower)/2;
Buy = H > DonchianUpper;
Short = L < DonchianLower;
Sell = 0;
Cover = 0;
BuyPrice = HHV(Ref(H,-1),20);
ShortPrice = LLV(Ref(L,-1),20);
ApplyStop (stopTypeProfit, stopModePercent, 3);
ApplyStop (stopTypeLoss, stopModePercent, 5);
Plot(DonchianUpper,"DU",colorBlue,styleLine);
Plot(DonchianMiddle,"DM",colorGreen,styleLine);
Plot(DonchianLower,"DL",colorRed,styleLine);
Thank you!!!
The following code is the trade system of Donchian Channel which I would like to know any logic error in this code.
Buy signal = the highest price breaks the highest high price of 20 days
Buy Price = buy at that highest high price of 20 days
Short signal = the lowest price breaks the lowest low price of 20 days
Short Price = Short at that lowest low price of 20 days
SetTradeDelays(0, 0, 0, 0);
DonchianUpper =HHV(Ref(H,-1),20);
DonchianLower = LLV(Ref(L,-1),20);
DonchianMiddle = (DonchianUpper+DonchianLower)/2;
Buy = H > DonchianUpper;
Short = L < DonchianLower;
Sell = 0;
Cover = 0;
BuyPrice = HHV(Ref(H,-1),20);
ShortPrice = LLV(Ref(L,-1),20);
ApplyStop (stopTypeProfit, stopModePercent, 3);
ApplyStop (stopTypeLoss, stopModePercent, 5);
Plot(DonchianUpper,"DU",colorBlue,styleLine);
Plot(DonchianMiddle,"DM",colorGreen,styleLine);
Plot(DonchianLower,"DL",colorRed,styleLine);
Thank you!!!