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 CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
238 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
154 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
163 views
1 like
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
246 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
199 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment