Disliked{quote} Since MT4 doesn't have TimeFrame for Year, you need to do some steps. Find Index of December candle in Monthly chart and get Close Price. Then, you will get last year's Close price. ( Basically, December's close price ) Below code is not complete.. just simple suggestion. You would check year also by check Year() to make sure it is last year's candle, not this year. Like thisyear = Year(TimeCurrent()); LastYear = thisyear -1; double LastYearClosedPrice = 0; for ( int i = 0; i < 20; i++) { if ( Month(iTime(Symbol(),PERIOD_MN1,i) ) == 12 &&...Ignored
Thank you BlueRain
The indicator is as attached for your correction.
I do not know where to attach the codes you gave.
Also I discovered that the Previous Year High is not correct. Instead of 1959.35 it gave 1965.51 on Gold;
The Previous Year Low seems to be okay.
I am not interested in Previous Year Open.
Thank you for your assistance.
Attached File(s)
Cam Yearly.mq4
18 KB
|
168 downloads