-- 作者:lizhi
-- 发布时间:2017/12/8 17:50:27
--
Runmode:0; Input:FirstGrid(30);//第一笔交易的间距,最小跳动 Input:AddGrid(5);//加仓间距,最小跳动 Input:TotalGrids(10);//最大交易次数 Input:TrailingGrid(30);//移动止损跳数 Input:EveryLots(1);//每次开仓手数 Input:OffSet(1);//委托价偏差,默认买卖价偏差1个滑点 Variable:MyRealMp=0,HighAfterLongEntry=0,LowAfterShortEntry=0;
MinPoint := mindiff*multiplier,nodraw;//每跳变动价值 IF BARPOS =1 OR MyRealMp = 0 OR MyRealMp = NODRAW THEN MyRealMp:=0;//初始化当前仓位为0 //计算出开市以来的最高价与最低价------------------------------------------------------- if date<>date[1] then begin HighAfterLongEntry:=high; LowAfterShortEntry:=low; MyRealMp:=0; end else begin HighAfterLongEntry := max(HighAfterLongEntry,high); LowAfterShortEntry := min(LowAfterShortEntry,low); end //---------------------------------------------------------------------------------- 移动止损额:=TrailingGrid*MinPoint; IF time <145800 then begin //如果有多仓 if MyRealMp > 0 and HighAfterLongEntry - low >= 移动止损额 and (high-low<移动止损额 or(high-low>=移动止损额 and close<open)) then begin TmpPrice := Max(HighAfterLongEntry-(TrailingGrid-OffSet)*Minpoint,Low); TmpLots := Abs(MyRealMP*EveryLots); Sell(TmpLots,TmpPrice); MyRealMP := 0; LowAfterShortEntry := Low; end
end
[此贴子已经被作者于2017/12/8 17:50:49编辑过]
|