小米老大,与各位版主,我再麻烦一次 [开拓者 TB]
- 咨询内容:
Vars
bool aa;
Bool bb;
Numeric tradBegin(905); 开仓时间
Numeric tradEnd(1458); 开仓截止时间
Bool conEntryReady;
Begin
aa = xxxxx;
bb = yyyyy;
conEntryReady=CurrentTime*100 >=tradBegin and CurrentTime*100<tradEnd and C-Q_LowerLimit>20*MinMove*PriceScale && Q_UpperLimit-C>20*MinMove*PriceScale;//不靠近涨跌停 //// 开仓时限
If(GetGlobalVar(0)==InvalidNumeric)
{
SetGlobalVar(0,0); \\0
SetGlobalVar(1,0); \\
}
If(BarStatus==2 and conEntryReady)
{
If( aa && A_GetOpenOrderCount==0 && A_BuyPosition==0 && GetGlobalVar(0)==0)
{
A_SendOrder(enum_buy,enum_entry,1,q_last);
SetGlobalVar(0,1);
setGlobalVar(1,0);
}
If( bb && A_GetOpenOrderCount==0 && A_BuyPosition>0 && GetGlobalVar(1)==0)
{
A_SendOrder(enum_sell,enum_exit,1,q_last);
SetGlobalVar(1,1);
SetGlobalVar(0,0);
}
}
Commentary("get0: get1:"+Text(getglobalvar(0))+","+text(getglobalvar(1)));
End
conEntryReady=CurrentTime*100 >=tradBegin and CurrentTime*100<tradEnd and C-Q_LowerLimit>20*MinMove*PriceScale && Q_UpperLimit-C>20*MinMove*PriceScale;//不靠近涨跌停 //// 开仓时限
我把这个conEntryReady入在If(BarStatus==2 and conEntryReady) 这里就不发单,是不是不应该放在这里.
谢谢.... - TB技术人员:
本帖最后由 小米 于 2013-7-29 13:54 编辑
使用commentary("conentryready: "+iifstring(conentryready,"true","false")); 放到公式里,看一下在最后K线上的输出值是什么? - TB客服:
那天看你见你的回贴,
Commentary("get0: get1:"+Text(getglobalvar(0))+","+text(getglobalvar(1)));
我就得到启发.然后我就在论坛查 bool的值,如何用Commentary输出?
我都试过的.你看
//Commentary("aa="+IIFString(aa,"True","False"));
//Commentary("bb="+IIFString(bb,"True","False"));
commentary("conentryready: "+iifstring(conentryready,"true","false")); 这个也用过的.
我又在论坛查:如果用CurrentTime是取本地时间.而Bar是time时间
如果用回返,用Time 实盘是CurrentTime
所以,我早上在实盘中用CurrentTime 但是不发单.
- 网友回复:
xiaosong 发表于 2013-7-29 15:12
那天看你见你的回贴,
Commentary("get0: get1:"+Text(getglobalvar(0))+","+text(getglobalvar(1)));
你现在的问题是加入条件后不发单 ,那么需要查看的就是这个条件是否满足。
加入我前面给出的语句后,看到的结果是什么呢??最后K线上显示的是true还是false?
- 网友回复:
本帖最后由 xiaosong 于 2013-7-29 15:57 编辑
是false
但是小米老大,现在的时间15.54 而Bar上面的时间是当时的时间
现在去看是不是都是false了.
明天老大了..哎...
晚上我去试去了.
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 1145508240 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容