Loading ...

饭-日内交易_1

Author: bitfan, Date: 2020-07-19 04:15:52
Tags: C++


(*
回测参数:
    平台 - okex期货,
    余额 - 1,
    执行方式 - 实盘价模型,
    品种代码 - this_week
    
具体说明看:https://www.fmz.com/m/edit-strategy/219734

*)


highest:=HHV(REF(H,1), LENGTH); //LENGTH周期内的最高价
lowest:=LLV(REF(L,1), LENGTH); //LENGTH周期内的最低价

up_line^^highest; //上轨
under_line^^lowest; //下轨

//开多单,递减加仓。1个头寸45张,是 1BTC 仓位的 5% 左右
BKVOL = 0 AND NEW >= highest, BK(90); //现价突破新高,开单两个头寸
BKVOL >= 90 AND NEW >= highest AND NEW > BKPRICE AND (NEW-BKPRICE)/BKPRICE >= 0.005, BK(45); //再突破新高,并且比前一次开单涨了0.5%,追加1个头寸


//开空单,递减加仓
SKVOL = 0 AND NEW <= lowest, SK(90);
SKVOL >= 90 AND NEW <= lowest AND NEW < SKPRICE AND (SKPRICE-NEW)/SKPRICE >= 0.005, SK(45);

//止盈多单
BKVOL > 90 AND NEW < BKPRICE, SP(BKVOL) ; //最新价格低于最后一次开仓价,止盈全部多单
//止损多单
BKVOL > 0 AND NEW < BKPRICEAV AND (BKPRICEAV-NEW)/BKPRICEAV >= 0.005, SP(BKVOL); //现价跌破全部仓位平均成本的 0.5% 就全部止损

//止盈空单
SKVOL > 90 AND NEW > SKPRICE, BP(SKVOL) ;
//止损空单
SKVOL > 0 AND NEW > SKPRICEAV AND (NEW-SKPRICEAV)/SKPRICEAV >= 0.005, BP(SKVOL); 


MULTSIG(1,1,5,1);
TRADE_AGAIN(5);


Related

More