還是不發單啊.,再一次請管理員與版主進來看一看 [開拓者 TB]
- 咨詢內容:
本帖最后由 xiaosong 于 2013-7-25 08:31 編輯
它就是不發單了,就是不發單...
Begin
//if(BarStatus==2 && Time==0.090000 && CurrentTime<0.090000) Return; // 集合競價過濾
conEntryReady=CurrentTime*100 >=tradBegin and CurrentTime*100<tradEnd and Q_LowerLimit>20*MinMove*PriceScale AND Q_UpperLimit-C>20*MinMove*PriceScale;//不靠近漲跌停 //// 開倉時限
If(BarStatus == 0)
{
DeleteOrderTickCounter = 9999;
HasSendOrder = 0;
SetGlobalVar(0,DeleteOrderTickCounter);
SetGlobalVar(1,HasSendOrder);
}Else
{
DeleteOrderTickCounter = GetGlobalVar(0);
HasSendOrder = GetGlobalVar(1);
}
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。(這里寫的運算,如:先算均線,10日,5日,然后,在下面真接寫表達式,如滿足了,就發單)
If(conEntryReady and BarStatus == 2 and HasSendOrder == 0)
{
If(Max(開多信號 and a_buyposition==0 and a_sellposition==0 ) // 開多信號
{
A_SendOrder(Enum_Buy,Enum_Entry,Lots,Q_AskPrice()+N*MinMove*PriceScale);//發送委托單開多倉一手
HasSendOrder = 1;
SetGlobalVar(1,HasSendOrder);
Return;
}
If(Min(開空信號 and a_buyposition==0 and a_sellposition==0 ) // 開空信號
{
A_SendOrder(Enum_Sell,Enum_Entry,Lots,Q_BidPrice()-N*MinMove*PriceScale); //發送委托單開空倉一手
HasSendOrder = 1;
SetGlobalVar(1,HasSendOrder);
Return;
}
}
If(conEntryReady and BarStatus == 2 && HasSendOrder == 1)
{ if(平多信號 and a_buyposition>0) // 平多信號 滿足要求下平多
{
A_SendOrder(Enum_Sell,Enum_ExitToday, A_BuyPosition(),Q_BidPrice()-N*MinMove*PriceScale);
HasSendOrder = 0;
SetGlobalVar(1,HasSendOrder);
Return;
}
if(平多信號 and a_buyposition>0) // 平多信號 止損
{
A_SendOrder(Enum_Sell,Enum_ExitToday, A_BuyPosition(),Q_BidPrice()-N*MinMove*PriceScale);
HasSendOrder = 0;
SetGlobalVar(1,HasSendOrder);
Return;
}
if( 平空信號 and A_SellPosition>0) // 平空信號 止損
{
A_SendOrder(Enum_Buy,Enum_ExitToday,A_SellPosition,Q_BidPrice()+N*MinMove*PriceScale);
HasSendOrder = 0;
SetGlobalVar(1,HasSendOrder);
Return;
}
if(平空信號 and A_SellPosition>0) // 平空信號
{
A_SendOrder(Enum_Buy,Enum_ExitToday,A_SellPosition,Q_BidPrice()+N*MinMove*PriceScale);
HasSendOrder = 0;
SetGlobalVar(1,HasSendOrder);
Return;
}
}
End
要求簡單,如果顯開多信號,開多,不管它消失不,下一Bar或者是Tick 再觸發開多信號,不重開. 如果止損信號出現,平倉.
開空也是一樣
上面的邏輯這樣清楚啊. 都不發單,我是細細地研究了,幫助中的交易策略進階----A函數下單撤單和全局變量操作寫出來的.
是不是開空,開多的運算寫的位置不對.
- TB技術人員:
有自己寫日志將條件都輸出來看過嗎?
你的開多與開空條件是什么意思呢?
max,min是比較數值大水上的函數,你這樣 的用法是不對的吧?這樣應該不能直接通過編譯吧 - TB客服:
本帖最后由 xiaosong 于 2013-7-27 07:29 編輯
小米 發表于 2013-7-25 10:19
有自己寫日志將條件都輸出來看過嗎?
你的開多與開空條件是什么意思呢?
max,min是比較數值大水上的函數, ...
謝謝老大了.
1:有自己寫日志將條件都輸出來看過嗎?
不知道如何搞了?
2:你的開多與開空條件是什么意思呢?
我是這樣想的.
Begin
....................在這里就運算條件了.
If(Max(開多信號 and a_buyposition==0 and a_sellposition==0 ) // 開多信號就是條件合適
{
A_SendOrder(Enum_Buy,Enum_Entry,Lots,Q_AskPrice()+N*MinMove*PriceScale);//發送委托單開多倉一手
2:
max,min是比較數值大水上的函數,你這樣 的用法是不對的吧?這樣應該不能直接通過編譯吧
能編譯,就是圖上無信號,不發單. - 網友回復:
xiaosong 發表于 2013-7-25 11:24
謝謝老大了.
1:有自己寫日志將條件都輸出來看過嗎?
1.fileappend() 輸出你的開倉條件里所有需要判斷到的變量的值,一一排查。
2.你能將你使用到max的這句原話貼一下嗎????
以我對max函數的了解,想象不了你這里比條件是怎么個比法。 - 網友回復:
本帖最后由 小米 于 2013-7-26 15:18 編輯
給你一個簡單的a_sendorder發單的例子,可看一下。
這個主要是說明一個全局變量控制a_sendorder的情況。具體的條件以及發單價格要自己琢磨一下,這里不做參考 。- Vars
- bool aa;
- Bool bb;
- Begin
- aa = xxxxx;
- bb = yyyyy;
- If(GetGlobalVar(0)==InvalidNumeric)
- {
- SetGlobalVar(0,0);
- SetGlobalVar(1,0);
- }
- If(BarStatus==2)
- {
- 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
- Vars
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容