Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 318
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Good afternoon. Help me deal with a strange problem.
The point is: I am writing a multitime indicator, i.e. an indicator, which, being open at any time, will calculate and give signals for all other times as well.
The basis of the indicator is RSI.
In init() when switching the timeframe, a separate array is put in correspondence of the indicator line. For each of them the line is displayed, when you are at this or that time, but the calculations for other times are not going on (function iRSI is stupidly chasing zeros in the calculation). I.e. the current time is calculated, but other times are not.
I am pasting the code:
What is interesting, if we leave only one array for the indicator line and calculate only W1 at any time, everything is calculated and drawn correctly at any(!) time.
What's the trick? It is impossible to take different arrays for the indicator line during initialization, depending on the time?
Good afternoon. Help me to deal with a strange problem.
The point is: I am writing a multitime indicator, i.e. an indicator, which, being open at any time, will perform calculations and give signals for all other times as well.
The basis of the indicator is RSI.
In init() when switching the timeframe, a separate array is put in correspondence of the indicator line. For each of them the line is displayed, when you are at this or that time, but the calculations for other times are not going on (function iRSI is stupidly chasing zeros in the calculation). I.e. the current time is calculated, but other times are not.
I am pasting the code:
What is interesting, if we leave only one array for the indicator line and calculate only W1 at any time, everything is calculated and drawn correctly at any(!) time.
What's the trick? It is impossible to take different arrays for the indicator line during initialization, depending on the time?
Only W1 and D1 are read! What do you want? Finish it for the others!
That's not the point. I have given calculations only for D1 and W1, so that the code is not too long. Note: on every tick on every timeframe, calculated values of W1 are printed. So, if any time is opened except W1, zeros are printed. If it works for W1, it will work for others.
That's not the point. I have given calculations only for D1 and W1, so as not to make the code too long. Please note: on every tick on any timeframe the calculated values of W1 are printed. So, if any time is opened except W1, zeros are printed. If it works for W1, it will work for all others.
Correct! To show on other charts, you have to open the weekly chart as well!
To be honest, I did not understand this statement.
And there is no need to show anything else. If you run the code, you will see that it already shows what I want: on D1 it shows chart RSI D1 and on W1 - chart RSI W1, but at the same time, if D1 is open, then RSI for W1 are all zero, and if W1 is open, then the calculations for D1 are zero. The question is why this is the case and how to fix it.
The problem is that the index array initializes and resizes itself to the right size.
I changed the switch in init() like this:So when I open D1 - RSI_D1[] becomes indexed, and everything is OK with it, but other arrays remain in embryonic state.
I tried it this way: I declared all arrays this way:
However, on ArrayResize GetLastError gives an error:
EURUSD,Daily: cannot resize the array
EURUSD,Daily: some array error
Anyway, who can tell me how to solve this problem?
The problem is that the index array initializes and resizes itself to the right size.
I changed the switch in init() like this:So when I open D1 - RSI_D1[] becomes indexed, and everything is OK with it, but other arrays remain in embryonic state.
I tried it this way: I declared all arrays this way:
However, on ArrayResize GetLastError gives an error:
EURUSD,Daily: cannot resize the array
EURUSD,Daily: some array error
Anyway, who can tell me how to solve this problem?
If the array is dynamic, be sure to increase the size of the array to accommodate the new data when you write values to it. ArrayResize()
But ArrayResize GetLastError gives an error:
EURUSD,Daily: cannot resize the array
EURUSD,Daily: some array error
This is what I wrote about above:
However on ArrayResize GetLastError gives an error:
EURUSD,Daily: cannot resize the array
EURUSD,Daily: some array error
To be honest, I didn't understand that statement.
And there is no need to show anything else. If you run my code, you will see that it already shows everything that is needed: RSI D1 shows chart on D1 and RSI W1 on W1, but at the same time, if D1 is open, then RSI for W1 are all zero, and if W1 is open, then RSI for D1 are all zero. The question is why this is the case and how to fix it.
Because the buffer is alone and shows one by one on your call!
Hi all. Help me to limit placing pending stop orders with the same price. I need a function which when a new pending order price is detected tries out the existing ones, and if they are not set, puts them, if they are - exit. In case the program is functional, the fee is MUST be paid.