天猫首页
当前位置: 首页 > 高盈利外汇EA > 关闭运行中的订单同时开新的反向订单

浏览历史

关闭运行中的订单同时开新的反向订单
prev zoom next

关闭运行中的订单同时开新的反向订单

  • 本店售价:¥3999元 ¥5999元
  • 商品货号:ECS009614
  • 商品库存: 11111
  • 上架时间:2023-10-13
  • 商品点击数:8

商品描述

商品属性

商品标签

相关商品

ea没有参数。直接根据持仓来下反向订单。

比如持仓有1手欧美多单,那么运行这个ea就平掉欧美多单,同时下欧美空单。


//+------------------------------------------------------------------+

//|                                            Close and Reverse.mq4 |

//|                                      Copyright ?2006, Eli Hayun |

//|                                          http://www.elihayun.com |

//+------------------------------------------------------------------+

#property copyright "Copyright ?2006, Eli Hayun"

#property link      "http://www.elihayun.com"


//+------------------------------------------------------------------+

//| Close the running orders and open to an opposite direction                                    |

//+------------------------------------------------------------------+

int start()

  {

//----

      string curr = Symbol();

      int ot = OrdersTotal();

      int ords[200], ordType[200], ordTicket[200]; double ordLots[200];

      string ordComments[200];

      int ix=0;

      for (int i=0; i<ot; i++)

      {

         int o = OrderSelect(i, SELECT_BY_POS);

         if (OrderSymbol() == Symbol())

            if ((OrderType() == OP_BUY) || (OrderType() == OP_SELL))

            {

               ords[ix] = o; ordType[ix] = OrderType(); 

               ordLots[ix] = OrderLots(); ordTicket[ix] = OrderTicket();

               ordComments[ix] = OrderComment();

               ix++;

            }

      }

      

      for (i=0; i<ix; i++)

      {

         

         double ask = MarketInfo(Symbol(), MODE_ASK);

         double bid = MarketInfo(Symbol(), MODE_BID);

         double prc = 0;

         

         if (ordType[i] == OP_BUY) prc = bid; else prc=ask;

         OrderSelect(ords[i], SELECT_BY_POS);

         Print("Closing Order # ",ords[i]);

         OrderClose(ordTicket[i], ordLots[i],prc,5);

         Print("Error ",GetLastError());

      }

      

      for (i=0; i<ix; i++)

      {

          ask = MarketInfo(Symbol(), MODE_ASK);

          bid = MarketInfo(Symbol(), MODE_BID);

          prc = 0;

         

         int op = ordType[i]; if (op == OP_BUY) { op = OP_SELL; prc = bid;} else { op = OP_BUY; prc=ask;}

         OrderSend(Symbol(), op, ordLots[i], prc,5,0,0,ordComments[i]+"[Rev]"); 

      }

//----

   return(0);

  }

//+------------------------------------------------------------------+




已售:0
商品属性
[]

商品标签

购买记录(近期成交数量0)

还没有人购买过此商品
总计 0 个记录,共 1 页。 第一页 上一页 下一页 最末页

用户评论(共0条评论)

  • 暂时还没有任何用户评论
总计 0 个记录,共 1 页。 第一页 上一页 下一页 最末页
用户名: 匿名用户
E-mail:
评价等级:
评论内容:
验证码: captcha
在线咨询