设为首页收藏本站

 找回密码
 注册
查看: 3554|回复: 6
打印 上一主题 下一主题

急救啊,求管理帮忙写一个SAR,固定15分钟算一次结果 [复制链接]

Rank: 3Rank: 3

精华
0
UID
86748
积分
141
帖子
30
主题
9
阅读权限
40
注册时间
2011-12-15
最后登录
2019-4-1
跳转到指定楼层
1#
发表于 2012-1-18 12:47:30 |只看该作者 |倒序浏览
一点头绪没用啊,求管理帮忙指引一下啊
截断亏损,让利润奔跑

Rank: 5Rank: 5

精华
0
UID
85182
积分
849
帖子
302
主题
11
阅读权限
60
注册时间
2011-12-8
最后登录
2013-10-28
2#
发表于 2012-1-18 13:17:29 |只看该作者
不明白啥意思
http://qpic.cn/NifLLplMk若能一切随它去,便世间自在人。
      ---Derivatives

使用道具 举报

Rank: 8Rank: 8

精华
0
UID
17581
积分
5464
帖子
275
主题
27
阅读权限
100
注册时间
2010-10-13
最后登录
2021-8-30
3#
发表于 2012-1-18 13:34:31 |只看该作者

使用道具 举报

Rank: 3Rank: 3

精华
0
UID
86748
积分
141
帖子
30
主题
9
阅读权限
40
注册时间
2011-12-15
最后登录
2019-4-1
4#
发表于 2012-1-18 13:48:53 |只看该作者
//------------------------------------------------------------------------
// 简称: 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公式修改和重写的权利
//------------------------------------------------------------------------
看了这个指令,在这个原有基础上,只做判断出场规则,进场规则不变可以吗?
截断亏损,让利润奔跑

使用道具 举报

Rank: 3Rank: 3

精华
0
UID
86748
积分
141
帖子
30
主题
9
阅读权限
40
注册时间
2011-12-15
最后登录
2019-4-1
5#
发表于 2012-1-18 13:54:42 |只看该作者
其实想请教高手帮忙写一个跨周期的SAR函数,在追涨杀跌置顶帖子中有人提到过,但是追涨杀跌老师没写,有高手一起研究一下吗。
截断亏损,让利润奔跑

使用道具 举报

Rank: 1

精华
0
UID
34588
积分
33
帖子
22
主题
0
阅读权限
10
注册时间
2011-4-22
最后登录
2012-8-11
6#
发表于 2012-7-3 23:14:21 |只看该作者
支持下。。。

使用道具 举报

Rank: 3Rank: 3

精华
0
UID
98132
积分
186
帖子
82
主题
4
阅读权限
40
注册时间
2012-2-16
最后登录
2016-2-4
7#
发表于 2012-7-14 19:30:08 |只看该作者
kspdjm 发表于 2012-1-18 13:48
//------------------------------------------------------------------------
// 简称: SAR_system
// 名 ...

如将原码导入却居然无法按SAR指标买卖,是否有问题?

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-4-20 10:28

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部