Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Distance between SMA and EMA lines
Collapse
X
-
Hello Kal33,
Thanks for your post.
The AddPlot() method could be used to add a plot to your script.
You could then assign the plot a value of the SMA minus the EMA to plot the difference between those two indicators on a chart. For example, the code might look something like this.
See the help guide documentation linked below for more information and sample code.Code://OnStateChange() section if (State == State.SetDefaults) { // Adds a blue line style plot AddPlot(Brushes.Blue, "MyPlot"); } //OnBarUpdate() section protected override void OnBarUpdate() { MyPlot[0] = SMA(20)[0] - EMA(20)[0]; }
AddPlot: https://ninjatrader.com/support/help...t8/addplot.htm
SMA: https://ninjatrader.com/support/help...simple_sma.htm
EMA: https://ninjatrader.com/support/help...onential_e.htm
Let me know if I may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
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
140 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