如何在下单组件里面实现追价功能 [文华财经]
- 咨询内容:
我自己编了个程序,放在下单组件里面,一切运行都很好,就是有时候会发生触及止损条件了但却成交不上的情况。原来是设定为市价成交,后来修改为对一价成交,可还是存在成交不上的问题。有没有办法在组件里实现追价功能? 另外我要不要把程序发给你们看一看
- 文华技术人员:
以下是我的程序,能不能帮我做一下修改? 痛苦等待中。。。。
// ????+??????
VAR minp;//???????,??????
VAR BPRICE,SPRICE;//????????,??????,?????,?????
VAR Step,LoseBit; //??????,????,????,??????
VAR code;VAR buyvol,sellvol;//?????????
VAR SPID,BPID;
VAR moveup,movedown;
VOID MAIN()
{
code="IF1308";
Step=2.2; //??????
LoseBit=2.8; //??????
minp=MinPrice(code);
BPRICE=T_BuyAvgPrice(code);//???????????????
SPRICE=T_SellAvgPrice(code);//???????????????
buyvol=T_BuyPosition(code);
sellvol=T_SellPosition(code);
IF (buyvol>0)
{
MOVETOZERO(1);
}
ELSE IF (sellvol>0)
{
MOVETOZERO(0);
}
ELSE
{
WriteGlobal("movedown",0);
WriteGlobal("moveup",0);
MessageOut("手动平仓后清空标记");
}
}
VOID MOVETOZERO(VAR isup)
{IF(isup==1)
{
moveup=ReadGlobal("moveup");
IF(Price(code)-BPRICE>=Step && moveup==0)
{
WriteGlobal("moveup",1);
MessageOut("标记准备上移");
}
ELSE IF(Price(code)<=BPRICE+minp && moveup==1)
{
SPID=T_Deal(code,1,1,buyvol,0);
WriteGlobal("SPID",SPID);
WriteGlobal("moveup",0);
MessageOut("上移成本价止损");
}ELSE IF(BPRICE-Price(code)>LoseBit && moveup==0)
{
SPID=T_Deal(code,1,1,buyvol,0);
MessageOut("卖平止损");
WriteGlobal("moveup",0);
WriteGlobal("SPID",SPID);
}
}
ELSE{
movedown=ReadGlobal("movedown");
IF(SPRICE-Price(code)>=Step && movedown==0)
{
WriteGlobal("movedown",1);
MessageOut("标记下移");
}
ELSE IF(Price(code)>=SPRICE-minp && movedown==1)
{
BPID=T_Deal(code,0,1,sellvol,0);
WriteGlobal("BPID",BPID);
WriteGlobal("movedown",0);
MessageOut("卖平成本价止损");
}ELSE IF(Price(code)-SPRICE>LoseBit && movedown==0)
{
BPID=T_Deal(code,0,1,sellvol,0);
MessageOut("买平止损");
WriteGlobal("movedown",0);
WriteGlobal("BPID",BPID);
}}
}
- 文华客服:
组件修改需要段时间 请您耐心等待 修改好后会及时为您回复。
- 网友回复:
// ????+??????
VAR minp;//???????,??????
VAR BPRICE,SPRICE;//????????,??????,?????,?????
VAR Step,LoseBit; //??????,????,????,??????
VAR code;VAR buyvol,sellvol;//?????????
VAR SPID,BPID;
VAR moveup,movedown;
VOID MAIN()
{
code="IF1308";
Step=2.2; //??????
LoseBit=2.8; //??????
minp=MinPrice(code);
BPRICE=T_BuyAvgPrice(code);//???????????????
SPRICE=T_SellAvgPrice(code);//???????????????
buyvol=T_BuyPosition(code);
sellvol=T_SellPosition(code);
IF (buyvol>0)
{
MOVETOZERO(1);
}
ELSE IF (sellvol>0)
{
MOVETOZERO(0);
}
ELSE
{
WriteGlobal("movedown",0);
WriteGlobal("moveup",0);
MessageOut("手动平仓后清空标记");
}
}
VOID MOVETOZERO(VAR isup)
{
IF(isup==1)
{
moveup=ReadGlobal("moveup");
IF(Price(code)-BPRICE>=Step && moveup==0)
{
WriteGlobal("moveup",1);
MessageOut("标记准备上移");
}
ELSE IF(Price(code)<=BPRICE+minp && moveup==1)
{
SPID=T_Deal(code,1,1,buyvol,0);
WriteGlobal("SPID",SPID);
WriteGlobal("moveup",0);
MessageOut("上移成本价止损");
}
ELSE IF(BPRICE-Price(code)>LoseBit && moveup==0)
{
SPID=T_Deal(code,1,1,buyvol,0);
MessageOut("卖平止损");
WriteGlobal("moveup",0);
WriteGlobal("SPID",SPID);
}
}
ELSE
{
movedown=ReadGlobal("movedown");
IF(SPRICE-Price(code)>=Step && movedown==0)
{
WriteGlobal("movedown",1);
MessageOut("标记下移");
}
ELSE IF(Price(code)>=SPRICE-minp && movedown==1)
{
BPID=T_Deal(code,0,1,sellvol,0);
WriteGlobal("BPID",BPID);
WriteGlobal("movedown",0);
MessageOut("卖平成本价止损");
}
ELSE IF(Price(code)-SPRICE>LoseBit && movedown==0)
{
BPID=T_Deal(code,0,1,sellvol,0);
MessageOut("买平止损");
WriteGlobal("movedown",0);
WriteGlobal("BPID",BPID);
}
}
}模型仅供参考
- 网友回复: 非常感谢!
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 1145508240 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容