//+------------------------------------------------------------------+ //| i-HighLow.mq4 | //| Copyright © 2007, RickD | //| Александър Пламенов Рядков | //| http://www.e2e-fx.net | //+------------------------------------------------------------------+ #property copyright "© 2007 RickD" #property link "www.e2e-fx.net" //---- #define major 1 #define minor 0 //---- #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Gold #property indicator_color2 DodgerBlue //---- extern int N = 20; //number of months extern int N2 = 5; //change this value //---- double UpperBuf[]; double LowerBuf[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void init() { SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1); //---- SetIndexDrawBegin(0, N); SetIndexDrawBegin(1, N); //---- SetIndexBuffer(0, UpperBuf); SetIndexBuffer(1, LowerBuf); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void deinit() { //---- } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void start() { int counted = IndicatorCounted(); //---- if(counted < 0) return (-1); //---- if(counted > 0) counted--; int limit = Bars - counted; //---- for(int i = 0; i < limit; i++) { UpperBuf[i] = iHigh(NULL, 0, iHighest(NULL, 0, MODE_HIGH, N, i)) + N2*Point; //check monthly LowerBuf[i] = iLow(NULL, 0, iLowest(NULL, 0, MODE_LOW, N, i)) - N2*Point; } } //+------------------------------------------------------------------+
https://www.mql5.com/en/code/7107 a few changes you can do now yourself
.
Thanks DeVries - much appreciated.
![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
Hi,
Can you please advise:
I want to be able to draw horizontal lines across a chart at the high and low point for the last four months and for this to update each month:
1. Current Month (say October)
2. Previous Month (September)
3. Next previous (August)
4. Next Previous (July)
The problem is I'm no programmer and I can't workout how to get beyond 1. I'm sure there is something out there in ibars or something but I just can't find it. If someone could point me at the documentation for this it would be much appreciated.
Thanks.