Modify an Expert Advisor so it will trade

Работа завершена

Время выполнения 3 минуты
Отзыв от заказчика
I am fairly new to all this and was amazed with the skill and patience from my developer. I will always use him in the future.
Отзыв от исполнителя
Thank you very much!

Техническое задание

I created an EA online through EA Builder.com, but it will not initiate any trades. I keep receiving an error stating:  "OrderSend error #4051 invalid function parameter value" and "invalid lots amount for OrderSend function".I have tried every lot size I can think of, but I still get this same error message.

Here is what I want this EA to be able to do:

1.  I want to be able for it to initiate a trade, long and/or short in the lot size I can specify.

2.  I want to be able to set trading times of day in 30 minute intervals.  For example, I can turn the system on at 4pm and stop initiating trades at 6pm.

3.  That's All!


Here is the current EA that I am using that will not initiate any trades:

//+------------------------------------------------------------------+
//|                                         Strategy: RJS QQE EA.mq4 |
//|                                       Created with EABuilder.com |
//|                                        https://www.eabuilder.com |
//+------------------------------------------------------------------+
#property copyright "Created with EABuilder.com"
#property link      "https://www.eabuilder.com"
#property version   "1.00"
#property description ""

#include <stdlib.mqh>
#include <stderror.mqh>

int LotDigits; //initialized in OnInit
int MagicNumber = 1532634;
extern double TradeSize = 0.1;
int MaxSlippage = 3; //adjusted in OnInit
bool crossed[1]; //initialized to true, used in function Cross
bool Push_Notifications = true;
int MaxOpenTrades = 1;
int MaxLongTrades = 1;
int MaxShortTrades = 1;
int MaxPendingOrders = 1;
int MaxLongPendingOrders = 1;
int MaxShortPendingOrders = 1;
bool Hedging = false;
int OrderRetry = 5; //# of retries if sending order returns error
int OrderWait = 5; //# of seconds to wait if sending order returns error
double myPoint; //initialized in OnInit

bool Cross(int i, bool condition) //returns true if "condition" is true and was false in the previous call
  {
   bool ret = condition && !crossed[i];
   crossed[i] = condition;
   return(ret);
  }

void myAlert(string type, string message)
  {
   if(type == "print")
      Print(message);
   else if(type == "error")
     {
      Print(type+" | RJS QQE EA @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
      if(Push_Notifications) SendNotification(type+" | RJS QQE EA @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
     }
   else if(type == "order")
     {
      Print(type+" | RJS QQE EA @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
      if(Push_Notifications) SendNotification(type+" | RJS QQE EA @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
     }
   else if(type == "modify")
     {
     }
  }

int TradesCount(int type) //returns # of open trades for order type, current symbol and magic number
  {
   int result = 0;
   int total = OrdersTotal();
   for(int i = 0; i < total; i++)
     {
      if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false) continue;
      if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol() || OrderType() != type) continue;
      result++;
     }
   return(result);
  }

int myOrderSend(int type, double price, double volume, string ordername) //send order, return ticket ("price" is irrelevant for market orders)
  {
   if(!IsTradeAllowed()) return(-1);
   int ticket = -1;
   int retries = 0;
   int err = 0;
   int long_trades = TradesCount(OP_BUY);
   int short_trades = TradesCount(OP_SELL);
   int long_pending = TradesCount(OP_BUYLIMIT) + TradesCount(OP_BUYSTOP);
   int short_pending = TradesCount(OP_SELLLIMIT) + TradesCount(OP_SELLSTOP);
   string ordername_ = ordername;
   if(ordername != "")
      ordername_ = "("+ordername+")";
   //test Hedging
   if(!Hedging && ((type % 2 == 0 && short_trades + short_pending > 0) || (type % 2 == 1 && long_trades + long_pending > 0)))
     {
      myAlert("print", "Order"+ordername_+" not sent, hedging not allowed");
      return(-1);
     }
   //test maximum trades
   if((type % 2 == 0 && long_trades >= MaxLongTrades)
   || (type % 2 == 1 && short_trades >= MaxShortTrades)
   || (long_trades + short_trades >= MaxOpenTrades)
   || (type > 1 && type % 2 == 0 && long_pending >= MaxLongPendingOrders)
   || (type > 1 && type % 2 == 1 && short_pending >= MaxShortPendingOrders)
   || (type > 1 && long_pending + short_pending >= MaxPendingOrders)
   )
     {
      myAlert("print", "Order"+ordername_+" not sent, maximum reached");
      return(-1);
     }
   //prepare to send order
   while(IsTradeContextBusy()) Sleep(100);
   RefreshRates();
   if(type == OP_BUY)
      price = Ask;
   else if(type == OP_SELL)
      price = Bid;
   else if(price < 0) //invalid price for pending order
     {
      myAlert("order", "Order"+ordername_+" not sent, invalid price for pending order");
   return(-1);
     }
   int clr = (type % 2 == 1) ? clrRed : clrBlue;
   while(ticket < 0 && retries < OrderRetry+1)
     {
      ticket = OrderSend(Symbol(), type, NormalizeDouble(volume, LotDigits), NormalizeDouble(price, Digits()), MaxSlippage, 0, 0, ordername, MagicNumber, 0, clr);
      if(ticket < 0)
        {
         err = GetLastError();
         myAlert("print", "OrderSend"+ordername_+" error #"+IntegerToString(err)+" "+ErrorDescription(err));
         Sleep(OrderWait*1000);
        }
      retries++;
     }
   if(ticket < 0)
     {
      myAlert("error", "OrderSend"+ordername_+" failed "+IntegerToString(OrderRetry+1)+" times; error #"+IntegerToString(err)+" "+ErrorDescription(err));
      return(-1);
     }
   string typestr[6] = {"Buy", "Sell", "Buy Limit", "Sell Limit", "Buy Stop", "Sell Stop"};
   myAlert("order", "Order sent"+ordername_+": "+typestr[type]+" "+Symbol()+" Magic #"+IntegerToString(MagicNumber));
   return(ticket);
  }

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {  
   //initialize myPoint
   myPoint = Point();
   if(Digits() == 5 || Digits() == 5)
     {
      myPoint *= 10;
      MaxSlippage *= 10;
     }
   //initialize LotDigits
   double LotStep = MarketInfo(Symbol(), MODE_LOTSTEP);
   if(NormalizeDouble(LotStep, 5) == round(LotStep))
      LotDigits = 0;
   else if(NormalizeDouble(10*LotStep, 5) == round(10*LotStep))
      LotDigits = 1;
   else if(NormalizeDouble(100*LotStep, 5) == round(100*LotStep))
      LotDigits = 5;
   else LotDigits = 5;
   int i;
   //initialize crossed
   for (i = 0; i < ArraySize(crossed); i++)
      crossed[i] = true;
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   int ticket = -1;
   double price;  
  
  
   //Open Buy Order, instant signal is tested first
   if(Cross(0, iCustom(NULL, PERIOD_CURRENT, "QQE averages histo + alerts + arrows", 1, 5, 14, 0, 4.236, 70, 30, "Alerts Settings", false, false, true, false, false, false, true, false, "alert2.wav", true, "qqe Arrows1", 1.5, false, DeepSkyBlue, Red, 233, 234, 1, 1, true, DeepSkyBlue, Red, 233, 234, 3, 3, 3, 0) > iCustom(NULL, PERIOD_CURRENT, "QQE averages histo + alerts + arrows", 1, 5, 14, 0, 4.236, 70, 30, "Alerts Settings", false, false, true, false, false, false, true, false, "alert2.wav", true, "qqe Arrows1", 1.5, false, DeepSkyBlue, Red, 233, 234, 1, 1, true, DeepSkyBlue, Red, 233, 234, 3, 3, 4, 0)) //QQE averages histo + alerts + arrows crosses above QQE averages histo + alerts + arrows
   )
     {
      RefreshRates();
      price = Ask;  
      if(IsTradeAllowed())
        {
         ticket = myOrderSend(OP_BUY, price, TradeSize, "");
         if(ticket <= 0) return;
        }
      else //not autotrading => only send alert
         myAlert("order", "");
     }
  }

Откликнулись

1
Разработчик 1
Оценка
(192)
Проекты
232
30%
Арбитраж
1
100% / 0%
Просрочено
9
4%
Свободен
2
Разработчик 2
Оценка
(139)
Проекты
181
24%
Арбитраж
23
22% / 39%
Просрочено
13
7%
Свободен
3
Разработчик 3
Оценка
(167)
Проекты
191
10%
Арбитраж
37
38% / 35%
Просрочено
5
3%
Работает
4
Разработчик 4
Оценка
(190)
Проекты
194
27%
Арбитраж
0
Просрочено
3
2%
Свободен
5
Разработчик 5
Оценка
(188)
Проекты
212
58%
Арбитраж
9
11% / 89%
Просрочено
8
4%
Свободен
6
Разработчик 6
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
7
Разработчик 7
Оценка
(126)
Проекты
151
48%
Арбитраж
6
83% / 17%
Просрочено
2
1%
Свободен
8
Разработчик 8
Оценка
(54)
Проекты
53
17%
Арбитраж
7
0% / 100%
Просрочено
5
9%
Свободен
9
Разработчик 9
Оценка
(33)
Проекты
49
12%
Арбитраж
16
0% / 88%
Просрочено
10
20%
Свободен
10
Разработчик 10
Оценка
(66)
Проекты
143
34%
Арбитраж
11
9% / 55%
Просрочено
26
18%
Работает
11
Разработчик 11
Оценка
(251)
Проекты
402
38%
Арбитраж
82
41% / 20%
Просрочено
70
17%
Работает
12
Разработчик 12
Оценка
(23)
Проекты
45
20%
Арбитраж
24
29% / 42%
Просрочено
12
27%
Работает
13
Разработчик 13
Оценка
(54)
Проекты
73
44%
Арбитраж
21
14% / 67%
Просрочено
8
11%
Свободен
14
Разработчик 14
Оценка
(2398)
Проекты
3011
65%
Арбитраж
76
47% / 14%
Просрочено
340
11%
Работает
15
Разработчик 15
Оценка
(769)
Проекты
1033
44%
Арбитраж
50
8% / 50%
Просрочено
117
11%
Свободен
16
Разработчик 16
Оценка
(21)
Проекты
29
21%
Арбитраж
8
63% / 13%
Просрочено
9
31%
Свободен
17
Разработчик 17
Оценка
(87)
Проекты
114
26%
Арбитраж
7
29% / 57%
Просрочено
5
4%
Свободен
18
Разработчик 18
Оценка
(48)
Проекты
80
28%
Арбитраж
8
75% / 13%
Просрочено
41
51%
Свободен
19
Разработчик 19
Оценка
(7)
Проекты
8
63%
Арбитраж
1
0% / 100%
Просрочено
1
13%
Свободен
20
Разработчик 20
Оценка
(33)
Проекты
46
59%
Арбитраж
0
Просрочено
6
13%
Свободен
21
Разработчик 21
Оценка
(561)
Проекты
928
48%
Арбитраж
301
59% / 25%
Просрочено
123
13%
Загружен
Похожие заказы
I want an Indicator that : Draws vertical lines at the opening of candles on a time frames selected.( I want to be able change the candle timeframe the line will be drawn. Eg. I can slelect 1H, 4H etc from the settings, and the vertical line will be drawn at the opening). Draw a horizontal line at the opening of the candles in the selected timeframe. Calculate the average range of the candles on a selected timeframe
I would need an indicator which makes averages on chart (like the one existing already on mt4 where you can choose between EMA, SMA, ...) but what i need is on chart a button plus and minus which i could press in order to change the average visually on chart( so i dont have to come back in the settings of the indicator each time to introduce a new average number) And average in mt4 is limited basically at 4000 but
Bot name: Blues🚀ProFx The bot should work with the 5mins time frame and it must move with the market price bar when it moves up 5pips and above let 10 trades be opened in the up direction and each having a stop loss of 20pips. After every 5mins if a new candle forms in the same direction let another 10 trades be opened in the same manner. Then when the market trend changes and a bearish candle starts to form and
Hello, I need an EA for both MQL4 and MQL5 that complies with the following rules; A maximum daily drawdown of 4%. This means it should close all trades after a 4% loss and not trade for the rest of the day. It should not use martingale, No grid trading, No trade stacking (opening three or more trades at the same time in the same direction), trades should spends minutes before closing. The EA should also be able to
Hi i need a indicator be turned into forex robot THOSE TWO INDICATORS ARE REVERSAL INDICATORS I WANT THEM TO BE COMBINED BUY ON UPTREND SELL ON DOWNTREND CONTINUE TO OPEN TRADES ACCORDING TO THE TREND USING BUILT-IN RISK 1% OF THE ACCOUNT PARAMETER LOTS SIZE, STOPLOSS THE EA MUST WORK ON EVERYTIME FRAME BE ABLE TO TRADE INDICES, FX PAIRS, COMMODITIES
Hello everyone, I need a simple Hedging EA that won't open opposing trades right away. The key is to avoid Hedging with the aim to lock in a price/spread arbitrage. If you already have a profitable EA that is similar and that has result I would be more than welcome to take a look at it or if you can build one for me I am more than welcome to pay for it. It must be an MT5 EA
Seeking an expert in LSTM (Long Short-Term Memory) for MT4 to implement the most cutting-edge and advanced form of LSTM with full feature integration. The ideal candidate will possess extensive experience in leveraging LSTM technology within MT4, ensuring optimal performance and profitability. Join us in revolutionizing trading strategies with state-of-the-art LSTM algorithms tailored for MT4. Add a zig zag to the
Need an expert to create an EA based on my strategy for any broker,fast execution of opening and closing trade,also with a condition for take profit,lot size isn't fixed,it should be easy to change without editing the code for a no programmer
Hello there, I have a functional EA that I need a modification done to. Previous developer is overloaded with work and has been dragging his feet. Basically what I need is a modification to the Auto Lot option. Currently you can set a lot size per x amount of account balance and it will auto trade readjusting the lots based on account balance. What I am looking for is a modification that allows me to specify the
Please note that my budget is for both mt4 and mt5 platforms The EA should have 1. An option that I can change it parameters, that's the period, method and application 2. The EA should sell when on every bullish candle that closes under the MA 3. The EA should buy on every bearish candle that forms Above the EA. It's should close trades on reverse cross. I mean when it's in a buy trade and crosses the MA for a sell

Информация о проекте

Бюджет
100+ USD
Исполнителю
90 USD
Сроки выполнения
до 1 дн.