鼎元C++期货量化/程序化教程【tick与bar模式下ask价与bid价相关的说明】
  
- UID
- 2
- 积分
- 2914403
- 威望
- 1407234 布
- 龙e币
- 1507169 刀
- 在线时间
- 13521 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2025-3-3

|
鼎元C++期货量化/程序化教程【tick与bar模式下ask价与bid价相关的说明】
鼎元C++期货量化/程序化教程【tick与bar模式下ask价与bid价相关的说明】

上面是一个范例。
卖时价格是按从高到低排列。
买时也是按从最高到低排列。
正常情况下,卖方想高价卖,买方想低价买。双方以最新价中界,卖方在上,买方在下形成对峙。
如果为了保证成交,卖方按最高的买价卖,买方想按卖方最低价买,这时就要付出的价格点位就是滑点。一般是买1与卖1.
在上方演示中,卖方想立刻成交,就要挂[best bid]价卖出——立马成交;买 方想立刻成交,就要挂[best ask]价买 入--马立成交。 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|
|
|
|
|
|
  
- UID
- 2
- 积分
- 2914403
- 威望
- 1407234 布
- 龙e币
- 1507169 刀
- 在线时间
- 13521 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2025-3-3

|
TICK模式下:
1、买 入开仓语句:- OrderInsert(it->first, sInst, '0', '0', sl, t->LastPrice + hd * mapInstrument[sInst].PriceTick, "", ""); //开仓买入语句
复制代码 2、卖出开仓语句:- OrderInsert(it->first, sInst, '1', '0', sl, t->LastPrice - hd * mapInstrument[sInst].PriceTick, "", "");
复制代码 3、多单平仓语句:
//优先平昨- closesell1(it->first, sInst, sl, t->LastPrice - hd * mapInstrument[sInst].PriceTick);
复制代码 //优先平今- closesell2(it->first, sInst, sl, t->LastPrice - hd * mapInstrument[sInst].PriceTick);
复制代码 3、空单平仓语句:
//优先平昨- closebuy1(it->first, sInst, sl, t->LastPrice + hd * mapInstrument[sInst].PriceTick);
复制代码 //优先平昨今- closebuy2(it->first, sInst, sl, t->LastPrice + hd * mapInstrument[sInst].PriceTick);
复制代码 |
|
|
|
|
|
|
  
- UID
- 2
- 积分
- 2914403
- 威望
- 1407234 布
- 龙e币
- 1507169 刀
- 在线时间
- 13521 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2025-3-3

|
bar格式下:
1、买 入开仓语句:- OrderInsert(it->first, sInst, '0', '0', sl, mapMd[sInst].BidPrice1 + hd * mapInstrument[sInst].PriceTick, "", "");//买入开仓语句
复制代码 2、卖出开仓语句:- OrderInsert(it->first, sInst, '1', '0', sl, mapMd[sInst].AskPrice1 - hd * mapInstrument[sInst].PriceTick, "", "");//卖出开仓语句
复制代码 3、多单平仓语句:
//优先平昨- closesell1(it->first, sInst, sl, mapMd[sInst].AskPrice1 - hd * mapInstrument[sInst].PriceTick);//卖出平仓,优先平昨仓
复制代码 //优先平今- closesell2(it->first, sInst, sl, t->LastPrice - hd * mapInstrument[sInst].PriceTick);
复制代码 3、空单平仓语句:
//优先平昨- closebuy1(it->first, sInst, sl, mapMd[sInst].BidPrice1 + hd * mapInstrument[sInst].PriceTick); //买入平仓,优先平昨仓
复制代码 //优先平昨今- closebuy2(it->first, sInst, sl, mapMd[sInst].BidPrice1 + hd * mapInstrument[sInst].PriceTick); //买入平仓,优先平今仓
复制代码 |
|
|
|
|
|
|