Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Slope code
Collapse
X
-
Maxima,
It should just be the standard calculation. (y2-y1) / (x2-x1)
Change in price / change in time. I just did a test comparing :
And they are indeed the same.Code:protected override void OnBarUpdate() { if(CurrentBar<(LookBack+1)) { return; } double custslope = (SMA(20)[0]-SMA(20)[LookBack])/(LookBack); Print("Custom Slope : "+custslope+" Real Slope : "+Slope(SMA(20),LookBack,0)); SlopeVal.Set(Slope(SMA(20),LookBack,0)); CustSlopeVal.Set(custslope); }Adam P.NinjaTrader Customer Service
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by kinfxhk, 07-14-2026, 09:39 AM
|
0 responses
125 views
0 likes
|
Last Post
by kinfxhk
07-14-2026, 09:39 AM
|
||
|
Started by kinfxhk, 07-13-2026, 10:18 AM
|
0 responses
105 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 10:18 AM
|
||
|
Started by kinfxhk, 07-13-2026, 09:50 AM
|
0 responses
85 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 09:50 AM
|
||
|
Started by kinfxhk, 07-13-2026, 07:21 AM
|
0 responses
105 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 07:21 AM
|
||
|
Started by kinfxhk, 07-11-2026, 02:11 AM
|
0 responses
85 views
0 likes
|
Last Post
by kinfxhk
07-11-2026, 02:11 AM
|

Comment