Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Create a WMA of a custom slope indicator
Collapse
X
-
Create a WMA of a custom slope indicator
I created an indicator that calculates / plots the slope of the HMA called HMAslope. I would like to calculate and plot the WMA of the HMAslope. Do I need to define the HMAslope as a series before I can use it in the WMA function? I have attached my code for the HMAslope custom indicator.
Tags: None
-
-
Okay, I modified my code as shown above but I received the error message "Cannot apply indexing with [] to an expression of type "double".
So I modified the code to this:
Values[0][0] = Slope(HMA(PeriodHMA), 1, 0); //first plot
Values[1][0] = WMA(Values[0], PeriodWMA)[0]; //second plot
I don't get any errors after compiling but the indicator still doesn't plot anything.
Comment
-
Hi herbnderby,
I added a CurrentBar check at the top to ensure there are enough bars to process and all the plots show up:
Best regards,Code:protected override void OnBarUpdate() { if(CurrentBar < 20) return; Values[0][0] = Slope(HMA(20), 1, 0); //first plot Values[1][0] = WMA(Values[0], 20)[0]; //second plot }
-ChrisL
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
63 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
90 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
47 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
105 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
63 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment