设为首页收藏本站

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

请问这个公式有没有未来函数 [复制链接]

Rank: 1

精华
0
UID
269548
积分
38
帖子
21
主题
11
阅读权限
10
注册时间
2018-9-4
最后登录
2019-11-16
跳转到指定楼层
1#
发表于 2018-9-30 16:40:54 |只看该作者 |倒序浏览
Params
  Numeric K1(50);
  Numeric K2(7);
  Numeric nOffSet(0);
  Numeric stopLossSet(100);

  Vars
  NumericSeries a1;
  NumericSeries a2;
  Numeric MinPoint;  
  Numeric MyEntryPrice;      
  Numeric MyExitPrice;
  Numeric stopLossPoint;
  Numeric offSetDots;
  bool    cross1;
  bool    cross2;

Begin
offSetDots = nOffSet * MinMove * PriceScale;

  a1=Highest(high[1],K1);
  a2=Lowest(low[1],K2);
  
  cross1=CrossOver(high,a1);
  cross2=CrossUnder(low,a2);
  

  
  If(cross1 && MarketPosition<>1)
  {
   Buy(1,a1+offSetDots);      
   }
  If(cross2 && MarketPosition<>-1)
  {
   SellShort(1,a2-offSetDots);      
   }
stopLossPoint = stopLossSet * MinMove * PriceScale;
      
      
        If(MarketPosition == 1)
        {
      
               
                myEntryPrice = AvgEntryPrice;
      
                 If(low <= myEntryPrice - stopLossPoint)
                {
                        myExitPrice = myEntryPrice - stopLossPoint;
                        If(open < myExitPrice) myExitPrice = open;
                        Sell(0,myExitPrice);
                }
        }
        else If (MarketPosition == -1)
        {
      
                myEntryPrice = AvgEntryPrice;
      
                 If(High >= myEntryPrice + stopLossPoint)
                {
                        myExitPrice = myEntryPrice + stopLossPoint;
                        If(open > myExitPrice) myExitPrice = open;
                        BuyToCover(0,myExitPrice);      
                }
        }
      
  
End

Rank: 1

精华
0
UID
265456
积分
2
帖子
2
主题
0
阅读权限
10
注册时间
2018-5-13
最后登录
2018-10-10
2#
发表于 2018-10-6 07:01:46 |只看该作者

cross1=CrossOver(high,a1);
cross2=CrossUnder(low,a2);

high 和 low

使用道具 举报

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

bottom

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

GMT+8, 2024-4-20 09:07

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部