|05-14-2009, 12:39 PM||#1|
Join Date: Apr 2009
Thanked 0 times in 0 posts
Formula of Slope
I'm a NT newbie and trying to create a simple formula for calculating the slope value of the Highest Highs.
What I can't figure, however, is how I can extract the number of bar. With the HighestBar() method I can get the number of bars within the lookback period, but how can I get the number of bars ago for the period preceding the current one?
Below is the formula (currently not working) for what I am trying to do:
here's I am calculating the Highest High for the current period (say, 5 bars - from 0 to 4th) and the HH for the period from 5th to 9th.
Generally speaking, what is there universal method for getting time stamp or # of bars ago for given event?
|05-14-2009, 12:45 PM||#2|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Thanked 106 times in 70 posts
You need to store your calculations into a DataSeries before you can run Slope() on it. Please see this article: http://www.ninjatrader-support.com/H...taSeriesObject
To get the timestamp of your bars just use Time where 0 is the index of the bar you want the timestamp of.
NinjaTrader Customer Service
|11-11-2011, 05:34 AM||#3|
Join Date: Nov 2011
Thanked 1 time in 1 post
How to Find the Slope of a LineBack to Top
Determine the slope of a line, which contains the points A (-1, -2), B (-2, 1):
Here, x1 = -1, x2 = -2, y1 = -2, y2 = 1.
Slope of the line, m = [ (y2 - y1)/(x2 - x1)]
= [(1 + 2)/(-2 + 1)]
Slope of the line (m) = -3
The slope formula of the line is:
Slope (m) = [ (y2 - y1)/(x2 - x1)]
Slope (m) =Rise / Run
(Rise = change in the y co-ordinate; Run = change in the x co-ordinate)
In the above given graph, the Rise is given for the points B (4,2) and C (4,4) and the Run is given for the points A (2,2) and B (4,2)
Rise = change in the y - coordinate = 4-2 =2
Run = change in the x- coordinate = 4-2 =2
Using the slope formula, we get :
Slope( m ) = Rise / Run = 2 / 2 =1
The following user says thank you to geeknick for this post:
|Thread||Thread Starter||Forum||Replies||Last Post|
|Someone give me a formula||cassb||General Programming||20||04-08-2010 01:26 PM|
|Formula for Fibonacci Extension||richa61416||Strategy Development||2||07-13-2008 02:15 PM|
|EMA Crossing Formula||pipsheker||General Programming||1||05-18-2008 12:49 PM|
|CCI formula||pipsheker||General Programming||2||05-17-2008 06:57 AM|
|Using a formula or variable as an input to an Indicator||nolantx||Indicator Development||5||05-24-2007 03:58 PM|