Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Define Slope of EMA(20)
Collapse
X
-
I was simply tired and in a hurry when I wrote down the lines. Of course you do not need any parentheses when defining a variable. You also need to initialize the DataSeries. And of course it should read "protected override void OnStartUp()". I did not pay attention to the details, but simply wanted to explain how to approach the slope issue.Originally posted by arbuthnot View PostHi HarryCode:private [B]DataSeries (absSlopeMACD)[/B]; private override void [B]OnStartUp()[/B] { ... absSlopeAverage = SMA(absSlopeMACD, normPeriod); }
I've been fascinated to read this thread, as much for the approaches to coding as for the ideas about 'slope'.
I have a couple of questions, if you have a spare moment, about the coding you've used.
I notice that you define the data series by
whereas when I've done this myself, I've used this approach:Code:private DataSeries (absSlopeMACD);
In Variables (without parentheses):
and in InitializeCode:private DataSeries testseries;
Would you possibly be able to explain why you chose the approach you have, esp. the placing the name of the series in parentheses and how this differs from the other approach? Also, does this approach mean you don't have to state anything in Initialize?Code:testseries = new DataSeries(this);
Moreover, I'd appreciate it if you could explain in a few words what the OnStartUp method does and how it differs from OnBarUpdate. I've seen this only once or twice in indicators and have never really grasped its purpose.
Thanks very much in advance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment