设为首页收藏本站

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

请教怎么样把指标该成指令!!! [复制链接]

Rank: 5Rank: 5

精华
0
UID
219
积分
848
帖子
78
主题
17
阅读权限
60
注册时间
2007-8-29
最后登录
2023-12-4
跳转到指定楼层
1#
发表于 2008-2-24 15:52:08 |只看该作者 |倒序浏览
我想把抛物线指标(sar)改成指令,就是找不到关键点,
ParabolicSAR( AfStep, AfLimit, oParCl, oParOp, oPosition, oTransition ) ;
         这个个东西怎么用??
如果股价曲线在SAR 曲线之上时,开多,
向下跌破转向点便卖出,请管理员来个示范!!!
谢谢了

Rank: 5Rank: 5

精华
0
UID
219
积分
848
帖子
78
主题
17
阅读权限
60
注册时间
2007-8-29
最后登录
2023-12-4
2#
发表于 2008-2-24 15:56:08 |只看该作者
基本框架这么写可以吗???


Params
        Numeric AfStep( 0.02);
        Numeric AfLimit( 0.2 ) ;
        Numeric lots(1);
Vars
        Numeric oParCl( 0 );
        Numeric oParOp( 0 );
        Numeric oPosition( 0 );
        Numeric oTransition( 0 );
Begin
        ParabolicSAR( AfStep, AfLimit, oParCl, oParOp, oPosition, oTransition ) ;
         
        //Buy
          If(ParabolicSAR<Close)
          
          {
          Buy(lots,Close);
          }
          //Sell
          
          if(***)
          {
          Sell(lots.Close)
          }
          
End

使用道具 举报

Rank: 10Rank: 10Rank: 10

精华
11
UID
1
积分
25132
帖子
6291
主题
149
阅读权限
255
注册时间
2007-7-20
最后登录
2024-4-22
3#
发表于 2008-2-24 16:02:48 |只看该作者
  1. //------------------------------------------------------------------------
  2. // 简称: SARTrader
  3. // 名称: 抛物线交易系统
  4. // 类别: 交易指令
  5. // 类型: 多头建仓
  6. // 输出:
  7. //------------------------------------------------------------------------
  8. Params
  9.         Numeric AfStep( 0.02);
  10.         Numeric AfLimit( 0.2 );
  11.         Numeric StopPoint(6);
  12. Vars
  13.         NumericSeries SARValue;
  14.         Numeric MyPrice;
  15.         Numeric oParCl( 0 );  
  16.         Numeric oParOp( 0 );
  17.         Numeric oPosition( 0 );
  18.         Numeric oTransition( 0 );
  19. Begin
  20.         ParabolicSAR( AfStep, AfLimit, oParCl, oParOp, oPosition, oTransition );
  21.         SARValue = oParCl;
  22.         If(MarketPosition!=0)
  23.         {
  24.                 If(Time >= 0.1458 && Time < 0.1500)
  25.                 {
  26.                         Sell(1,Close);
  27.                         BuyToCover(1,Close);
  28.                         Return;
  29.                 }
  30.                
  31.                 If(MarketPosition == 1 && Low <= AvgEntryPrice-StopPoint*MinMove*PriceScale)
  32.                 {
  33.                         MyPrice = AvgEntryPrice-StopPoint*MinMove*PriceScale;
  34.                         Sell(1,MyPrice);
  35.                 }
  36.                
  37.                 If(MarketPosition == -1 && High >= AvgEntryPrice+StopPoint*MinMove*PriceScale)
  38.                 {
  39.                         MyPrice = AvgEntryPrice+StopPoint*MinMove*PriceScale;
  40.                         BuyToCover(1,MyPrice);
  41.                 }
  42.         }
  43.        
  44.         If(MarketPosition !=1 && CrossOver(Close,SARValue))
  45.         {
  46.                 Buy(1,Close);
  47.         }
  48.        
  49.         If(MarketPosition !=-1 && CrossUnder(Close,SARValue))
  50.         {
  51.                 SellShort(1,Close);
  52.         }
  53. End

  54. //------------------------------------------------------------------------
  55. // 编译版本 GS2004.06.12
  56. // 用户版本 2008/02/15 15:59
  57. // 版权所有 tradeblazer
  58. // 更改声明 TradeBlazer Software保留对TradeBlazer平台
  59. // 每一版本的TrabeBlazer公式修改和重写的权利
  60. //------------------------------------------------------------------------
复制代码
交易开拓者 - 期货程序化与量化系统自动交易领航者

网站已支持在线开通模拟账户功能

使用道具 举报

Rank: 2

精华
0
UID
1641
积分
100
帖子
19
主题
11
阅读权限
30
注册时间
2008-5-21
最后登录
2010-10-4
4#
发表于 2008-5-23 10:20:28 |只看该作者

回复 #3 tradeblazer 的帖子

我如何限制他只开多仓,不开空仓

使用道具 举报

Rank: 5Rank: 5

精华
0
UID
1196
积分
1403
帖子
65
主题
0
阅读权限
60
注册时间
2008-2-19
最后登录
2008-8-11
5#
发表于 2008-5-23 10:47:48 |只看该作者
Params
        Numeric AfStep( 0.02);
        Numeric AfLimit( 0.2 );
        Numeric StopPoint(6);
Vars
        NumericSeries SARValue;
        Numeric MyPrice;
        Numeric oParCl( 0 );  
        Numeric oParOp( 0 );
        Numeric oPosition( 0 );
        Numeric oTransition( 0 );
Begin
        ParabolicSAR( AfStep, AfLimit, oParCl, oParOp, oPosition, oTransition );
        SARValue = oParCl;
        If(MarketPosition==1)
        {
                If(Time >= 0.1458 && Time < 0.1500)
                {
                        Sell(1,Close);
                        Return;
                }
               
                If(MarketPosition == 1 && Low <= AvgEntryPrice-StopPoint*MinMove*PriceScale)
                {
                        MyPrice = AvgEntryPrice-StopPoint*MinMove*PriceScale;
                        Sell(1,MyPrice);
                }
        }
        
        If(MarketPosition ==0 && CrossOver(Close,SARValue))
        {
                Buy(1,Close);
        }
End

使用道具 举报

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

bottom

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

GMT+8, 2024-5-16 07:23

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部