I will write an advisor free of charge - page 157

 
Ivan Butko #:
The previous one, unfortunately, did not fit. I have looked through the codebase and found almost exactly what I need

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);
  }
//+------------------------------------------------------------------+


Please help me make corrections. This EA does not forcefully close the open orders. I would like that along with the time of setting limits we could also set the time of their forced closing.
We need TP and trall to optimize them. A trall, so that all limits would be closed in a small way but collect nightly noise.

Introduced order deletion, timing, setting stops and trawl (taken here https://www.mql5.com/ru/code/32662, same explanation there).

Trailing 2SL
Trailing 2SL
  • www.mql5.com
Трал с двумя уровнями стопа. И с установкой ТП
Files:
Limit.mq4  25 kb
 
How to find out the id
 
Анна Калмыкова #:
How do you find out the id
The id of what?
 
How to withdraw money.
 
Take it off from where?
 
Help me write an EA trading robot. The first lot buy 0.01 or less. If two points are taken, then it is closed and again buy 0.01 two points. If not, then the lot is always doubled and goes the opposite of sell 0.02 for two or three points depending on the rules of trading per point. If not taken, buy 0.04 and closed, if not taken 0.08 and so on up to eight times, i.e. up to 0.128 lot. We always change the direction. If it was taken, again 0,01. ***
 
Do you write EAs for a fee and without discussion on the forum?
 
Lydvik-kaskad #:
Do you write EAs for a fee and without discussion on the forum?

Paid writing service Freelance. Follow the link and read the reference material.

Торговые приложения для MetaTrader 5 на заказ
Торговые приложения для MetaTrader 5 на заказ
  • 2021.10.02
  • www.mql5.com
Самый большой фриланс c разработчиками программ на MQL5
 

Hello, please help.

I need an EA that will look for and show situations on the chart as on the screenshots.

The calculations use a normal SAR parabolic and a normallinear regression channel.

The indicator shows the situations searched for the last 1000 bars.

The descending waves of the parabolic
The indicator calculates the parameters after the change of the parabolic.
For calculation, we take the two waves of the parabolic following one another,
In this case, the descending waves (points above the price).
1) Each wave has the lowest point, wave 1 has point A, wave 2 has point B.
2) The level of point B must be higher than the level of point A.
3) These points are connected by a regression channel and the channel shall be directed downward - this is the
the desired formation.

Parabolic rising waves
The indicator calculates the parameters after the change of the parabolic.
For calculation, two waves of a parabolic following one another are taken,
In this case, the rising waves (points under the price).
1) The highest point of each wave is taken, wave 1 has point A, wave 2 has point B.
2) The level of point B must be lower than the level of point A.
3) These points are connected by a regression channel and the channel must be directed upward - this is the

the desired formation.


I would be very grateful. I can share the entries.

Files:
yxc3e4dpz2.png  64 kb
4cprtquce6.png  62 kb
 
var58 #:

I would be very grateful. I can share the inputs.

Why make fun of ParabolicSAR - it shows the inputs and outputs perfectly as it is.

Screenshot 2021-10-05 114315