好心人 幫幫忙啊
作者:開拓者 TB 來源:cxh99.com 發布時間:2012年12月06日
- 咨詢內容: 老師你好 我有個公式 現在想疊加另外一個品種 比如在糖1301上疊加RU1301 要兩個同時滿足公式中的條件 才開倉糖1301 這個要怎么寫呢?
params
Numeric lots(1); //手數
vars
NumericSeries baramount;
NumericSeries barvol;
numericseries dayavg;
Begin
if(date!=Date[1])
{
baramount=close*Vol;
barvol=vol;
}
else
{
baramount = baramount[1]+close*vol;
barvol = barvol[1]+vol;
}
dayavg = baramount / barvol;
PlotNumeric("DayAvg",dayavg);
if ( time>=0.145900 )
{
if ( close[1]<dayavg[1])
Buy(lots,open);
Else If(close[1]>dayavg[1])
SellShort(lots,Open);
}
{
if( O>C[1] and date!=date[1] and MarketPosition>=1 )
{
sell(0,Open);
Commentary("買入價"+Text(Open));
}Else If( O<C[1] and date!=date[1] and MarketPosition<=-1 )
{
BuyToCover(0,Open);
Commentary("買入價"+Text(Open));
}
}
Commentary("dayavg="+Text(dayavg));
End
- TB技術人員: 在圖表上疊加合約后,在公式里寫上帶有data1數據源的判斷條件。
- TB客服: 不好意思 怎么改呢?我是菜鳥啊 幫我完整的寫出來 謝謝老師
- 網友回復:
陳良利 發表于 2012-9-24 14:44
不好意思 怎么改呢?我是菜鳥啊 幫我完整的寫出來 謝謝老師
新手建議先看看這里http://bbs.tradeblazer.net/thread-16151-1-1.html
- 網友回復: 看了還不會啊 幫我完整的寫出來 謝謝老師