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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
156 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
90 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
138 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
130 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment