I am calculating an SMA on an hourly chart. I tried adding the Draw.Line to an existing script (which calculates and plots the values I want on the hourly chart), and at first it seemed to work. But then the global line failed to update as the SMA updated for the next hour, even though the Draw.Line command was in OnBarUpdate. Can you provide some guidance?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Global lines and rectangles with RenderTarget?
Collapse
X
-
Global lines and rectangles with RenderTarget?
I am looking for the optimal way to draw a line via script and assign it globally to all charts for the instrument. I currently use RenderTarget for some lines, but do not see a way to make those lines global using the SharpDX toolset. Do I need to use the drawing tool for Draw.Line then? And if so, does that need to go in OnBarUpdate, instead of OnRender?
I am calculating an SMA on an hourly chart. I tried adding the Draw.Line to an existing script (which calculates and plots the values I want on the hourly chart), and at first it seemed to work. But then the global line failed to update as the SMA updated for the next hour, even though the Draw.Line command was in OnBarUpdate. Can you provide some guidance?Tags: None
-
Hello jculp,
Thanks for your post.
Yes, you would need to use the Draw methods, in OnBarUpDate() using the overloads that provide the IsGlobal parameter. Note that you will likely want to do that in conjunction with templates that will allow you to configure the draw object characteristics that the methods using IsGlobal will not allow.
If a template is not available when the script runs, it will then use the defaults for the particular draw object.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
77 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
40 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
63 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
63 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
53 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment