請問 我想設定選股策略是日線圖的寶塔線翻紅, 該如何設定? 另外: 策略裡的寶塔線的參數可以設定嗎? 謝謝
寶塔線選股
- 533
- 最後發表 我是乖寶寶 2022 五月 03
input: Length(4);
variable: _Index(0), HV(0), LV(0);
SetInputName(1, "寶塔天數");
HV = Close[1];
LV = Close[1];
for _Index = 2 to Length + 1
begin
if HV <= Close[_Index] then HV = Close[_Index];
if LV >= Close[_Index] then LV = Close[_Index];
end;
if Close > HV then Value1 = 1
else if Close < LV then Value1 = -1;
if Value1 = 1 and Value1[1] = -1 then plot1(Close, "綠轉紅");
if Value1 = -1 and Value1[1] = 1 then plot2(Close, "紅轉綠");
請問我照上面這樣的設定, 編譯結果顯示[在選股腳本中無法使用 Plot, 該如何修正? 謝謝
Hello 我是乖寶寶,
因為plot函數只能使用在指標腳本上。
如果您是要讓選股腳本篩選出商品的話,應該是符合條件時 ret = 1;
舉例來說,如果您是要篩選出 if Value1 = 1 and Value1[1] = -1 then plot1(Close, "綠轉紅"); 的商品的話,要將其改為
if Value1 = 1 and Value1[1] = -1 then ret = 1;
並把 if Value1 = -1 and Value1[1] = 1 then plot2(Close, "紅轉綠"); 給刪除。
小幫手建議您可以先看網站上的教學區,裡面有XS語法的基礎和應用。
3 評論