Grid EA with Order expiration

MQL4 Uzman Danışmanlar

İş tamamlandı

Tamamlanma süresi: 6 gün

İş Gereklilikleri

I have a grid order EA with code. I need EA to close pending orders after 5 minutes. So if orders with magic number 1 open at 00:00, pending orders with magic number 1 are delete at 00:005


See code below


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

//--External variables

extern int    MagicNumber       = 1;//Magic number

extern string EaComment         = "Grid_Template";//Order comment

extern double StaticLot         = 0.01;//Static lots size

extern bool   MM                = false;//Money Management

extern int    Risk              = 2;//Risk %

extern double TakeProfit        = 20.;//Take Profit in pips

extern double StopLoss          = 10.;//Stop loss in pips

extern double PriceDistance     = 15.;//Distance from price in pips

extern double GridStep          = 15.;//Step between grid orders in pips

extern int    GridOrders        = 2;//Amount of grid orders

extern int    PendingExpiration = 15;//Pending expiration after xx minutes

//--Internal variables

double PriceB,PriceS,StopB,StopS,

       TakeB,TakeS,_points,PT,Lots;

int LotDigits;

datetime _e = 0;

int Ticket  = 0;

//--

int OnInit()

  {

//--Determine digits

   _points=MarketInfo(Symbol(),MODE_POINT);

//--

   if(Digits==5 || Digits==3)

      PT = _points*10;

   else

      PT = _points;

//--

   return(INIT_SUCCEEDED);

  }

//--

void OnDeinit(const int reason)

  {


  }

//--

void OnTick()

  {

//If trade allowed and no positions exists by any chart - open a new set of grid orders

   if(IsTradeAllowed() && !IsTradeContextBusy())

     {

      if(PosSelect()==0)

        {

         GridPos(PriceDistance,TakeProfit,StopLoss);//Place grid

        }

      return;

     }

  }

///////////////////////////////////////////////////////////

//Grid order send function

void GridPos(double _Dist,double _Take,double _Stop)

  {

   int i;

   _e=TimeCurrent()+PendingExpiration*60;

//--

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

     {

      PriceB = NormalizeDouble(Ask+(_Dist*PT)+(i*GridStep*PT),Digits);

      TakeB  = PriceB + _Take * PT;

      StopB  = PriceB - _Stop * PT;

      Ticket=OrderSend(Symbol(),OP_BUYSTOP,LotSize(),PriceB,3,StopB,TakeB,EaComment,MagicNumber,_e,Green);

      //--

      PriceS = NormalizeDouble(Bid-(_Dist*PT)-(i*GridStep*PT),Digits);

      TakeS  = PriceS - _Take * PT;

      StopS  = PriceS + _Stop * PT;

      Ticket=OrderSend(Symbol(),OP_SELLSTOP,LotSize(),PriceS,3,StopS,TakeS,EaComment,MagicNumber,_e,Red);

     }

   if(Ticket<1)

     {

      Print("Order send error - errcode: ",GetLastError());

      return;

     }

   else

     {

      Print("Grid placed successfully!");

     }

   return;

  }

//////////////////////////////////////////////////////////

//PositionSelector - Determines open positions

int PosSelect()

  {

   int posi=0;

   for(int k = OrdersTotal() - 1; k >= 0; k--)

     {

      if(!OrderSelect(k, SELECT_BY_POS))

        {

         Print("Order pos selection failed - errcode: ",GetLastError());

        }

      if(OrderSymbol()!=Symbol()&&OrderMagicNumber()!=MagicNumber)

        {

         continue;

        }

      if(OrderCloseTime() == 0 && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)

        {

         if(OrderType() == OP_BUY)

            posi = 1; //Long position

         if(OrderType() == OP_SELL)

            posi = -1; //Short positon

         if(OrderType() == OP_BUYSTOP)

            posi = 1; //Pending Long position

         if(OrderType() == OP_SELLSTOP)

            posi = -1; //Pending Short positon

        }

     }

   return(posi);

  }

////////////////////////////////////////////////////////////

//Lots size calculation

double LotSize()

  {

   if(MM == true)

     { Lots = MathMin(MathMax((MathRound((AccountFreeMargin()*Risk/1000/100)

       /MarketInfo(Symbol(),MODE_LOTSTEP))*MarketInfo(Symbol(),MODE_LOTSTEP)),

       MarketInfo(Symbol(),MODE_MINLOT)),MarketInfo(Symbol(),MODE_MAXLOT));}

   else

     {

      Lots = MathMin(MathMax((MathRound(StaticLot/MarketInfo(Symbol(),MODE_LOTSTEP))*MarketInfo(Symbol(),MODE_LOTSTEP)),

      MarketInfo(Symbol(),MODE_MINLOT)),MarketInfo(Symbol(),MODE_MAXLOT));

     }


   return(Lots);

  }

