Alteration to EA | Placing a pending order with a button push.

MQL4 Indicatori Esperti Forex

Lavoro terminato

Tempo di esecuzione 1 minuto
Feedback del dipendente
Thank you!
Feedback del cliente
Very quick, professional, an definitely worth the money. :)

Specifiche

I have an EA which is supposed to place a pending order with the push of a button, & an execution price at the open of the current bar.

The button functions works perfectly, the parameters within the pending order work flawlessly, the dynamic pricing displayed in button which changed on every tick is perfect. 

However, when I push the button to initiate a pending order, sometimes nothing happens. It prints a "success" message into the Journal, but no Pending order appears in the ledger. Other times, it places a pending order with no problem.

Whenever I use this on a new chart, the prices are not updated either. The execution prices is some random price. I even changed the chart from the EURUSD to the EURJPY - completely different pricing structure, and it as telling me that the entry price on the pending order for the EURJPY was a price formatted to a 5 decimal place price.  I have tried refresh rates, but to no avail. See illustration for case in point.

   Incorrect Pricing in Ledger

Here is my coding, and I have also attached the files if you wanted to recreate this as well.

I need someone who can alter the code to ensure that I do not get sporadic prices, and that it actually places a pending order every time, and not just it feels like it. 

//+------------------------------------------------------------------+
//|                                                      manStat.mqh |
//|                        Copyright 2022, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property strict

#include <global_declarations.mqh> 


void manualStaticButtons(){

currentBid     =  Bid;
currentAsk     =  Ask;
currentSpread  =  sqrt(MathPow((currentBid - currentAsk)/Point,2)); 

ObjectCreate(0,"manBuy",OBJ_BUTTON,0,0,0); 
        
   ObjectSetInteger(0,"manBuy",OBJPROP_XDISTANCE,880);
   
      ObjectSetInteger(0,"manBuy",OBJPROP_YDISTANCE,580);
      
         ObjectSetInteger(0,"manBuy", OBJPROP_YSIZE, 40);
         
            ObjectSetInteger(0,"manBuy", OBJPROP_XSIZE, 200);
      
               ObjectSetInteger(0,"manBuy", OBJPROP_CORNER,CORNER_LEFT_UPPER);
      
                  ObjectSetInteger(0,"manBuy", OBJPROP_COLOR,clrWhite);
                                                            
                     ObjectSetInteger(0,"manBuy", OBJPROP_FONTSIZE,10);
               
                        ObjectSetInteger(0,"manBuy", OBJPROP_BGCOLOR,clrGreen);
                        
                           ObjectSetString(0,"manBuy", OBJPROP_TEXT,"Market Order "+DoubleToString(currentBid,Digits)); 
                           
                              ObjectSetInteger(0,"manBuy",OBJPROP_STATE,false); 
                        
                           
                     
                     
ObjectCreate(0,"manSell",OBJ_BUTTON,0,0,0); 
        
   ObjectSetInteger(0,"manSell",OBJPROP_XDISTANCE,1150);
   
      ObjectSetInteger(0,"manSell",OBJPROP_YDISTANCE,580);
      
         ObjectSetInteger(0,"manSell", OBJPROP_YSIZE, 40);
         
            ObjectSetInteger(0,"manSell", OBJPROP_XSIZE, 200);
      
               ObjectSetInteger(0,"manSell", OBJPROP_CORNER,CORNER_LEFT_UPPER);
      
                  ObjectSetInteger(0,"manSell", OBJPROP_COLOR,clrWhite);
                                                            
                     ObjectSetInteger(0,"manSell", OBJPROP_FONTSIZE,10);
               
                        ObjectSetInteger(0,"manSell", OBJPROP_BGCOLOR,clrRed);
                        
                           ObjectSetString(0,"manSell", OBJPROP_TEXT,"Market Order "+DoubleToString(currentAsk,Digits));
                           
                              ObjectSetInteger(0,"manSell",OBJPROP_STATE,false); 
                               
                                              
ObjectCreate(0,"spread",OBJ_LABEL,0,0,0); 
        
   ObjectSetInteger(0,"spread",OBJPROP_XDISTANCE,1105);
   
      ObjectSetInteger(0,"spread",OBJPROP_YDISTANCE,585);
      
         ObjectSetInteger(0,"spread", OBJPROP_YSIZE, 40);
         
            ObjectSetInteger(0,"spread", OBJPROP_XSIZE, 60);
      
               ObjectSetInteger(0,"spread", OBJPROP_CORNER,CORNER_LEFT_UPPER);
      
                  ObjectSetInteger(0,"spread", OBJPROP_COLOR,clrBlack);
                                                            
                     ObjectSetInteger(0,"spread", OBJPROP_FONTSIZE,20);
               
                        ObjectSetString(0,"spread", OBJPROP_TEXT,DoubleToString(currentSpread,0)); 

}
//+------------------------------------------------------------------+
//|                                                         demo.mq4 |
//|                        Copyright 2022, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

#include <manStat.mqh>
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int      pendingExpiration          = Period() * 60;
double   candleOpenPrice            = iOpen(NULL,0,0);
double   pendingOrderExecPrice      = NormalizeDouble(candleOpenPrice,Digits); 
datetime candleOpenTime             = Time[0];
string   pendingError               = IntegerToString(GetLastError(),0);


int OnInit()
  {

   return(INIT_SUCCEEDED);
  }

void OnTick()
  {

   manualStaticButtons();


   
  }
  
