我想要抓取"今日"最大成交量的當根高低價區間
但是我只會寫出近X根K棒內的最大量的高低區間
如下
if highest(Volume[1],6) = Volume[1] then begin if highest(open[1], 1) > highest(close[1], 1) then value11 = highest(open[1], 1) else value11 = highest(close[1], 1); if lowest(open[1], 1) < lowest(close[1], 1) then value12 = lowest(open[1], 1) else value12 = lowest(close[1], 1); end;
highest(Volume[1],6)的語法有什麼可以改?
//補-----------
if barfreq <> "MIN" and barinterval <> 5 then raiseruntimeerror("請使用5分鐘頻率");
if highest(Volume[1],6) = Volume[1] then begin
if highest(open[1], 1) > highest(close[1], 1) then value11 = highest(open[1], 1) else value11 = highest(close[1], 1);
if lowest(open[1], 1) < lowest(close[1], 1) then value12 = lowest(open[1], 1) else value12 = lowest(close[1], 1);
end;
if currenttime < 131500 and currenttime > 090500 then begin
var:InCondition1(False);
InCondition1 = close Crosses Above value11;
if position = 0 and filled = 0 and InCondition1 then setposition(500/close,value11,label:="做多進場");
end;
//-----------132450平倉-----------
if filled <> 0 and currenttime > 132450 then setposition(0, market);
//-----------出場-----------
input: profit_point(10, "停利(點)");
input: profit_drawback_point(5, "停利回跌(點)");
input: loss_point(10, "停損(點)");
var: long_condition(false); { 進場買進作多 }
if profit_point = 0 then raiseruntimeerror("請設定停利(點)");
if profit_drawback_point = 0 then raiseruntimeerror("請設定停利回跌(點)");
if position > 0 and filled > 0 then begin
var: intrabarpersist max_profit_point(0); { 啟動停利後最大獲利點 }
if loss_point > 0 and Close <= FilledAvgPrice - loss_point then begin
{ 停損 }
SetPosition(0);
max_profit_point = 0;
end else begin
{ 判斷是否要啟動停利 }
if max_profit_point = 0 and Close >= FilledAvgPrice + profit_point then begin
max_profit_point = Close;
end;
if max_profit_point <> 0 then begin
if Close <= max_profit_point - profit_drawback_point then begin
{ 停利 }
SetPosition(0);
max_profit_point = 0;
end else if Close > max_profit_point then begin
{ 移動最大獲利點 }
max_profit_point = Close;
end;
end;
end;
end;
麻煩再幫我健檢一下這份
出現的問題是進場時間我希望是在090500~131500
不過也會有在這時間之外進場的
另外重點是我需要132450強制平倉
但在回測運行中也都沒有正確啟動
這部分也麻煩小幫手幫忙健檢一下
6 評論