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

MQL4 Indikatoren Experten Forex

Auftrag beendet

Ausführungszeit 1 Minute
Bewertung des Entwicklers
Thank you!
Bewertung des Kunden
Very quick, professional, an definitely worth the money. :)

Spezifikation

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");      
   
               }

         }
         
         
      }
  
}


Dateien:

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

Bewerbungen

1
Entwickler 1
Bewertung
(204)
Projekte
209
28%
Schlichtung
0
Frist nicht eingehalten
3
1%
Frei
2
Entwickler 2
Bewertung
(298)
Projekte
427
26%
Schlichtung
18
61% / 33%
Frist nicht eingehalten
26
6%
Frei
Ähnliche Aufträge
the code wasn't mine, i have got it somewhere on the web, but i like the performance of the EA, so i want to use it on mt5 platform. the given code based on price movements with ladder entry concept
Preciso de um EA, que faça o fecho automático de operações abertas no final da sessão e nas notícias de alto impacto. Um EA simples com apenas 1 função. Fecho das operações abertas
Enter buy trade at close of candle when bar closes above the 3 emas. Emas are 34 ema, 64 ema and 128 ema. For a buy trade the 34 ema must be above the other two emas. The 64 ema should be in the middle. The 128 ema should be below the other two emas. For a buy trade the Awesome Oscillator should be above the middle line and colored green. Exit a buy trade when price touches 64 ema. Sell trade same conditions as buy
I want to make AI based on Attached Picture Swing High low. If you have experience can share demo first. Stop loss, take profit, trailing , break even ,DD etc. also amiable
Hello, I’m looking for a TradingView indicator that fits my forex trading needs. If you can create or customize one for me, please reach out. I'd appreciate your help! Thanks in advance."
I need someone who can code a new EA from scratch and also know how to integrate AI into the EA and use AI and market sentiments along with news to then open positions. I have the description of the job ready. Need someone serious, with experience and who will help optimize the current strategy with their expertise. Thanks
I’m looking for an experienced MQL5 developer to create a custom Break of Structure (BoS) Indicator for MetaTrader 5. This indicator should automatically detect and mark key market structure breakpoints in real-time, offering traders clear visual signals when the market experiences a structural shift. The indicator should include the following features: Automatic detection of Break of Structure (BoS) and Change of
Pls I need help I don’t have much but pls accept my little payment for the work thanks 🙏 mt5 file Once it opens buy and move positively to buy let it use auto trailing to follow the trend that’s if I choose to use trailing option and before the trailing starts it must reach the actual profit target example if I set profit target to 500 then once profit is at 500 let trailing immediately protect it and any 1 pip
I need a tested and profitable EA. I don’t want backtested EA but real live tested. At least, 5~10 % per month. Name your price!!! I also have a backtested EA that can’t make profit at the end of the month
Hey greetings am in need of a developer that can convert my simple tradingview indicator to MT4 I have the source code of the indicator and is also a public indicator on Tradingview site Kindly bid and let started

Projektdetails

Budget
90+ USD
Für die Entwickler
81 USD
Ausführungsfristen
bis 3 Tag(e)