Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Sma < >
Collapse
X
-
Sma < >
So do SMAs have values? How can I make SMAs have values? I do not want to use CrossAbove or CrossBelow, as they are events. I would like to know the condition of the two moving averages. i.e. SMA(fast) is above SMA(slow). Thanks for any help.
Tags: None
-
Hi
The mistake seems to be that the bar the indicators are operated on isn't specified.
You need to put:
The bar isn't specificed if you code something like:Code:if( SMA(fast)[COLOR=Blue][B][0] [/B][/COLOR]> SMA(fast)[COLOR=Blue][B][0] [/B][/COLOR]) [I] do something[/I]
Code:if( Rising(SMA(fast)) == true ) [I]do something[/I]
-
Hello Rhyshaelkan,
Thank you for your post.
arbuthnot is correct, you need to reference the barsAgo index for the indicator's value. [0] being the current value.
Originally posted by arbuthnot View PostCode:if( SMA(fast)[COLOR=Blue][B][0] [/B][/COLOR]> SMA(fast)[COLOR=Blue][B][0] [/B][/COLOR]) [I] do something[/I]
Comment
-
Thank you for pointing me in the right direction arbuthnot, and Patrick. Compiled without issue. Now to move on to some testing of variables.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
580 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
335 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
102 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
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment