Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1384
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
leonerd #:
Здравствуйте. А как программно узнать символ и таймфрейм активного чарта в клиентском терминале? Т.е. чарта выбранного в настоящее время во вкладке. Есть какая-то функция из MQL5 для этого?
CHART_BRING_TO_TOP
Display chart on top of all other charts
bool
How do I define a chart identifier to show too?
CHART_BRING_TO_TOP
Display chart on top of all other charts
bool
How do I define a chart ID to show too?
https://www.mql5.com/ru/docs/constants/chartconstants/charts_samples#chart_foreground
Thank you. CHART_FOREGROUND is probably the most suitable. I don't need to set the active chart forcibly, I just need to determine which one is active. Am I right to think that I will have to go through all open charts checking CHART_FOREGROUND ?
https://www.mql5.com/ru/docs/constants/chartconstants/charts_samples#chart_foreground
Thank you. CHART_FOREGROUND is probably the most suitable. It's not like I need to forcibly set the active chart, but only identify the one that is active. Do I understand correctly that I have to go through all open charts checking CHART_FOREGROUND ?
CHART_FOREGROUND is a chart on top.
And not to enforce it, you should replace ChartSetInteger by ChartGetInteger
Good afternoon.
Can you give me a hint - I am thinking about a robot and there are four different conditions - I don't know which ones to remove yet: I want to find out later when optimising for different timeframes.
That is: four conditions (f1,f2,f3,f4). There can be many combinations (0,0,1,1) or (1,0,1,0) and so on - a total of 16 combinations. Exactly 15 - the variant (0, 0, 0, 0) is not considered.
Question: how to create program logic in order not to describe all 15 combinations in the code. There is a function for checking each of these conditions, and in which combinations of these conditions apply - check how else.
I would be glad if you can show me some Expert Advisor, which allows me to enter a lot of conditions in a concise code.
Good afternoon.
Can you give me a hint - I am thinking about a robot and there are four different conditions - I don't know which ones to remove yet: I want to find out later when optimising for different timeframes.
That is: four conditions (f1,f2,f3,f4). There can be many combinations (0,0,1,1) or (1,0,1,0) and so on - a total of 16 combinations. Exactly 15 - the variant (0, 0, 0, 0) is not considered.
Question: how to create program logic in order not to describe all 15 combinations in the code. There is a function for checking each of these conditions, and in which combinations of these conditions apply - check how else.
I would be glad if you show me some Expert Advisor, which allows me to introduce multiple conditions in a concise code.
I may go like this:
Or something like this:
CHART_FOREGROUND is the chart on top
And in order not to force it, replace ChartSetInteger with ChartGetInteger
thanks
You could do this:
Or something like this:
And here's the first construction - what would be the behaviour of the code under the conditions (0, 1, 0, 1)?
Could you please explain the body of the If condition
And here is the first construction - what would be the behaviour of the code under (0, 1, 0, 1) conditions?
Could you please explain the body of condition If
It's very simple here. If F1==false, then ( !F1 || f1) will be true regardless of the condition f1.
I.e., if Fn==true, condition fn is checked, and if Fn==false, condition fn is not checked.
Accordingly, for (0, 1, 0, 1) only conditions f2 and f4 will be checked, and if they both hold, the open_pos() code will be executed
This is very simple. If F1==false, then ( !F1 || f1) will be true regardless of condition f1.
I.e., if Fn==true, condition fn is checked, and if Fn==false, condition fn is not checked.
Correspondingly, for (0, 1, 0, 1) only conditions f2 and f4 will be checked, and if they both hold, the code open_pos() will be executed
But for the case when f1 and others are not only 0 or 1. I thought that if condition f1 is satisfied for a short position, then one is returned. If it is for a long position, it returns 2. If the condition is not fulfilled at all - 0.
But in such a construction we probably should not count on such a variety of parameter values and formulate the condition in some other way?
But for the case where f1 and others are not only 0 or 1. Thought that if condition f1 is fulfilled for short position, then one is returned. If for a long position it returns 2. If the condition is not fulfilled at all - 0.
But perhaps we should not count on such a diversity of parameter values in this construct and formulate the condition in some other way, should we?
Sets of conditions for opening long and short are considered separately.
I mean, for example, like this:
I'll even sell a piece of my real code - it won't reveal any know-how without information about "battle" values of variables and conditions of position holding.
You can actually specify one of 224 options here: