Grid EA with Order expiration

MQL4 专家

工作已完成

执行时间6 天

指定

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-------------------+

反馈

1
开发者 1
等级
(16)
项目
20
0%
仲裁
9
0% / 78%
逾期
6
30%
空闲
2
开发者 2
等级
(33)
项目
35
40%
仲裁
11
9% / 91%
逾期
4
11%
空闲
3
开发者 3
等级
(251)
项目
400
54%
仲裁
9
67% / 22%
逾期
36
9%
空闲
4
开发者 4
等级
(376)
项目
475
40%
仲裁
83
36% / 33%
逾期
13
3%
繁忙
5
开发者 5
等级
(368)
项目
398
70%
仲裁
3
100% / 0%
逾期
2
1%
已载入
6
开发者 6
等级
(298)
项目
442
64%
仲裁
5
40% / 0%
逾期
4
1%
工作中
7
开发者 7
等级
(74)
项目
121
43%
仲裁
12
33% / 50%
逾期
17
14%
空闲
8
开发者 8
等级
(2428)
项目
3057
66%
仲裁
77
48% / 14%
逾期
340
11%
空闲
9
开发者 9
等级
(478)
项目
507
53%
仲裁
10
60% / 20%
逾期
3
1%
空闲
10
开发者 10
等级
(256)
项目
415
38%
仲裁
86
44% / 19%
逾期
70
17%
繁忙
11
开发者 11
等级
(124)
项目
158
42%
仲裁
20
60% / 20%
逾期
8
5%
空闲
12
开发者 12
等级
(11)
项目
16
25%
仲裁
0
逾期
1
6%
空闲
13
开发者 13
等级
(74)
项目
73
47%
仲裁
2
50% / 50%
逾期
2
3%
空闲
14
开发者 14
等级
(563)
项目
932
47%
仲裁
302
59% / 25%
逾期
124
13%
已载入
15
开发者 15
等级
(42)
项目
88
14%
仲裁
30
30% / 53%
逾期
36
41%
工作中
相似订单
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

项目信息

预算
50 - 100 USD
开发人员
45 - 90 USD
截止日期
 1  10 天