欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 请高手改写成金字塔下的抛物线转向系统-SAR交易系统

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有2516人关注过本帖平板打印复制链接

主题:请高手改写成金字塔下的抛物线转向系统-SAR交易系统

帅哥哟,离线,有人找我吗?
keke0425
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 昆仑
等级:新手上路 帖子:26 积分:0 威望:0 精华:0 注册:2015/5/12 18:38:21
请高手改写成金字塔下的抛物线转向系统-SAR交易系统  发帖心情 Post By:2015/6/25 15:31:07    Post IP:106.120.13.93[只看该作者]

 

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


 回到顶部