以下指標腳本用在任意股票標的,print 出來的 PeakBar 及 PeakPrice 皆正確,但用 Plot Shift 在K線圖畫出來的位置及值卻皆不正確。
請問是何原因? 如何排除?
謝謝解惑!
var: _peak_bar(0), _peak_price(0);
_peak_bar = SwingHighBar(High, 50, 5, 5, 2);
if _peak_bar>0 then _peak_price = High[_peak_bar];
print(file("D:\Output.txt"),datetostring(date),
"CurrBar",currentbar,"PeakBar",_peak_bar,"PeakPrice",_peak_price,
"PeakDate",datetostring(iff(_peak_bar>0,date[_peak_bar],0)));
if _peak_bar<currentbar and _peak_bar>0 and _peak_bar<>_peak_bar[1]+1 then begin
Plot1(_peak_price, "Peak",shift:=-_peak_bar);
print(file("D:\Output.txt"),datetostring(date),
"PeakBarPlot",currentbar,"PeakBar",_peak_bar,"PeakPrice",_peak_price,
"PeakDate",datetostring(iff(_peak_bar>0,date[_peak_bar],0)));
end;
5 評論