1. The script is supposed to set either pending limit orders at a certain distance from ask and bid, or stop orders. The limit pending orders are set without any problems but the stop ones are not. Please help me find out why the pending Buy Stop and Sell Stop orders are not being set.
2. Is there any possibility to test the script when the market is closed (e.g. on weekends)?
Перед тем как приступить к изучению торговых функций платформы, необходимо создать четкое представление об основных терминах: ордер, сделка и позиция. — это распоряжение брокерской компании купить или продать финансовый инструмент. Различают два основных типа ордеров: рыночный и отложенный. Помимо них существуют специальные ордера Тейк Профит...
Thank you, Vladimir, you've helped me out, or I'd have had to suffer until Monday.
Best regards, Vladimir.
You are welcome.
Note the m_first_start variable declared in the global program level
bool m_first_start = false;
//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
at the end of OnTick, this variable will be assigned the value "true"
//--- m_first_start=true;
}
//+------------------------------------------------------------------+//| Refreshes the symbol quotes data |//+------------------------------------------------------------------+bool RefreshRates()
{
and the EA will no longer place pending orders until its next restart
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
//---if(m_first_start)
return;
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Good day everyone!
Here is part of the script code for Metatrader5:
You have questions:
1. The script is supposed to set either pending limit orders at a certain distance from ask and bid, or stop orders. The limit pending orders are set without any problems but the stop ones are not. Please help me find out why the pending Buy Stop and Sell Stop orders are not being set.
2. Is there any possibility to test the script when the market is closed (e.g. on weekends)?
Sincerely, Vladimir.Reference:General principles - Trading Operations
- current market state
- forecast
- current price
- order price
- price at which the pending order will be placed
- expected growth
- expected decline
Your mistake is in the formation of the starting price:
I recommend to make a separate starting price for Stop and Limit pending orders.
Forum on Trading, Automated Trading Systems and Strategy Tests
FAQ from Beginners MQL5 MT5 MetaTrader 5
Vladimir Karputov, 2019.08.31 08:16
And your mistake is in the start price formation:
I recommend to make the starting price separately for Stop and separately for Limit pending orders.
Thanks, Vladimir, for the tip.
What do you think of the possibility to test the script when the market is closed (e.g. on weekends)?
Sincerely, Vladimir.
What do you think about the possibility to test the script when the market is closed (e.g. on weekends)?
The question is removed, as the answer appears to have been given in another thread.
Respectfully, Vladimir.
Question withdrawn as the answer appears to have been given in another thread.
Respectfully, Vladimir.
So you've spread one question all over the forum... You're the one who's confused.
Thank you, Vladimir, for the tip.
What do you think of the possibility of testing the script when the market is closed (e.g. on weekends)?
Respectfully, Vladimir.
Thank you, Vladimir, for the tip.
What do you think about the possibility to test the script when the market is closed (e.g. on weekends)?
Respectfully, Vladimir.
This is how the Expert Advisor will look like:
Vladimir Karputov, 2019.08.31 13:20
This is what an expert would look like:
Great!
Thank you, Vladimir, you've helped me out, or I'd have suffered until Monday.
Regards, Vladimir.
Great!
Thank you, Vladimir, you've helped me out, or I'd have had to suffer until Monday.
Best regards, Vladimir.
You are welcome.
Note the m_first_start variable declared in the global program level
at the end of OnTick, this variable will be assigned the value "true"
and the EA will no longer place pending orders until its next restart
Forum on Trading, Automated Trading Systems and Strategy Tests
FAQ from Beginners MQL5 MT5 MetaTrader 5
Vladimir Karputov, 2019.08.31 14:38
Please.
Note the m_first_start variable declared at global program level
Yes, Vladimir, I noticed right away that the EA works like a script when tested. Thank you once again!
Sincerely, Vladimir.
Why is the candle output not working?