使用自訂選股腳本時,可以指定某一日期區間嗎?
例如 只篩選2024年1月份到3月份的走勢符合的股票
應該可以,但會依條件不同,有不同的寫法。
一個簡單條件邏輯在時間區間內符合就選出來
例如 把今年1~3月 均線多頭排列 選出來
setTotalBar(300);
input: bDate(20240620,"開始日期",inputkind:=Daterange(20240102,20240709,"D"));
input: eDate(20240628,"結束日期",inputkind:=Daterange(20240102,20240709,"D"));
if eDate<bDate then raiseRunTimeError("結束日期不得比開始日期早!");
if date>=bDate and date<=eDate then
begin
condition1=c>average(c,5) and average(c,5)>average(c,20) and average(c,20)>average(c,60);
if condition1=false then condition2=true;
end;
if condition2=false then ret=1;
4 評論