Modify an Expert Advisor so it will trade

MQL4 지표 전문가 Forex

작업 종료됨

실행 시간 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
개발자 2
등급
(139)
프로젝트
181
24%
중재
23
22% / 39%
기한 초과
13
7%
무료
3
개발자 3
등급
(173)
프로젝트
197
12%
중재
39
36% / 33%
기한 초과
5
3%
로드됨
게재됨: 2 코드
4
개발자 4
등급
(243)
프로젝트
249
31%
중재
0
기한 초과
3
1%
무료
게재됨: 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
등급
(69)
프로젝트
146
34%
중재
11
9% / 55%
기한 초과
26
18%
무료
게재됨: 6 코드
11
개발자 11
등급
(288)
프로젝트
464
39%
중재
95
43% / 19%
기한 초과
75
16%
로드됨
게재됨: 2 코드
12
개발자 12
등급
(23)
프로젝트
45
20%
중재
24
29% / 46%
기한 초과
12
27%
무료
13
개발자 13
등급
(59)
프로젝트
81
43%
중재
23
13% / 65%
기한 초과
8
10%
무료
14
개발자 14
등급
(2610)
프로젝트
3302
67%
중재
77
48% / 14%
기한 초과
342
10%
무료
게재됨: 1 코드
15
개발자 15
등급
(772)
프로젝트
1039
44%
중재
50
8% / 50%
기한 초과
116
11%
무료
16
개발자 16
등급
(22)
프로젝트
30
20%
중재
8
63% / 13%
기한 초과
9
30%
무료
17
개발자 17
등급
(87)
프로젝트
114
26%
중재
7
29% / 57%
기한 초과
5
4%
무료
18
개발자 18
등급
(52)
프로젝트
87
25%
중재
8
75% / 13%
기한 초과
44
51%
작업중
19
개발자 19
등급
(7)
프로젝트
8
63%
중재
1
0% / 100%
기한 초과
1
13%
무료
20
개발자 20
등급
(33)
프로젝트
46
59%
중재
0
기한 초과
6
13%
무료
21
개발자 21
등급
(574)
프로젝트
945
47%
중재
304
59% / 25%
기한 초과
125
13%
작업중
비슷한 주문
there is a indicator in trading view i want it to be ea -----------------------order block detector luxalgo------------------------------------- with stop lose and take profit optimzie it to be profitble and trail stop i want it to scan higher time frame and enter in lower time frame and then use trail stop also i want 3 methods grid+martingale regular and double the position every time it lose but it will save the
I am looking to develop a strategy for ORB Breakout.. I would like to use the 3 options in the attached for entering a trade.. ORB High Break(BUY) and ORB Low Break(SELL).. Once the strategy enters the trade.. i need the following to manage the trade.. Provide Trade management options using the Auto Breakeven with offset Function, Trail Profit Target/Stop Loss via - Candle by Candle High/Low or EMA Trail method or
I have an existing MetaTrader Expert Advisor (EA) that is already coded and functional, but I’m looking for a professional to assist with the following tasks: 1. Debugging: Review and fix any coding issues, logic errors, or unexpected behavior. Ensure trade execution, money management, and signal logic function as intended. Verify compatibility and stability across different brokers and symbols. 2. Strategy Testing /
🔹 1. General Logic The EA works across three timeframes: H4 , M30 , and M15 . H4 is the high timeframe and defines market bias. M30 is the medium timeframe for confirmation. M15 is the entry timeframe where trades are executed. 🔹 2. H4 Logic (Zone Creation & Management) 2.1 Pattern Detection Check on every H4 candle close for specific candle patterns: Regular Engulfing Buy (REGULAR_EG_BUY): Two candles: First =
Project goal: Creation of an Expert Advisor (EA) that opens only one BUY trade per day during the US trading session (New York hours). The main idea is to catch a strong breakout to the upside, when the price breaks out from a short range or consolidation formed before the US session. Main objective: The EA should focus on one precise, high-quality BUY entry per day. It must trade only when a clear bullish breakout
//| Function to print info | Initial Deposit Withdrawals Deposits Reset to start over if the account balance drops to $0.00 string InitialDeposit_Str = DoubleToString (return_deposit(), 2 ) + " " + Currency_Str; In MT4, this leads nowhere.( string Withdrawals_Str = "0.00 " + Currency_Str; ) string Deposits_Str = DoubleToString (total_deposits(), 2 ) + " " + Currency_Str; This seems to only be
Développeur 50+ USD
on part d'une stratégie qui se concentre sur la session américaine c'est a dire identifier et racer le plus haut et le plus bas de la bougie qui démarre a 15h30 heure de paris sur l'unité de temps 15min aussi on utilisera deux moyenne mobile exponentiel la EMA (50 et 20) réglé sur une plage horaire fixe 5min et un autre indicateur le supertrende (supertendance) tradingview elle réglé sur la plage horaire fixe de 1h
I need a Pine Script v5 developer who has real experience working with market structure logic (MSS / BOS / continuation sequences). The strategy must: Detect structure shifts internally (no external indicators) Track structure phase: Anchor → Impulse → Pullback → Continuation Use EMA 21 as trend validation Place SL at the pullback and allow configurable TP ratios Include an optional session filter Be delivered as a
i want you to convert my Trading view indicator into mt5 EA bot . This bot will trade on heikin ashi candles only. This is my chandelier exit indicator which u will convert to a mt5 bot
//| Function to print info | Initial Deposit Withdrawals Deposits Reset to start over if the account balance drops to $0.00 string InitialDeposit_Str = DoubleToString (return_deposit(), 2 ) + " " + Currency_Str; In MT4, this leads nowhere.( string Withdrawals_Str = "0.00 " + Currency_Str; ) string Deposits_Str = DoubleToString (total_deposits(), 2 ) + " " + Currency_Str; This seems to only be

프로젝트 정보

예산
100+ USD
개발자에게
90 USD
기한
 1 일