求助,小米老師 [開拓者 TB]
high;low;high = Highest(h[1],BackNumber);low = Lowest(l[1],BackNumber);high and Q_Last>h[BackNumber])low and Q_Last<l[BackNumber])
{conshortopen = True;MyShortEntryPrice = l[BackNumber];shortstoplossline = h;}
//進倉條件
//空進倉------------------------------------------------------------------------------------------------
if(conshortopen AND A_TotalPosition ==0 and A_GetOpenOrderCount ==0 and o>=MyShortEntryPrice)
{
A_SendOrder(Enum_Sell,Enum_Entry,lots,MyShortEntryPrice - sp * MinMove * PriceScale);
Commentary("空進倉:"+Text(MyShortEntryPrice - sp * MinMove * PriceScale));
SetGlobalVar(11,1);
SetGlobalVar(21,CurrentBar);
}
//空止損1111111111111111111111111111111111111111111111111111111111111111111111111111
if(GetGlobalVar(11)==1 and A_SellPosition >0 and A_GetOpenOrderCount ==0 and CurrentBar-GetGlobalVar(21)>=1
and Q_Last > shortstoplossline[1])
{
A_SendOrder(Enum_buy,Enum_Exit,lots,shortstoplossline[1] + sp * MinMove * PriceScale);
Commentary("空止損:"+Text(shortstoplossline[1] + sp * MinMove * PriceScale));
SetGlobalVar(11,0);
SetGlobalVar(31,CurrentBar);
}
//距離平空倉2222222222222222222222222222222222222222222222222222222222222222222222222
IF(GetGlobalVar(11)==1 and A_SellPosition >0 and A_GetOpenOrderCount ==0 and CurrentBar-GetGlobalVar(21)>=1
AND Q_Last<=ma5 - DistanceFromMA5 * MinMove * PriceScale)
{
A_SendOrder(Enum_buy,Enum_Exit,lots,ma5 - DistanceFromMA5 * MinMove * PriceScale);
Commentary("距離平空倉:"+Text(ma5 - DistanceFromMA5 * MinMove * PriceScale));
SetGlobalVar(11,0);
SetGlobalVar(31,CurrentBar);
}
//空平倉3333333333333333333333333333333333333333333333333333333333333333333333333333
if(GetGlobalVar(11)==1 and A_SellPosition >0 and A_GetOpenOrderCount ==0 and CurrentBar-GetGlobalVar(21)>=1
and Q_Last > MA5
??and CurrentTime*1000000 == Hour*10000 +(Minute+BarInterval-1)*100 + 58)
{
A_SendOrder(Enum_buy,Enum_Exit,lots,Q_Last + sp * MinMove * PriceScale);
Commentary("空平倉MA5:"+Text(Q_Last + sp * MinMove * PriceScale));
SetGlobalVar(11,0);
SetGlobalVar(31,CurrentBar);
}
//平倉BAR不進空倉
if(GetGlobalVar(21)==GetGlobalVar(31))
{conshortopen = FALSE;}
}
endTB技術人員:
A函數(shù)下單 的調試,使用fileappend會比commentary更有效。。
自己先使用fileappend記錄一下相關的信息,然后看一下日志內容能否找到原因 。 TB客服:
哦,好的,謝謝小米;老師,請問下上邊公式你看出什么錯誤沒有?
網友回復:
沒看呢。。一段A函數(shù)的指令,連barstatus==2以及判斷帳戶信息有效這樣的限制條件都沒有的,我覺得沒有什么必要性去看啊。。
而且寫日志是最快捷有效的調試方式,先試試吧。
{conshortopen = True;MyShortEntryPrice = l[BackNumber];shortstoplossline = h;}
//進倉條件
//空進倉------------------------------------------------------------------------------------------------
if(conshortopen AND A_TotalPosition ==0 and A_GetOpenOrderCount ==0 and o>=MyShortEntryPrice)
{
A_SendOrder(Enum_Sell,Enum_Entry,lots,MyShortEntryPrice - sp * MinMove * PriceScale);
Commentary("空進倉:"+Text(MyShortEntryPrice - sp * MinMove * PriceScale));
SetGlobalVar(11,1);
SetGlobalVar(21,CurrentBar);
}
//空止損1111111111111111111111111111111111111111111111111111111111111111111111111111
if(GetGlobalVar(11)==1 and A_SellPosition >0 and A_GetOpenOrderCount ==0 and CurrentBar-GetGlobalVar(21)>=1
and Q_Last > shortstoplossline[1])
{
A_SendOrder(Enum_buy,Enum_Exit,lots,shortstoplossline[1] + sp * MinMove * PriceScale);
Commentary("空止損:"+Text(shortstoplossline[1] + sp * MinMove * PriceScale));
SetGlobalVar(11,0);
SetGlobalVar(31,CurrentBar);
}
//距離平空倉2222222222222222222222222222222222222222222222222222222222222222222222222
IF(GetGlobalVar(11)==1 and A_SellPosition >0 and A_GetOpenOrderCount ==0 and CurrentBar-GetGlobalVar(21)>=1
AND Q_Last<=ma5 - DistanceFromMA5 * MinMove * PriceScale)
{
A_SendOrder(Enum_buy,Enum_Exit,lots,ma5 - DistanceFromMA5 * MinMove * PriceScale);
Commentary("距離平空倉:"+Text(ma5 - DistanceFromMA5 * MinMove * PriceScale));
SetGlobalVar(11,0);
SetGlobalVar(31,CurrentBar);
}
//空平倉3333333333333333333333333333333333333333333333333333333333333333333333333333
if(GetGlobalVar(11)==1 and A_SellPosition >0 and A_GetOpenOrderCount ==0 and CurrentBar-GetGlobalVar(21)>=1
and Q_Last > MA5
??and CurrentTime*1000000 == Hour*10000 +(Minute+BarInterval-1)*100 + 58)
{
A_SendOrder(Enum_buy,Enum_Exit,lots,Q_Last + sp * MinMove * PriceScale);
Commentary("空平倉MA5:"+Text(Q_Last + sp * MinMove * PriceScale));
SetGlobalVar(11,0);
SetGlobalVar(31,CurrentBar);
}
//平倉BAR不進空倉
if(GetGlobalVar(21)==GetGlobalVar(31))
{conshortopen = FALSE;}
}
end
?
?來源:CXH99.COM
自己先使用fileappend記錄一下相關的信息,然后看一下日志內容能否找到原因 。
?
?
jove99 發(fā)表于 2018-7-9 18:12
哦,好的,謝謝小米;老師,請問下上邊公式你看出什么錯誤沒有?
沒看呢。。一段A函數(shù)的指令,連barstatus==2以及判斷帳戶信息有效這樣的限制條件都沒有的,我覺得沒有什么必要性去看啊。。
而且寫日志是最快捷有效的調試方式,先試試吧。
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯(lián)系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容