I tried to calculate the pivot of last 3 years' range, ie the highest high, the lowest low of the last 3 years, and the closing price of the last year, then sum these 3 together and divided by 3.
I got the code working, but the numerical result is wrong. Using euro as example, it should be 1.1479 for 2018 (based on past 3 years' range), but the indicator shows 1.1630.
Please can someone take a look and see why the result is wrong?
if(TimeDayOfYear(Time[i])<=10 && TimeDayOfYear(Time[i+1])>=355
PastHigh[i] = iHigh(NULL, PERIOD_MN1, iHighest( NULL, PERIOD_MN1, MODE_HIGH, 36, 0) ); // Past 3-yr high
PastLow[i] = iLow(NULL, PERIOD_MN1, iLowest( NULL, PERIOD_MN1, MODE_LOW, 36, 0) ); // Past 3-yr low
OK, I've done some more testing, turned out that the PastHigh[i] is wrong, it returns the highest high calculating from the current month, rather than only months in past year. I think PastLow would have the same problem.
How do I get round this? Please help?
Sorry, I didn't know anything about root directory etc... I came in via the front page of Forum and got to the 'Technical indicator' .
Just an update, I got the problem sorted. I changed '0' to 'Month()', then it would calculated from the December candle of last year.
Sorry for any wrong posting. If necessary, you can delete the thread.