void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam){

   lastErrorCode = IntegerToString(GetLastError());
            
      if(id == CHARTEVENT_OBJECT_CLICK){
      
         if(sparam == "manBuy"){
         
            RefreshRates();
         
            if(!OrderSend(Symbol(),OP_BUYSTOP,1,pendingOrderExecPrice,0,0,0,NULL,1,candleOpenTime + pendingExpiration,clrNONE)){
                  
               Print("Error "+pendingError); 

            }
               
            else {
                     
               Print("Success");

            }
            
         }
         
         if(sparam == "manSell"){
         
            RefreshRates();
            
               if(!OrderSend(Symbol(),OP_SELLSTOP,LotSize,pendingOrderExecPrice,0,0,0,NULL,1,candleOpenTime + pendingExpiration,clrNONE)){
                                                                  
                  Print("Error "+pendingError);  
               
               } else {
                   
                   Print("Success");      
   
               }

         }
         
         
      }
  
}


File:

MQH
manStat.mqh
3.3 Kb
MQ4
demo.mq4
2.3 Kb
EX4
demo.ex4
24.5 Kb

Con risposta

1
Sviluppatore 1
Valutazioni
(258)
Progetti
269
29%
Arbitraggio
2
50% / 0%
In ritardo
3
1%
In elaborazione
Pubblicati: 2 codici
2
Sviluppatore 2
Valutazioni
(298)
Progetti
427
26%
Arbitraggio
18
61% / 33%
In ritardo
26
6%
Gratuito
Pubblicati: 8 codici
Ordini simili
EA 35+ USD
Project Title: Development of a Custom Breakout Expert Advisor (EA) with Dynamic Trailing Stop, Advanced Security Filters, and On-Screen Dashboard for MT5 Project Description: Overview: I am looking for an experienced MQL5 developer to build a fully automated Trading Robot (Expert Advisor) for MetaTrader 5 based on a pending orders breakout strategy with strict dynamic risk management and customized time/profit
I need a TradingView Pine Script (v6) indicator that gives BUY and SELL signals in real time on the live chart. MAIN REQUIREMENT – NO REPAINTING: 1. Signals must appear only when the candle closes (barstate.isconfirmed). Example: on 1-min chart, signal for the 10:35 candle must appear at 10:36 and never disappear or move. 2. Signals on historical bars must look exactly the same as they looked live. 3. No lookahead
Robottrader 30+ USD
choose this app is good app to trader with, am trader start used this app is good to choose when look for app that can trader for you to get some money
Project Title: Development of a Custom Breakout Expert Advisor (EA) with Dynamic Trailing Stop and On-Screen Dashboard for MT5 Project Description: Overview: I am looking for an experienced MQL5 developer to build a fully automated Trading Robot (Expert Advisor) for MetaTrader 5 based on a pending orders breakout strategy with strict dynamic risk management. The EA must be highly optimized, bug-free, and follow the
I am looking for an experienced developer to build a professional web-based trading performance dashboard connected to an MT5 trading account and/or FX Blue. The dashboard should automatically collect trading data and display: • Daily P&L calendar – profitable days green, losing days red and no-trade days grey • Equity/growth curve • Drawdown curve • Initial capital and current balance • Net profit and percentage
Hi, I’m looking for an experienced MQL5 developer to convert my TradingView Pine Script into an MT5 EA. Here are the main requirements: **MBS BREAKOUT** * Buy when price breaks the Green Line * Sell when price breaks the Red Line **TIMEFRAMES** * Strategy 1 = M1 * Strategy 2 = M5 * Strategy 3 = M15 * Strategy 4 = M30 * Strategy 5 = H1 * Strategy 6 = H4 * Strategy 7 = D1 * Strategy 8 = W1 * Strategy 9 = MN1 Each
SUPER SCALPING 30+ USD
I WISH TO BUILD A ROBOT THAT CAN FIND BREAKOUTS ON 15MIN CHARTS, STARTING WITH THE WAVE 3 ON ELLIO WAVE ANALYSIS, ONCE IS PROFITABLE ENOUGH WILL OPEN A SECOND TRADE AFTER THE FIRST PULL BACK AND SET THE TP OF THE FIRST TRADE WITH THE SL OF THE SECOND TRADE IN A WAY TO GAIN A MINIMUM PROFIT OF 10 DOLLARS OR MORE, IF THE THIRD PULL BACK HAPPENS ANOTHER TRADE WILL BE PLACED MOVING ALL TP AND SL IN SUCH A WAY THAT THE
I am looking for someone with strong experience using QuantAnalyzer, StrategyQuant Portfolio Master, or a similar portfolio-analysis tool to create an accurate backtest of several existing MT5 EAs running together as one portfolio. The individual EAs can be backtested separately in MT5. My main requirement is to combine those results into a portfolio backtest using different risk allocations for each EA. For example
Description I am looking for a highly skilled MQL5 Developer & Trader with strong experience in EA optimization, stress testing, and forward validation. The EA is already coded and running. What I need now is: 1.Simple code editing, code adjustment/upgrading and code tamplates inserting, 2.Parameter Optimization & Re-Validation – Find the best stable settings for XAUUSD (not overfitted). 3.Robustness / Stress Testing
Hi, I’m looking for an experienced MQL5/MT5 developer to build a complex AI-powered adaptive Expert Advisor for XAUUSD+ on Ultima Markets. I have a detailed 28-section technical specification, and the requirements are fixed. I’m looking for the complete implementation , not a simplified EA or a conventional indicator-based system. The project includes: Genuine AI/ML integration AI-based market regime classification

Informazioni sul progetto

Budget
90+ USD
Scadenze
a 3 giorno(i)