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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
627 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
359 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 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
562 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
568 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment