上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。
現在のストラテジーに使っているインジケータのソースコードを掲載して行きます
今回は
ind_Stochasfast_simulation_step
チャートでは左の下から2番目のインジケータになります。

%Kと%Dのクロスでサインを出します
以下にソースコードを掲載します
中と右のチャートではスロータイプを使っています
こちらは昔作ったインジケータです
ソースコードは、右欄カテゴリーのモジュール目次から飛んでください
参考になったらクリックよろしく
人気blogランキングへ
コラム執筆陣:松田哲、吉田恒、陳満咲杜、マット今井


indicator ind_Stochasfast_simulation_step;
{ 期間と予想価格を入力することによりkライン、dラインを描く }
{ FBarが0で現在バ-のみ、1で次のバ-のみ、2以上で数字分の未来バ-分を表示する。 }
{ マイナスにすると予想なしの通常の表示になる }
input lstprice=89,nextprice=87.12, FBar=0, target=100, price = close, period = 21, k_slow_period = 8, d_period = 8,
hi_baseline = 80, lo_baseline = 20;
draw k("k"), line_k("Slow %K"), line_d("Slow %D"), line_hi("HI Base"), line_lo("LO Base");
vars i(number), lo(number), dif(number), lst(number),step(number),
lstlo(number), lstdif(number),nextlo(number), nextdif(number), j(number);
begin
line_hi := makeseries(front(close), back(close), hi_baseline);
line_lo := makeseries(front(close), back(close), lo_baseline);
{ 現在バ-の1本前までの計算 }
for i := front(price) + period - 1 to back(price)-1 do begin
lo := movmin(low, i, period);
dif := movmax(high, i, period) - lo;
if dif > 0 then
k[i] := 100 * (price[i] - lo) / dif
else
k[i] := 0;
end;
{ 現在バ-の計算 }
if FBar < 0 then begin
lst:=back(close);
lstlo:=movmin(low, lst, period);
lstdif:=movmax(high, lst, period) - lstlo;
k[lst]:=100*(price[lst]-lstlo)/lstdif;
end;
{ 現在バ-の計算、lstpriceは現在バ-の予想価格 }
if FBar >= 0 then begin
lst:=back(close);
lstlo:=movmin(low, lst, period);
lstdif:=movmax(high, lst, period) - lstlo;
k[lst]:=100*(lstprice-lstlo)/lstdif;
end;
{ 未来のバ-の計算、nextpriceは次のバ-の予想価格 }
{ その次からは一定に推移する }
{ 安値高値は継続とする }
if FBar >= 1 then begin
nextlo:=movmin(low, lst, period-1);
nextdif:=movmax(high, lst, period-1) - nextlo;
k[lst+1]:=100*(nextprice-nextlo)/nextdif;
end;
if FBar >= 2 then begin
step := (target-k[lst+1])/(FBar-1) ;
for i := lst + 2 to lst+FBar do begin
k[i]:= k[i-1]+step ;
if k[i]>100 then k[i]:= 100;
if k[i]<0 then k[i] := 0;
end;
end;
line_k := sma(k, k_slow_period);
line_d := sma(line_k, d_period);
end.
検証にはGFTのdealbook360を使っています


自前の検証をお勧めします
口座開設はこちらから

スポンサーサイト