請問各位大大, 我用以下的代碼做Heiken Ashi圖, 但為何無論是什麼個股的價格資料, 都不能顯示首7個BarNumber的棒??!!
但用回MC內建的Heiken Ashi棒, 便可顯示所有日棒.
請各位多多指教一下~~~- inputs:
- UpColor(red),
- DnColor(green);
- vars:
- haClose(0),
- haOpen(0),
- haHigh(0),
- haLow(0),
- color(0);
- if BarNumber = 1 then
- begin
- haOpen = open;
- haClose = (O+H+L+C)/4;
- haHigh = MaxList( high, haOpen, haClose);
- haLow = MinList( low, haOpen,haClose);
- end;
- if BarNumber > 1 then
- begin
- haClose = (O+H+L+C)/4; ////average bar price
- haOpen = (haOpen [1] + haClose [1])/2 ; ////avg open/close 1 bar ago
- haHigh = MaxList(High, haOpen, haClose) ; ////highest of high,open,close
- haLow = MinList(Low, haOpen, haClose) ; //// lowest of low, open, close
- if haClose > haOpen then color = UpColor
- else color = DnColor;
- plotPB(haOpen,haClose,"heikin-ashi",color);
- SetPlotWidth(1,4);
- SetPlotColor(1,color);
- end;
複製代碼 c:\001.jpg
c:\002.jpg |