小米老大,與各位版主,我再麻煩一次 [開拓者 TB]
- 咨詢內(nèi)容:
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) 這里就不發(fā)單,是不是不應(yīng)該放在這里.
謝謝.... - TB技術(shù)人員:
本帖最后由 小米 于 2013-7-29 13:54 編輯
使用commentary("conentryready: "+iifstring(conentryready,"true","false")); 放到公式里,看一下在最后K線上的輸出值是什么? - TB客服:
那天看你見你的回貼,
Commentary("get0: get1:"+Text(getglobalvar(0))+","+text(getglobalvar(1)));
我就得到啟發(fā).然后我就在論壇查 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 但是不發(fā)單.
- 網(wǎng)友回復(fù):
xiaosong 發(fā)表于 2013-7-29 15:12
那天看你見你的回貼,
Commentary("get0: get1:"+Text(getglobalvar(0))+","+text(getglobalvar(1)));
你現(xiàn)在的問題是加入條件后不發(fā)單 ,那么需要查看的就是這個條件是否滿足。
加入我前面給出的語句后,看到的結(jié)果是什么呢??最后K線上顯示的是true還是false?
- 網(wǎng)友回復(fù):
本帖最后由 xiaosong 于 2013-7-29 15:57 編輯
是false
但是小米老大,現(xiàn)在的時間15.54 而Bar上面的時間是當(dāng)時的時間
現(xiàn)在去看是不是都是false了.
明天老大了..哎...
晚上我去試去了.
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容