A函数做多平多正常, 不做空不知为什么? [开拓者 TB]
- 咨询内容:
If(BarStatus==0 && getglobalvar(2)==InvalidNumeric )
{
SetGlobalVar(2,0);
}
If(BarStatus==0 && getglobalvar(0)==InvalidNumeric )
{
SetGlobalVar(0,0);
tickjishuoqi = 20;
SetGlobalVar(1,tickjishuoqi);
}
Else //其他bar,从全局变量中读取tick计数器
{
tickjishuoqi = GetGlobalVar(1);
}
If( Condition13 and h>h[1] and A_BuyPosition()==0 && GetGlobalVar(0)==0 && BarStatus == 2 && GetGlobalVar(1)>=20)
{
A_SendOrder(Enum_Buy,Enum_Entry,1,Q_AskPrice+OffsetPoint*MinMove*PriceScale);
SetGlobalVar(0,1); //全局变量变为1多开
tickjishuoqi = 1; //tick开始计数
SetGlobalVar(2,0);
FileAppend("d:\\Formula.log","全局变量1 = "+Text(GetGlobalVar(0)));
}Else If(A_BuyPosition()>0 && GetGlobalVar(0)==1 && BarStatus == 2 and LongExitCon and l<l[1]&& GetGlobalVar(1)>=20)
{
A_SendOrder(Enum_SELL,Enum_Exit,1,Q_BIDPrice-OffsetPoint*MinMove*PriceScale);
SetGlobalVar(0,0); //全局变量变为0多平
tickjishuoqi = 1; //tick开始计数
FileAppend("d:\\Formula.log","全局变量 1= "+Text(GetGlobalVar(0)));
}
if( Condition14 and l<l[1] and A_SellPosition()==0 && GetGlobalVar(2)==0 && BarStatus == 2 && GetGlobalVar(1)>=20)
{
A_SendOrder(Enum_sell,Enum_Entry,1,Q_bidPrice-OffsetPoint*MinMove*PriceScale);
SetGlobalVar(2,1); //全局变量变为1空开
tickjishuoqi = 1; //tick开始计数
SetGlobalVar(0,0);
FileAppend("d:\\Formula.log","全局变量1 = "+Text(GetGlobalVar(0)));
}Else if(A_sellPosition()>0 && GetGlobalVar(2)==1 && BarStatus == 2 && (ShortExitCon and h>h[1])&& GetGlobalVar(1)>=20)
{
A_SendOrder(Enum_buy,Enum_Exit,1,Q_askPrice+OffsetPoint*MinMove*PriceScale);
SetGlobalVar(2,0); //全局变量变为0空平
tickjishuoqi = 1; //tick开始计数
}
if (GetGlobalVar(1)>=20) Return;
tickjishuoqi = tickjishuoqi+1;
SetGlobalVar(1,tickjishuoqi);
End
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容