獨特的思路,開拓者拋物線轉向交易系統源碼分享[開拓者公式]
- 思路內容: 剛才看到群里討論了會SAR,很多人也想寫一個SAR系統,最近比較忙,利用午飯時間寫了個SAR系統,大家拿去擴充吧
- 原創作品,轉載注明出處 作者 穿堂風 www.tumamayizhan.com
- //------------------------------------------------------------------------
- // 簡稱: SAR_system
- // 名稱:
- // 類別: 公式應用
- // 類型: 用戶應用
- // 輸出: 穿堂風
- //------------------------------------------------------------------------
- Params
- Numeric AfStep(0.02);
- Numeric AfLimit(0.2) ;
- Numeric malen(120);
- Numeric stopLoss(1);
- Numeric BuyLots(1);
- Numeric offset(0);
- Vars
- Numeric oParCl( 0 );
- Numeric oParOp( 0 );
- Numeric oPosition( 0 );
- Numeric oTransition( 0 );
- NumericSeries oParOp_s;
- Numeric oParOp_p;
- Numeric i_offset;
- Numeric ma;
- Bool bUpline;
- string strkey;
- string strValue;
- Numeric i_stopLoss;
- Begin
- ma = Average(Open,malen);
- bUpline = Open>= ma;
- ParabolicSAR( AfStep, AfLimit, oParCl, oParOp, oPosition, oTransition ) ;
- oParOp_s = oParOp;
- oParOp_p = oParOp_s[1];
- i_offset = offset*MinMove*PriceScale;
- i_stopLoss = stopLoss*(OpenD(0)/100);
- Commentary("oParOp:"+Text(oParOp));
- Commentary("oTransition:"+Text(oTransition));
- Commentary("oPosition:"+Text(oPosition));
- If(CurrentBar>malen)
- {
- PlotNumeric("oParCl",oParCl);
- If(malen != 0)
- {
- PlotNumeric("ma",ma);
- }
- If(MarketPosition == 0)
- {
- If(malen == 0)
- {
- bUpline = True;
- }
- If(oTransition == 1 and bUpline)
- {
- Buy(BuyLots,Max(Open,oParOp_p)+i_offset);
- Return;
- }
- If(malen == 0)
- {
- bUpline = False;
- }
- If(oTransition == -1 and bUpline==False)
- {
- SellShort(BuyLots,Min(Open,oParOp_p)-i_offset);
- Return;
- }
- }
- If(MarketPosition == 1)
- {
- If(malen == 0)
- {
- bUpline = False;
- }
- If(LastEntryPrice-Low>=i_stopLoss)
- {
- Sell(BuyLots,Min(Open,LastEntryPrice-i_stopLoss)-i_offset);
- Return;
- }
- If(oPosition == -1)
- {
- If(oTransition == -1 and bUpline==False)
- {
- SellShort(BuyLots,Min(Open,oParOp_p)-i_offset);
- }
- Else
- {
- Sell(BuyLots,Min(Open,oParOp_p)-i_offset);
- }
- }
- }
- If(MarketPosition == -1)
- {
- If(malen == 0)
- {
- bUpline = True;
- }
- If(High-LastEntryPrice>=i_stopLoss)
- {
- BuyToCover(BuyLots,Max(Open,LastEntryPrice+i_stopLoss)+i_offset);
- Return;
- }
- If(oPosition == 1)
- {
- If(oTransition == 1 and bUpline)
- {
- Buy(BuyLots,Max(Open,oParOp_p)+i_offset);
- }
- Else
- {
- BuyToCover(BuyLots,Max(Open,oParOp_p)+i_offset);
- }
- }
- }
- }
- End
- //------------------------------------------------------------------------
- // 編譯版本 GS2010.12.08
- // 用戶版本 2011/09/05 12:21
- // 版權所有 穿堂風
- // 更改聲明 TradeBlazer Software保留對TradeBlazer平臺
- // 每一版本的TrabeBlazer公式修改和重寫的權利
- //------------------------------------------------------------------------
- 因為時間短促,已盡量考慮邏輯性,如果有質疑的地方,一定要細看代碼,我不希望沒分析清楚就說未來函數,這是對我的不尊重.
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 262069696 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容