Quote:
Originally Posted by Michel
I think you did a mistake : changing TF, you change the time unit, so what you obtain is DeltaY/(DeltaX*Period()).
You should just have to compute DeltaY/DeltaX where DeltaX is in minutes, not in period; then TF doesn't matter.
|
The original method used deltaX as the number of bars on the X axis which is a constant. This would give pips/bar.
The code I use for deltaX is as follows.
deltaX = (PrevMAShift-CurMAShift) * Period();
PrevMAShift defaults to 4, CurMAShift defaults to 0 so there are 4 bars on X axis( the original deltaX). This is multiplied by Period() to get minutes. On 1 minute chart period is 1 so 4 bars are 4 minutes, on 5 minute chart Period is 5 so 4 bars are 20 minutes.
So timeframe does matter for calculation of minutes from the number of bars.
For deltaY the code is
deltaY = (fCurMA - fPrevMA) / Point; // deltaY in Pips
Then slope as pips/minute is
fAngle = deltaY/ deltaX; // slope
It is possible the slope is different for each timeframe because it just is. This might mean determining a different slope threshold in each timeframe for determining flat markets.
I think visually determining slope is the problem. When the Y axis is reduced to include the same price range on each timeframe the slope does appear different.
In case you did not know this I have a degree in Computer Science, Computer Engineering and a minor in Mathematics as well as over 30 years of programming experience. Before that I was a mathematical analyst for several years.
Robert