Reply To: รบกวนขอสูตร Hi – Lo 5 สำหรับ Metastock และ Amibroker ครับ

#16880
dreamscat
Keymaster
  1. สูตรสำหรับ Metastock ครับ

{CDC Hi-Lo 5 V.20150502}
Prd:=5;
Upper:=Ref(HHV(H,Prd),-1);
Lower:=Ref(LLV(L,Prd),-1);
Buy:=Cross(H,Upper);
Sell:=Cross(Lower,L);
Bullish:=BarsSince(Buy)<BarsSince(Sell);
Bearish:=BarsSince(Sell)<BarsSince(Buy);
BuyPrice:=ValueWhen(1,Bullish AND Ref(Bearish,-1),Upper);
ProfitLong:=((C-BuyPrice)/BuyPrice);
SellPrice:=ValueWhen(1,Bearish AND Ref(Bullish,-1),Lower);
ProfitShort:=((SellPrice-C)/SellPrice);
BuyPrice; SellPrice;

 

2. สูตรสำหรับ Amibroker ครับ

//CDC Hi-Lo 5 V.20150502
Prd=5;
Upper=Ref(HHV(H,Prd),-1);
Lower=Ref(LLV(L,Prd),-1);
Buy=Cross(H,Upper);
Sell=Cross(Lower,L);
Bullish=BarsSince(Buy)<BarsSince(Sell);
Bearish=BarsSince(Sell)<BarsSince(Buy);
Buy1=Buy AND Ref(bearish,-1);
Sell1=Sell AND Ref(bullish,-1);
Plot(upper,”Upper”,colorGreen,styleDashed);
Plot(lower,”Lower”,colorRed,styleDashed);
PlotShapes(Buy1*shapeUpArrow,colorGreen,0,L);
PlotShapes(sell1*shapeDownArrow,colorRed,0,H);
Plot(C,”Close”,IIf(bullish,colorGreen,IIf(bearish,colorRed,colorGrey40)),styleCandle);

1 user thanked author for this post.