//+----------------End of Temi's Trader EA-------------------+

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(16)
Projeler
20
0%
Arabuluculuk
9
0% / 78%
Süresi dolmuş
6
30%
Serbest
2
Geliştirici 2
Derecelendirme
(33)
Projeler
35
40%
Arabuluculuk
11
9% / 91%
Süresi dolmuş
4
11%
Serbest
3
Geliştirici 3
Derecelendirme
(251)
Projeler
400
54%
Arabuluculuk
9
67% / 22%
Süresi dolmuş
36
9%
Serbest
4
Geliştirici 4
Derecelendirme
(376)
Projeler
475
40%
Arabuluculuk
83
36% / 33%
Süresi dolmuş
13
3%
Meşgul
5
Geliştirici 5
Derecelendirme
(368)
Projeler
398
70%
Arabuluculuk
3
100% / 0%
Süresi dolmuş
2
1%
Yüklendi
6
Geliştirici 6
Derecelendirme
(298)
Projeler
442
64%
Arabuluculuk
5
40% / 0%
Süresi dolmuş
4
1%
Çalışıyor
7
Geliştirici 7
Derecelendirme
(74)
Projeler
121
43%
Arabuluculuk
12
33% / 50%
Süresi dolmuş
17
14%
Serbest
8
Geliştirici 8
Derecelendirme
(2428)
Projeler
3057
66%
Arabuluculuk
77
48% / 14%
Süresi dolmuş
340
11%
Serbest
9
Geliştirici 9
Derecelendirme
(478)
Projeler
507
53%
Arabuluculuk
10
60% / 20%
Süresi dolmuş
3
1%
Serbest
10
Geliştirici 10
Derecelendirme
(256)
Projeler
415
38%
Arabuluculuk
86
44% / 19%
Süresi dolmuş
70
17%
Meşgul
11
Geliştirici 11
Derecelendirme
(124)
Projeler
158
42%
Arabuluculuk
20
60% / 20%
Süresi dolmuş
8
5%
Serbest
12
Geliştirici 12
Derecelendirme
(11)
Projeler
16
25%
Arabuluculuk
0
Süresi dolmuş
1
6%
Serbest
13
Geliştirici 13
Derecelendirme
(74)
Projeler
73
47%
Arabuluculuk
2
50% / 50%
Süresi dolmuş
2
3%
Serbest
14
Geliştirici 14
Derecelendirme
(563)
Projeler
932
47%
Arabuluculuk
302
59% / 25%
Süresi dolmuş
124
13%
Yüklendi
15
Geliştirici 15
Derecelendirme
(42)
Projeler
88
14%
Arabuluculuk
30
30% / 53%
Süresi dolmuş
36
41%
Çalışıyor
Benzer siparişler
I am seeking an experienced MQL5 developer to create a user-friendly manual Grid Trading Expert Advisor (EA) with the following key features: Dynamic Grid Trading: Adjustable Grid Distance: Traders can manually input grid distance in pips via an intuitive, movable table. Take Profit Management: Fixed TP for the initial positions (e.g., first 5 trades). Stop-Loss (Optional): Traders can choose to use a stop-loss with
I want have the possibility to increase lotsize not alone by Lot-multiplier rather I want add a fix-lot increase for excample for 0,05 lot. I want have this for buy / sell and hedge-buy and hedge sell
Hi, I want to make an automated system to take my place in making trading positions and closing it. But I want to ask , can you program it to draw a trend line in a specific chart and several moving averages should be in specific order, and when the price is near the trend line by few pips, we shift to 15 minutes chart and noticing a resistance or support action , then we take the trade ? can we do that
Develop EA to track performance metrics of strategies I would like to develop an EA that will track the performance metrics of the strategies I have running on a terminal, If any of the metrics start to under perform then the EA/Indictor should alert me with a pop up alert that specify's the metric that has triggered the alert. The EA should also display the metrics in a dashboard - please see my example screen shot
I would like to modify the RSI Epert Avisor with a developer. I would like to use the RSI Expert on the inverse mode and the base setting doesnt conatain this strategy mode
Profitable EA HFT 50 - 300 USD
From a long time i am searching for a profitable EA i have lost a lot , and now i have only 300$ to buy a profitable EA , i wish to say with 0 losses but some or most traders they don't want to hear this i am really tired of searching for a programmer to just create me a profitable EA with the least losses or zero losses maybe nearly 1 year i am searching i just need an HFT EA that can work very well on MT4,MT5
I need help fixing my EA for MT5. It’s a very simple EA, and I currently cannot solve an issue where webrequest communicates with OpenAi API without error. Please only apply if you can help solve this issue
у нас есть стратегия, нам нужно написать mql5-код ​​для тестера стратегий МТ5,Цена договорная. Мой контакт @abbosaliyev из Telegram Программист должен знать РУССКИЙ ИЛИ УЗБЕКСКИЙ язык. Задание: разработать тестер, который использует шаблон условий на открытие и проверит весь исторический график на всех доступных таймфреймах. Остальная информация будет предоставлена ​​после согласования цены
a coder is required to add an indicator to existing ea The new indicator will work as 1. option to combine with exiting indicator to open trade 2. it will be used as alternative BE point 3. It can also be used to close order or combine with other to close trade The second Job is telegram bot to get alert fr news trade and others Details when you apply i will test the ea work on live market and all bug is fixed before
Hello, I want to make an EA based on SMC and a developer that is familiar with the concept and full understanding of this. Must have done similar jobs before and be able show it. I only want to work with developer that has good track record and is precise. Further information will be handed when contact is made. Developers that has zero rating will not be considered. Listed price is a base point. The project can also

Proje bilgisi

Bütçe
50 - 100 USD
Geliştirici için
45 - 90 USD
Son teslim tarihi
from 1 to 10 gün