Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1225
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
For all. More precisely, it displays in the chart window the number of bars specified in the setting, and does not depend on the timeframe
P.S. I've never changed this value, but I've just checked it and saw that it cannot be set less than 1000.So you need to check withiBars()?
Good afternoon. The script isn't working for some reason.
What's the problem?
Hello friends!
Questions:
1. Are Sell Stop Limit orders placed on the broker side or on the terminal side?
2. When I close the programme, will this order be triggered when the conditions are met?
Trading on the MICEX share market. Thank you in advance!
Good afternoon, dear programmers. Question on MQL5
How to implement position control in MetaTrader 5? I want to have only one open position on one bar, i.e. the position should be closed no matter where - on which bar, but the opening should be on one bar only.
This code is completely ignored. What is the error?
Good afternoon, dear programmers. Question on MQL5
How to implement position control in MetaTrader 5? So that on one bar there is only one open position. It means that the position is closed no matter where - on which bar, but the opening should be on one bar only.
The easiest way is to save the time of the bar opening, on which the position is opened in the global variable and then, when opening a new position, check the time of the bar opening if the value is higher than the saved value, then open a position.
Good afternoon, dear programmers. Question on MQL5
How to implement position control in MetaTrader 5? I want to have only one open position on one bar, i.e. the position should be closed no matter where - on which bar, but the opening should be on one bar only.
This code is completely ignored. What is the error?
Error: You have mixed up the flies and the cutlets - you have mixed up the REMOTE ORDERS and the POSITIONS.
To avoid confusion, please read the reference:General Principles
The simple way above is to remember the open time of the current bar when you open a position. Then if you want to open a new position, you check the saved time and the open time of the current bar.
Storing the time of opening a position is convenient inOnTradeTransaction:
and reconcile the time when the signal is triggered:
Example taken fromOHLC Check 2 code
It's a bit tricky.... somehow. No problem at the first stage " remember the opening time of the current bar"
There you go:
But here " you check the saved time and the opening time of the current bar." problem.
I've done about the same thing. Look at this:
All I need to do here is to loop a walk like "return(-1)" But I can't assign an expression to the return because of the void. How do I get around this? How to loop but not return?
That didn't work either.
It's a bit tricky.... somehow. No problem at the first stage " remember the opening time of the current bar"
There you go:
But here " you reconcile the saved time and the opening time of the current bar." problem.
I've done about the same thing. Look at this:
All I need to do here is to loop a walk like "return(-1)" But I can't assign an expression to the return because of the void. How do I get around this? How to loop but not return?
The treatment for looping programs is cutting their arms around their necks. So that you don't have to do it again in the future.
Here's what you need - the whole program body, you just need to formalize signal reception:
The variable'm_prev_bars' stores the open time of the current bar and the variable'm_last_deal_in' stores the open time of the bar at which the position was opened.
These two variables are compared in the block for getting signals'SearchTradingSignals'.