急救啊,求管理幫忙寫一個SAR,固定15分鐘算一次結果 - TradeBlazer公式 [開拓者 TB]
- 咨詢內容:
一點頭緒沒用啊,求管理幫忙指引一下啊
- TB技術人員:
不明白啥意思
- TB客服:
http://www.tradeblazer.net/forum/thread-17457-1-1.html
- 網友回復:
//------------------------------------------------------------------------
// 簡稱: 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公式修改和重寫的權利
//------------------------------------------------------------------------
看了這個指令,在這個原有基礎上,只做判斷出場規則,進場規則不變可以嗎? - 網友回復:
其實想請教高手幫忙寫一個跨周期的SAR函數,在追漲殺跌置頂帖子中有人提到過,但是追漲殺跌老師沒寫,有高手一起研究一下嗎。
相關文章
-
沒有相關內容