algohnv: I am trying to create an indicator which can calculate the max drop in pips over the last 200 bars
- That isn't what your code is doing. It is finding the largest single bar.
int iLow = iLowest(_Symbol, PERIOD_CURRENT, MODE_LOW, 200, 0); int iHigh = iHighest(_Symbol, PERIOD_CURRENT, MODE_High, 200-iLow+1, iLow); ExtMapBuffer3[i]=High[iHigh] - Low[iLow];
whroeder1:
- That isn't what your code is doing. It is finding the largest single bar.
Thank for your help. I tried your code but it seems that it doesnt work.
I add your code as;
int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(i=limit-1; i>=0; i--) { int iLow = iLowest(NULL, 0, MODE_LOW, 100, i); int iHigh = iHighest(NULL, 0, MODE_HIGH, 100-iLow+1, iLow); ExtMapBuffer3[i]=High[iHigh] - Low[iLow]; }
* I set the last 100 bars because I am attaching an example that shows that it doesnt work
Files:
max_drop_price2.png
32 kb
-
Play videoPlease edit your post.
For large amounts of code, attach it - Don't post a link to or attach a image, just insert the image
for(i=limit-1; i>=0; i--) int iLow = iLowest(NULL, 0, MODE_LOW, 100, i); int iHigh = iHighest(NULL, 0, MODE_HIGH, 100-iLow+1, iLow); ExtMapBuffer3[i]=High[iHigh] - Low[iLow];
Where are your braces for the loop?- Try
for(i=limit-1; i>=0; i--){ int iHigh = iHighest(_Symbol, PERIOD_CURRENT, MODE_HIGH, 100, i); ExtMapBuffer3[i]=High[iHigh] - Low[i]; }
whroeder1:
-
Please edit your post.
For large amounts of code, attach it - Don't post a link to or attach a image, just insert the image
- Where are your braces for the loop?
- Try
- answer
Thanks for your reply. I edit the code on my previous posts and I add the braces to the loop of my last post. I tried your code and the compiler returns me the error; " 'max_extreama' - function not defined "
algohnv: compiler returns me the error; " 'max_extreama' - function not defined " | I was still typing. |
whroeder1:
-
Please edit your post.
For large amounts of code, attach it - Don't post a link to or attach a image, just insert the image
- Where are your braces for the loop?
- Try
The new code that you have on step 4, calculates only the highest price of the last 100 bars minus the low of the current bar. It doesnt calculate the max drop on the last 100 bars
algohnv: It doesnt calculate the max drop on the last 100 bars
| That is the max drop for that bar. Add another buffer and compute the maximum of the maximum. |
whroeder1:
That is the max drop for that bar. Add another buffer and compute the maximum of the maximum. |
I am not sure what do you mean. On my first post I had 2 matrixes and I tried that, but I cannot understand why it doesnt work. Could you explain me please what you mean?
Could anyone help, please? In my first post that I have the code, the result is a flat line. It seems that mt4 cannot do calculations between 2 tables (subtractions)

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
Hello,
I am trying to create an indicator which can calculate the max drop in pips over the last 200 bars. I am attaching an example.
I have code this, but unfortunately the indicator is a stable price at 0. Could anyone help me please?