Thank you
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Newbie help with simple code
Collapse
X
-
Newbie help with simple code
Hello there. Newbie here. Anybody willing to give advice to why this code is giving this error message.
Thank youTags: None
-
Hello ac33 trader,
Thanks for your post.
This error message means that the variable you are accessing has does not exist or has not been defined.
Have you defined 'textFont' as a class-level SimpleFont variable in the script?
For example:
//class level variable
private NinjaTrader.Gui.Tools.SimpleFont textFont;
//OnStateChange
textFont = new NinjaTrader.Gui.Tools.SimpleFont("Courier New", 12) { Size = 50, Bold = true };
You could see how a class-level variable is created by viewing the SampleMACrossover strategy. This script contains two class-level SMA variables. To view the script, open a New > NinjaScript Editor window, open the Strategies tab, and double-click on the SampleMACrossover file.
See this help guide page for more information about SimpleFont: https://ninjatrader.com/support/help...font_class.htm
See this help guide page about Draw.TextFixed(): https://ninjatrader.com/support/help..._textfixed.htm<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, 05-11-2026, 05:56 AM
|
0 responses
28 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
20 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
184 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
337 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
261 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|

Comment