设为首页收藏本站

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

版主这样写在其他公式开仓后能在盈利200跳情况下平仓吗 [复制链接]

Rank: 4

精华
0
UID
38084
积分
323
帖子
71
主题
26
阅读权限
50
注册时间
2011-5-6
最后登录
2022-1-26
跳转到指定楼层
1#
发表于 2013-7-18 00:27:56 |只看该作者 |倒序浏览
If(BarStatus == 0)
      {
          DeleteOrderTickCounter = 9999;
          HasSendOrder = 0;               
          SetGlobalVar(0,DeleteOrderTickCounter);
          SetGlobalVar(1,HasSendOrder);
      }Else
       {
             DeleteOrderTickCounter = GetGlobalVar(0);
             HasSendOrder = GetGlobalVar(1);
        }
       If(BarStatus == 2 && HasSendOrder == 0&&A_GetOpenOrderCount()==0)
       {
                If(A_BuyPosition >0&&High>A_BuyAvgPrice+200*MinPoint) // 平多单
     }
        A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,A_BuyAvgPrice+200*MinPoint);
            }
            If(A_SellPosition > 0&&High>A_SellAvgPrice+200*MinPoint) //平空单
        {
        A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,A_SellAvgPrice+200*MinPoint);
              }
                  HasSendOrder = 1;
        SetGlobalVar(1,HasSendOrder);
      }

Rank: 4

精华
0
UID
38084
积分
323
帖子
71
主题
26
阅读权限
50
注册时间
2011-5-6
最后登录
2022-1-26
2#
发表于 2013-7-18 00:45:09 |只看该作者
在其他策略公式模型有仓位的情况下,能否通过这个公式达到盈利点位平仓吗,
Params
    Numeric offSet(1);                    // 委托价格偏移,为了保证成交
        Numeric Length5(200);  
Vars
    Numeric DeleteOrderTickCounter;
    Numeric HasSendOrder(0);
        Numeric MinPoint;
Begin
    MinPoint= MinMove*PriceScale;
        If(BarStatus==2 && Time==0.091500 && CurrentTime <= 0.091500) return;
    If(BarStatus == 0)
    {
        DeleteOrderTickCounter = 9999;
        HasSendOrder = 0;
        SetGlobalVar(0,DeleteOrderTickCounter);
        SetGlobalVar(1,HasSendOrder);
    }Else
    {
        DeleteOrderTickCounter = GetGlobalVar(0);
        HasSendOrder = GetGlobalVar(1);
    }

     If(BarStatus == 2 && HasSendOrder == 0&&A_GetOpenOrderCount()==0)
       {
                If(A_BuyPosition >0&&High>A_BuyAvgPrice+Length5*MinPoint) // 平多单
            {
                                  A_SendOrder(Enum_Sell,Enum_Exit,offSet,A_BuyAvgPrice+Length5*MinPoint);
            }
                        If(A_SellPosition > 0&&High>A_SellAvgPrice+Length5*MinPoint) //平空单
            {
                              A_SendOrder(Enum_Buy,Enum_Exit,offSet,A_SellAvgPrice+Length5*MinPoint);
            }
            HasSendOrder = 1;
                        SetGlobalVar(1,HasSendOrder);

      }
End

使用道具 举报

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

bottom

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

GMT+8, 2024-5-13 21:56

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部