Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Drawing a moving average with OnRender command
Collapse
X
-
Drawing a moving average with OnRender command
Hey, just wondering how to draw a moving average type line with the OnRender commands. At the moment I'm using a for loop with a Rendertarget.DrawLine() command, that draws a line between each number in the array. Just thinking there must be a more elegant solution..?Tags: None
-
Yes, you could draw all visible parts as one path, and it will look more natural, especially if it has sharp corners or is not a solid line. For example, look at the source code to the chart style @LineOnCloseStyle.cs, which is included with NinjaTrader, to see how you can do this by adding segments together and then rendering them all at the end.
-
Hello Magzor,
Thanks for your post.
QuantKey_Bruce is correct. In the NinjaScript Editor window, you may view the LineOnCloseStyle.cs ChartStyle file that comes default with NinjaTrader to see how to add line segments together and render them in OnRender.
RenderTarget.DrawGeometry: https://ninjatrader.com/support/help...awgeometry.htm
PathGeometry: https://ninjatrader.com/support/help...thgeometry.htm
GeometrySink: https://ninjatrader.com/support/help...ometrysink.htm
OnRender: https://ninjatrader.com/support/help...8/onrender.htm
Please 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>
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
330 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
548 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
548 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|


Comment