我将免费撰写一份顾问报告 - 页 156

 
Valeriy Yastremskiy #:

如果你想在测试器中观看,你可以把测试的时间移到比实际时间晚的地方。这是在OnInit中。而且我不记得在4ka的测试器中,时间请求是否会准确地返回测试器的时间。我想它会返回当前时间,所以在测试器中,只是一次下单,仅此而已。此外,要求提供本地时间将给出当前的本地时间。

这是在5K的测试器中一个完整的环境模拟器。

谢谢你的澄清

 
不幸的是,之前的那个并不适合。在仔细查看 了代码库后,我几乎找到了我需要的东西

https://www.mql5.com/ru/code/10236

//+------------------------------------------------------------------+
//|                                                    i`lbeback.mq4 |
//|                                Copyright ? 2011, AM2 && Tiburond |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2011, AM2 && Tiburond"
#property link      "http://www.forexsystems.biz"

#define MAGIC  20110406

extern int  StopLoss    = 1300;   //???????? ??????
extern int  StartHour   = 21;     //??? ?????? ????????(???????????? ?????)
extern int  Distance    = 250;    //?????????? ?? ???? ??? ????????? ??????
extern int  Step        = 50;     //??? ????????? ???????
extern int  Count       = 4;      //?????????? ??????????????? ???????
extern int  Expiration  = 4;      //????? ????????? ??????
extern double  Lots     = 1;      //???
extern bool  MM         = true;   //?????????? ???????????????
extern double  TSP      = 5;      //????
extern bool  BU         = true;   //?????????? ?????? ??????? ? ????????? ? ??????? ???
extern int  BUHour      = 2;      //??? ????? ??????? ??????? ??????? ? ?????????

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int  init()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int  deinit()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int  start()
  {
   int  b=0,s=0,res;
   datetime  expiration = TimeCurrent()+3600*Expiration;
   double  BuyPrice=fND(Open[0]-Distance*Point);
   double  SellPrice=fND(Open[0]+Distance*Point);  
   for (int  i=OrdersTotal()-1;i>=0;i--)
     {
      if (OrderSelect(i, SELECT_BY_POS))
        {  
         if (OrderSymbol()!=Symbol() || OrderMagicNumber()!=MAGIC) continue;
         if (OrderType()==OP_BUYLIMIT) b++;
         if (OrderType()==OP_SELLLIMIT) s++;
        }  
     }
   if (Hour()>BUHour && Hour()<StartHour && AllProfit()>0) ClosePositions();
   if (Hour()>BUHour && DayOfWeek() == 5) ClosePositions();  
   if (Hour()==StartHour && b<1 && DayOfWeek() != 5)
   for(i=1;i<=Count;i++)
    {
     {              
      res=OrderSend(Symbol(),OP_BUYLIMIT,fLots(),fND(Ask-(Distance*Point+i*Step*Point)),3,fND(BuyPrice-StopLoss*Point),fND(Open[0]),"",MAGIC,expiration,Blue);      
      Sleep(3000);
      if(res<0)
         {
            Print("??????: ",GetLastError());
         } else {
            RefreshRates();
         }    
     }
    }
        
   if (Hour()==StartHour && s<1 && DayOfWeek() != 5)
   for(i=1;i<=Count;i++)
    {  
     {              
      res=OrderSend(Symbol(),OP_SELLLIMIT,fLots(),fND(Bid+(Distance*Point+i*Step*Point)),3,fND(SellPrice+StopLoss*Point),fND(Open[0]),"",MAGIC,expiration,Red );
      Sleep(3000);
      if(res<0)
         {
            Print("??????: ",GetLastError());
         } else {
            RefreshRates();
         }    
     }
    }    
//----  
   return(0);
  }
//+------------------------------------------------------------------+
double  fND(double  d, int  n=-1)
  {  
   if (n<0) return(NormalizeDouble(d, Digits));
   return(NormalizeDouble(d, n));
  }
//+------------------------------------------------------------------+
double  fLots()
  {
   double  lot=Lots;
   double  lot_min =MarketInfo( Symbol(), MODE_MINLOT  );
   double  lot_max =MarketInfo( Symbol(), MODE_MAXLOT  );
   if (MM)
     {
      double  lot_step =MarketInfo( Symbol(), MODE_LOTSTEP );
      double  lotcost =MarketInfo( Symbol(), MODE_TICKVALUE );      
      double  dollarsPerPip=0.0;

      lot = AccountFreeMargin()*TSP/100.0;
      dollarsPerPip=lot/StopLoss;
      lot=fND(dollarsPerPip/lotcost, 2);      
      lot=fND(lot/lot_step, 0) * lot_step;
     }
   if (lot<lot_min) lot=lot_min;
   if (lot>lot_max) lot=lot_max;
   return(lot);
  }
//+------------------------------------------------------------------+
void  ClosePositions()
  {
   if(BU)
   for (int  i=OrdersTotal()-1;i>=0;i--)
    {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol())
       {
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MAGIC)
          {
            if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, 3, Blue);
            if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red);
          }
         Sleep(1000);
      }
    }
  }
//+------------------------------------------------------------------+
double  AllProfit()
  {
   double  Profit = 0;
   for (int  i=OrdersTotal()-1;i>=0;i--)
    {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != MAGIC) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MAGIC)
         if (OrderType() == OP_BUY || OrderType() == OP_SELL) Profit += OrderProfit();
    }
   return (Profit);
  }
//+------------------------------------------------------------------+


请帮助我进行更正。该EA不会强行关闭未结订单。我希望能够在设置限价的同时设置强制平仓的时间。
,我需要TP和trall来优化它们。一个trall,这样所有的限制都会以一种小的方式关闭,但收集夜间的噪音。
Советник по стратегии "Возврат".
Советник по стратегии "Возврат".
  • www.mql5.com
Ночной скальпер. EURUSD H1.
 
你好。谁能帮我做一个MT4的EA。我需要一个没有任何花招的EA来跟踪手动下单(无论是否有魔法)。如果一个订单在止损时被关闭,EA将在同一方向以指定的手数、SL和TP开立一个新的订单;如果一个订单在止盈时被关闭,EA将在相反方向 以指定的手数、SL和TP 开立一个新的订单 。也许有一些现成的解决方案,我还没能找到任何东西。事先非常感谢。
 
Anton Yakovlev:
如果你有一个好的策略并愿意分享,我可以写一个EA
你好,我需要一个基于蜡烛走势(模式)的指标。是否可以写出来,多少钱,如何通过你的要求。
 
你好!
你能为MT4写一个点子顾问 吗?
战略:
设置2个不同方向的买入限价/卖出限价订单,彼此之间有X个距离,并有止损、止盈、拖累。
比如说。
如果价格触及任何一个限价,并在止损或止盈时关闭此订单,则相反的限价被取消,并再次设置两个不同方向的限价。
EA参数。
地段
停止
拖网
限制间距
魔术
滑坡
 
Ivan Bielyi #:
设置2个不同方向的买入限价/卖出限价订单,其价差限制在

我如何限制限价订单的价差?

 
Evgeny Belyaev #:

那么如何才能限制限价器的价差呢?

我的意思是,比如说如果点差高于5点,那么就不要下挂单,但如果问题太大,你可以跳过这个参数。
 
Ivan Bielyi #:
我的意思是,如果点差高于5点,那么我们不应该下挂单,但如果问题很大,我们可以跳过这个参数。

这有什么意义?他们现在不会被处决(他们是限制)。而当执行的时候,价差将完全不同。

 
Evgeny Belyaev #:

这有什么意义?他们现在不会被处决(他们是限制)。而当执行的时候,价差将完全不同。

哑巴,那么正好没有这个参数)))
 
Daniil Osipov #:
它以什么作为基础,算法有多复杂

确定移动平均趋势

TrendUp := MAvg[1]>TrendUp[1] ? max(Up,TrendUp[1]) : Up