var lst=1 は lstを1で初期化(代入)しているのですが、
1はnumberなので、変数lstもnumber型になります。
後でlst:=back(close);して初期値を捨てて上書きするのなら、
必ずしもvars lst=1である必要はなく、
lst=2でもlst=3でも、lst(number)でも同じ意味です。
CTL HelpのModules>STRATEGYあたりに構文の説明があります。
----------------------------
…
vars Variables;
…
Variables -> Variable {, Variable} - is a list of comma separated variables of a strategy.
Variable -> Name(Type)
Variable -> Name = Constant
----------------------------
平均足のストラテジーを作りたいのですが、
7行目8行目でビルドエラーが出てしまいます。
どなたかお分かりでしたらご助言おねがいします。
strategy heikin_doten;
input lots = 1;
vars i = 1, src = close, op(series), cl(series);
begin
if back(src) < front(src) - 1 then return;
i := back(src);
op = (open[i-1] + close[i-1])/2;
cl = (open[i] + high[i] + low[i] + close[i])/4;
if op[i-1] <= cl[i-1] and op[i] > cl[i] then exitlong();
if op[i-1] >= cl[i-1] and op[i] < cl[i] then exitshort();
if op[i-2] <= cl[i-2] and op[i-1] > cl[i-1] and op[i] > cl[i] then sell(lots);
if op[i-2] >= cl[i-2] and op[i-1] < cl[i-1] and op[i] < cl[i] then buy(lots);
end.