tb公式疑問,感謝解答
作者:開拓者 TB 來源:cxh99.com 發布時間:2018年03月28日
-
咨詢內容:
//------------------------------------------------------------------------
// 簡稱: tbhz280
// 名稱:
// 類別: 公式應用
// 類型: 用戶應用
// 輸出:
//------------------------------------------------------------------------
Params
? ? ? ? Numeric Lots(1);
? ? ? ? ? ? ? ? String? ? ? ? Sys("L30");//交易策略標志
? ? ? ? ? ? ? ? Numeric yingxian(7);//上影線長度平倉設置? ? ? ?
? ? ? ? Numeric juliang(279000);//巨量成交平倉設置? ? ? ?
? ? ? ? Numeric rbzy(92);//螺紋止盈點數
Vars
? ? NumericSeries MA5;
? ? ? ? NumericSeries MA60;
? ? ? ? NumericSeries MA120;
? ? ? ? NumericSeries MA25;
? ? ? ? NumericSeries Zhisun;
? ? ? ? NumericSeries Zhiying;? ? ? ?
? ? ? ? Bool Bfangliang;
? ? ? ? Bool Sfangliang;
Begin
? ? MA5 = Average(C,5);
? ? ? ? MA60 = Average(C,60);
? ? ? ? MA120 = Average(C,120);
? ? ? ? MA25 = Average(C,25);
PlotNumeric("MA5",MA5,0,Red);
? ? ? ? PlotNumeric("MA60",MA60,0,Blue);
? ? ? ? PlotNumeric("MA120",MA120,0,Rgb(255,0,255));
? ? ? ? PlotNumeric("MA25",MA25,0,Yellow);
? ? ? ?
? ? ? ? IF((o<=ma25 &&??o<=ma5 ) && ( c > ma5 and c > ma25 )??)
? ? ? ?
? ? ? ? {
? ? ? ?? ???Buy(Lots,o);
? ? ? ? ? ? ? ? ? ? ? ? buyprice = o;
? ? ? ? ? ? ? ? buybar = CurrentBar;
? ? ? ? }
? ? ? ?
IF((o>ma25 &&??o>ma5 ) && ( c < ma5 and c < ma25 ) && MA5<MA25 && MA25>MA60)
? ? ? ?
? ? ? ? {
? ? ? ?? ?? ?SellShort(lots,o);
? ? ? ?? ?? ?sellprice = o;
? ? ? ? ? ? ? ? sellbar = CurrentBar;? ? ? ?
? ? ? ? }
? ? ? ?
? ? ? ?? ???If( h - buyprice>zhiying && CurrentBar>buybar)
? ? ? ? {
? ? ? ? ? ? ? ? Sell(lots,buyprice+zhiying);
? ? ? ? ? ? ? ? Commentary("100點止盈");
? ? }
? ? ? ?
? ? If( sellprice-l>zhiying && CurrentBar>sellbar)
? ? ? ? {
? ? ? ? ? ? ? ? BuyToCover(lots,sellprice-zhiying);
? ? ? ? ? ? ? ? Commentary("100點止盈");
}? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? end//------------------------------------------------------------------------
QQ圖片20170906105507.png
(7.31 KB, 下載次數: 0)
2017-9-6 11:00:49 上傳
?
?來源:CXH99.COM
-
TB技術人員:
比如我的策略運行在1小時K線周期里面,但是我想調用日線周期里面的5日、10日、20日均線,代碼怎么寫