only sending limit orders

- www.mql5.com
Please insert the code correctly (using the button )
In my codes, I use a construction that automatically initializes everything:
m_trade.SetExpertMagicNumber(InpMagic);
m_trade.SetMarginMode();
m_trade.SetTypeFillingBySymbol(m_symbol.Name());
m_trade.SetDeviationInPoints(InpDeviation);
Please insert the code correctly (using the button )
In my codes, I use a construction that automatically initializes everything:
are these the limit order codes?
are these the limit order codes?
What do pending limit orders have to do with it? The code fills in the fill correctly.
Bekleyen limit emirlerinin bununla ne ilgisi var? Kod, dolguyu doğru şekilde doldurur.
I just want my robot to send limit orders. that's my problem my codes are not working. can you help me?
I just want my robot to send limit orders. that's my problem my codes are not working. can you help me?
No code, no help.
Kod yok, yardım yok.
Don't write if you're not going to help. don't be blank
Don't write if you're not going to help. don't be blank
I can't help you - if you haven't shown your code. To give a hint, you need to show the MQL5 code. And don't be rude to the moderator.
Code - Buy limit:
//+------------------------------------------------------------------+ //| Buy Limit.mq5 | //| Copyright © 2018-2021, Vladimir Karputov | //+------------------------------------------------------------------+ #property copyright "Copyright © 2018-2021, Vladimir Karputov" #property version "1.002" #property description "The script sets the pending orders down from the price" #property script_show_inputs //--- #include <Trade\Trade.mqh> #include <Trade\SymbolInfo.mqh> CTrade m_trade; // trading object CSymbolInfo m_symbol; // symbol info object //--- input parameters input double InpLots = 1.0; // Lots input double InpPrice = 0.0; // Price Buy Stop input ulong m_magic = 228364430; // magic number //--- ulong m_slippage=10; // slippage //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { if(!m_symbol.Name(Symbol())) // sets symbol name return; if(!RefreshRates()) return; string err_text=""; if(!CheckVolumeValue(InpLots,err_text)) { Print(err_text); return; } //--- m_trade.SetExpertMagicNumber(m_magic); m_trade.SetMarginMode(); m_trade.SetTypeFillingBySymbol(m_symbol.Name()); m_trade.SetDeviationInPoints(m_slippage); //--- start work bool buy_limit=m_trade.BuyLimit(InpLots,m_symbol.NormalizePrice(InpPrice),m_symbol.Name()); uint result_retcode=m_trade.ResultRetcode(); string result_retcode_description=m_trade.ResultRetcodeDescription(); Print("Buy limit: ",buy_limit,", Result Retcode: ",result_retcode); Print("Result retcode description: ",result_retcode_description); } //+------------------------------------------------------------------+ //| Refreshes the symbol quotes data | //+------------------------------------------------------------------+ bool RefreshRates(void) { //--- refresh rates if(!m_symbol.RefreshRates()) { Print("RefreshRates error"); return(false); } //--- protection against the return value of "zero" if(m_symbol.Ask()==0 || m_symbol.Bid()==0) return(false); //--- return(true); } //+------------------------------------------------------------------+ //| Check the correctness of the position volume | //+------------------------------------------------------------------+ bool CheckVolumeValue(double volume,string &error_description) { //--- minimal allowed volume for trade operations double min_volume=m_symbol.LotsMin(); if(volume<min_volume) { if(TerminalInfoString(TERMINAL_LANGUAGE)=="Russian") error_description=StringFormat("Объем меньше минимально допустимого SYMBOL_VOLUME_MIN=%.2f",min_volume); else error_description=StringFormat("Volume is less than the minimal allowed SYMBOL_VOLUME_MIN=%.2f",min_volume); return(false); } //--- maximal allowed volume of trade operations double max_volume=m_symbol.LotsMax(); if(volume>max_volume) { if(TerminalInfoString(TERMINAL_LANGUAGE)=="Russian") error_description=StringFormat("Объем больше максимально допустимого SYMBOL_VOLUME_MAX=%.2f",max_volume); else error_description=StringFormat("Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX=%.2f",max_volume); return(false); } //--- get minimal step of volume changing double volume_step=m_symbol.LotsStep(); int ratio=(int)MathRound(volume/volume_step); if(MathAbs(ratio*volume_step-volume)>0.0000001) { if(TerminalInfoString(TERMINAL_LANGUAGE)=="Russian") error_description=StringFormat("Объем не кратен минимальному шагу SYMBOL_VOLUME_STEP=%.2f, ближайший правильный объем %.2f", volume_step,ratio*volume_step); else error_description=StringFormat("Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP=%.2f, the closest correct volume is %.2f", volume_step,ratio*volume_step); return(false); } error_description="Correct volume value"; return(true); } //+------------------------------------------------------------------+
Do not double post!!
I have deleted your duplicate topic.
You have also already been told to post code correctly.
Please insert the code correctly (using the button )
Yet you didn't in your other topic.
Keith Watford :
Do not double post!!
I have deleted your duplicate topic.
You have also already been told to post code correctly.
Please insert the code correctly (using the button )
Yet you didn't in your other topic.
the code gives an error. did not help. I'm taking a screenshot. my only request is to send only limited orders.

- Free trading apps
- Free Forex VPS for 24 hours
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use