设为首页收藏本站

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

帮写一个模型 [复制链接]

Rank: 1

精华
0
UID
241013
积分
13
帖子
8
主题
4
阅读权限
10
注册时间
2016-9-27
最后登录
2017-6-13
跳转到指定楼层
1#
发表于 2016-10-5 20:22:40 |只看该作者 |倒序浏览
我想要5日均线上穿10日均线为开多信号    最高价回撤3倍ATR为出场平多信号   求帮忙

Rank: 1

精华
0
UID
229723
积分
3
帖子
3
主题
0
阅读权限
10
注册时间
2016-3-11
最后登录
2019-4-19
2#
发表于 2016-10-7 16:17:09 |只看该作者
Params
        //此处添加参数
        Numeric shortlength(5);
        Numeric longlength(10);
        Numeric ATRlength(25);
       

Vars
        //此处添加变量
        NumericSeries MAshort;
        NumericSeries MAlong;
        NumericSeries MAlonger;
        NumericSeries highestprice;
        NumericSeries ATR;
        NumericSeries stopprice;

Begin
        //此处添加代码正文
        MAshort=AverageFC(Close,shortlength);
        MAlong=AverageFC(Close,longlength);
       
        PlotNumeric("5日均线",MAshort);
        PlotNumeric("10日均线",MAlong);
        ATR=AvgTrueRange(ATRlength);
        Commentary(" 3倍波动幅度= "+text(3*ATR));
        If(MAshort[1]>MAlong[1] && close[1]> MAlonger[1])
             {
                  Buy(1,Open);                                  
             }
             
          If(MarketPosition<>0 && BarsSinceEntry==0) highestprice=high;
          If(MarketPosition<>0 && BarsSinceEntry>0) highestprice=max(highestprice,high);                                    
                  
          Commentary(" 入场后最高价格= "+text(highestprice));
          stopprice=highestprice[1]-3*ATR[1];
          Commentary(" 止损价格= "+text(stopprice));
          If(Low<stopprice && BarsSinceEntry>0) sell(0,Min(open,stopprice));
          
End

使用道具 举报

Rank: 1

精华
0
UID
229723
积分
3
帖子
3
主题
0
阅读权限
10
注册时间
2016-3-11
最后登录
2019-4-19
3#
发表于 2016-10-7 16:22:12 |只看该作者
不过哥们,你最近是不是看了《财务自由之路》?这种模型貌似不太好使

使用道具 举报

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

bottom

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

GMT+8, 2024-5-18 16:06

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部