Hi
Please help me to use array correctly it this indicator.
In line 97 and 107, out of range error is received.
You have already been advised about the array out of range error
https://www.mql5.com/en/forum/304662#comment_10761784
- 2019.02.24
- www.mql5.com
You have already been advised about the array out of range error
https://www.mql5.com/en/forum/304662#comment_10761784
This is different problem and I can't resolve it.
I want to calculate number of profitable signals and profit average of total.
This is my code and it not work. don't know what is the problem.
MAX_Profit_Up[1] should return first signal max profit. But it doesn't
This is different problem and I can't resolve it.
I want to calculate number of profitable signals and profit average of total.
This is my code and it not work. don't know what is the problem.
MAX_Profit_Up[1] should return first signal max profit. But it doesn't
Regarding the array out of range, it is the same problem
That is why I specifically referred to that problem
You have already been advised about the array out of range error
https://www.mql5.com/en/forum/304662#comment_10761784
So that people will not waste their time responding to a question that has already been answered.
Regarding the array out of range, it is the same problem
That is why I specifically referred to that problem
So that people will not waste their time responding to a question that has already been answered.
I didn't ask what is meaning of "array out of range" !!!
Question is about mentioned code.
People can decide themselves. I don't want you waste your time.
Thanks
Out of range error resolved when using buffer. arrays data should be saved in memory through buffers. I'm right?!
SetIndexBuffer(2,MAX_Profit_Up);
SetIndexBuffer(3,MAX_Profit_Down);
Is it possible to do it without using SetIndexBuffer ?
int limit = rates_total+3; int count=prev_calculated; for(int i=limit-count; i>=1;i--)
Invalid limits. First run count is zero so your loop starts at Bars+3 Do your lookbacks correctly.double MA1= iMA(NULL,0,50,0,MODE_SMMA,PRICE_CLOSE,i); double MA2= iMA(NULL,0,20,0,MODE_EMA,PRICE_CLOSE,i);
Your look back is max of 50 and 20.int i_Down=0; //signal number down if (MA1>MA2 && (status==1||status==0)){ status=2; Down[i]=High[i]; i_Down++; MAX_Profit_Down[i_Down]= High[iHighest(NULL,0,MODE_HIGH,n,i)];
This makes no sense. If the first cross is at bar i, why would you want to mark bar one? And then the next cross at bar two?
This is because you declared :
double MAX_Profit_Down[];
The array has no size, you cannot use it as it is, you have to resize it before using it.
ArrayResize(MAX_Profit_down, i_up +1);
- 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
Please help me to use array correctly it this indicator.
In line 97 and 107, out of range error is received.
This indicator drawing arrow when 2 moving averages crossed. and MAX_Profit_Up[i_Up] , MAX_Profit_Down[i_Down] should save possible profit.
For example there is 200 buy signals, I want to have each signal profit inside MAX_Profit_Up array.
I want to calculate number of profitable signals and profit average of total. first need to save profit of each signal to an array. please correct me if I'm doing wrong.
Thanks for your time