//損切りラインでの損切り if long() and close[lst] < losslong_line[lst] then exitlong(); if short() and close[lst] > lossshort_line[lst] then exitshort() ;
/*エントリ- */ //値幅フィルタ if c_range[lst-1] < AV_range[lst-1]*entryrange then begin
//エントリ-ラインでのドテン if long() and close[lst] < sell_line[lst] then begin exitlong() ; sell(lots) ; end; if short() and close[lst] > buy_line[lst] then begin exitshort() ; buy(lots) ; end;
//トレンドフィルタ有効 if trend = true then begin { エントリー終了時刻が23時台以前の場合 } if entry_endhour<=23 and entry_endhour>=end_hour then begin if hour(timestamp[lst]) <= entry_endhour and hour(timestamp[lst]) >= end_hour then begin if close[lst] <= sell_line[lst] and close[lst-1] > sell_line[lst-1] and smatrend < 0 then sell(lots) ; if close[lst] >= buy_line[lst] and close[lst-1] < buy_line[lst-1] and smatrend > 0 then buy(lots) ; end; end;
{ エントリー終了時刻が0時以降の場合 } if entry_endhour<=start_hour then begin if hour(timestamp[lst]) <= entry_endhour or hour(timestamp[lst]) >= end_hour then begin if close[lst] <= sell_line[lst] and close[lst-1] > sell_line[lst-1] and smatrend < 0 then sell(lots) ; if close[lst] >= buy_line[lst] and close[lst-1] < buy_line[lst-1] and smatrend > 0 then buy(lots) ; end; end;
//トレンドフィルタ無効 end else begin { エントリー終了時刻が23時台以前の場合 } if entry_endhour<=23 and entry_endhour>=end_hour then begin if hour(timestamp[lst]) <= entry_endhour and hour(timestamp[lst]) >= end_hour then begin if close[lst] <= sell_line[lst] and close[lst-1] > sell_line[lst-1] then sell(lots) ; if close[lst] >= buy_line[lst] and close[lst-1] < buy_line[lst-1] then buy(lots) ; end; end;
{ エントリー終了時刻が0時以降の場合 } if entry_endhour<=start_hour then begin if hour(timestamp[lst]) <= entry_endhour or hour(timestamp[lst]) >= end_hour then begin if close[lst] <= sell_line[lst] and close[lst-1] > sell_line[lst-1] then sell(lots) ; if close[lst] >= buy_line[lst] and close[lst-1] < buy_line[lst-1] then buy(lots) ; end; end; end; end;
/* 直近安値(高値)ブレイクでの手仕舞い(トレ-ルストップ) */
//買いの利確1ライン未満、売りの利確1ライン以上での手仕舞 if trail_0 = true then begin { この機能の有効無効を切り替える } if close[lst] <= prflong_line1[lst] then begin if close[lst] < bottom_line_0[lst] and close[lst-1] >= bottom_line_0[lst-1] then exitlong() ; end; if close[lst] >= prfshort_line1[lst] then begin if close[lst] > top_line_0[lst] and close[lst-1] <= top_line_0[lst-1] then exitshort() ; end; end; //買いの利確1ライン以上・利確2ライン未満、売りの利確1ライン以下・利確2ライン以上での手仕舞 if trail_1 = true then begin { この機能の有効無効を切り替える } if close[lst] > prflong_line1[lst] and close[lst] <= prflong_line2[lst] then begin if close[lst] < bottom_line_1[lst] and close[lst-1] >= bottom_line_1[lst-1] then exitlong() ; end; if close[lst] < prfshort_line1[lst] and close[lst] >= prfshort_line2[lst] then begin if close[lst] > top_line_1[lst] and close[lst-1] <= top_line_1[lst-1] then exitshort() ; end; end; //買いの利確2ライン以上、売りの利確2ライン以下での手仕舞 if trail_2 = true then begin { この機能の有効無効を切り替える } if close[lst] > prflong_line2[lst] then begin if close[lst] < bottom_line_2[lst] and close[lst-1] >= bottom_line_2[lst-1] then exitlong() ; end; if close[lst] < prfshort_line2[lst] then begin if close[lst] > top_line_2[lst] and close[lst-1] <= top_line_2[lst-1] then exitshort() ; end; end;
/* 利確ラインでの手仕舞い */ if fixexit = true then begin { この機能の有効無効を切り替える } if close[lst] < prflong_line2[lst] and close[lst-1] >= prflong_line2[lst-1] then exitlong() ;{ 利確 } if close[lst] < prflong_line1[lst] and close[lst-1] >= prflong_line1[lst-1] then exitlong() ;{ 利確 }
if close[lst] > prfshort_line1[lst] and close[lst-1] <= prfshort_line1[lst-1] then exitshort() ;{ 利確 } if close[lst] > prfshort_line2[lst] and close[lst-1] <= prfshort_line2[lst-1] then exitshort() ;{ 利確 } end;
/*時刻強制手仕舞い */ bar := func_barminute(); if hour(timestamp[lst]) = start_hour-1 and minute(timestamp[lst]) = 60 - 2*bar then begin exitlong(); exitshort(); end; end.