montepasy:
In MT4, there is RSI indicator and it has below source:
Could you explain me how it could changed?-
Why did you post your MT4 question in the
Root /
MT5 EA section
instead of the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. - The code you posted is not an RSI.
- How should we know how to change the code, when you haven't even stated what it should do? There are no mind readers here and our crystal balls are cracked.
passed variable to func: time[" + l + "] = " + time[l] + ", close[" + l + "] = " + close[l]); // in this place, both prints have the same values of close price Global variable: Time[" + l + "] = " + Time[l] + ", Close[" + l + "] = " + Close[l]); // in this place, both prints have the same values of close price
The passed arrays to OnCalculate (e.g. low[],) have no default direction. The predefined variables (e.g. Low[],) all ordered AsSeriesTo determine the indexing direction of time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order not to depend on default values, you should unconditionally call the ArraySetAsSeries() function for those arrays, which are expected to work with.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
HI,
I am working on own automatic trading system and I have tested RSI idicator - I would like to change it a bit.
In MT4, there is RSI indicator and it has below source:
Could you explain me how it could changed?
It is very important for me.
Thank you in advance,
Best Regards
Don't do this :
ArraySetAsSeries(close,false);
Imagine this :
0,1,2,3,4,5,6,7,8,9
And when you invert how the code is accessing array elements (and that is what you have done with that line) , what is the results going to be?
-
Why did you post your MT4 question in the
Root /
MT5 EA section
instead of the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. - The code you posted is not an RSI.
- How should we know how to change the code, when you haven't even stated what it should do? There are no mind readers here and our crystal balls are cracked.
-
The passed arrays to
OnCalculate (e.g. low[],) have no default direction. The predefined variables (e.g. Low[],) all ordered AsSeries
1. I am so sorry, I did not notice that fact. I will be remember in the future about that.
2. Why do you say that? In my MT4 there is a window on the left and there are indicators. One of them is RSI file. What is more, there is a comment like "Relative Strength Index" inside the file.
Is it not a iRsi() indicator?
Can I get know the iRsi() indicator? It is very important for me..
3. I do not know you understanding is what I meant.
In the above snippet I printed passed arrays to the function onCalculate(e.g. low[]) and predefined(e.g. Low) twice. One is at the beggining of the function and the second is after executions of ArraySetAsSeries functions. In the first time, close values are the same in both cases. In the second, the values from (passed) close array are different then values from predefined Close array. Do you mean, it results from usage of ArraySetAsSeries function?
4. I will read about mentioned two functions.
Thank you for you replay very much.
Don't do this :
Imagine this :
0,1,2,3,4,5,6,7,8,9
And when you invert how the code is accessing array elements (and that is what you have done with that line) , what is the results going to be?
Thank you for the response.
Unfortunately, mentioned code is not my code, but it is a content of RSI indicator file from MT4.
You can find it in attachments.
Is it not a iRsi() indicator?
@whroeder1 - do you suppose why the passed close array has different values between first and second printing in the code snippet?
I understand the following invocation determines direction of indexing but the values of the array should be the same. Am I right?
ArraySetAsSeries(close,false);
@whroeder1 - do you suppose why the passed close array has different values between first and second printing in the code snippet?
I understand the following invocation determines direction of indexing but the values of the array should be the same. Am I right?
They remain the same
But element with index 0, when the series is set to true, is the last element in the array (value 9 in the case of the array I gave you as an example) and it would return value 0 in the case when array is set to false
They remain the same
But element with index 0, when the series is set to true, is the last element in the array (value 9 in the case of the array I gave you as an example) and it would return value 0 in the case when array is set to false
Are you sure?
I did not attach the logs from the test, but changes, NEW values (after execution of ArraySetAsSeries function) are do not occur in the close array before. So, they are not values with exchanged place in the array, as you say. I can not find such values during printing the right values at the first time...
Are you sure?
I did not attach the logs from the test, but changes, NEW values (after execution of ArraySetAsSeries function) are do not occur in the close array before. So, they are not values with exchanged place in the array, as you say. I can not find such values during printing the right values at the first time...
Oh, but I am sure :) Working with arrays for years now - it is almost like second nature by now. In any case, all it takes a couple of seconds of coding to check what I have told you in that post.
_______________________________________________________________________
PS: I never ttoldl that the array elements are going to change places as a result of ArraySetAsSeries(close,whatever) function call - please show me one single sentence where I told that. What I have told is that same index (to quote myself "element with index 0") will return values of different array element when array is set as series and when it is not (did not mention the obvious case when it is not so : when an array has just one element). Please read my posts again - I usually do not tell nonsense :)
PPS: read this too https://www.mql5.com/en/docs/array/arraysetasseries
All the best
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
HI,
I am working on own automatic trading system and I have tested RSI idicator - I would like to change it a bit.
In MT4, there is RSI indicator and it has below source:
Could you explain me how it could changed?
It is very important for me.
Thank you in advance,
Best Regards