Any suggestions on what I might have coded incorrectly?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Indicators not Saving to charts on workspaces and chart templates
Collapse
X
-
Indicators not Saving to charts on workspaces and chart templates
I have two custom indicators that will not save to chart templates or to charts on saved workspaces. Every time I load a workspace, I must manually apply these indicators. When I apply a chart template that containes these indicators, they do not appear on the chart. I have tried rebuilding workspaces with new charts and bui8lding new chart templates without success. When I manually apply these indicators they work correctly. I have several other custom indicators with do not behave this way, just only these two.
Any suggestions on what I might have coded incorrectly?Tags: None
-
Hello MarthaClines,
The most common reason is improperly serialized public objects.
Are you seeing any errors appear in the Log tab of the Control Center when attempting to save the template or workspace?
May I test an export of your script?
To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:- Click Tools -> Export -> NinjaScript...
- Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
- Click the 'Export' button
- Enter a unique name for the file in the value for 'File name:'
- Choose a save location -> click Save
- Click OK to clear the export location message
- (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
http://ninjatrader.com/support/helpG...-us/export.htmLast edited by NinjaTrader_ChelseaB; 04-15-2019, 10:49 AM.Chelsea B.NinjaTrader Customer Service
-
Originally posted by NinjaTrader_ChelseaB View PostHello MarthaClines,
The most common reason is improperly serialized public objects.
Are you seeing any errors appear in the Log tab of the Control Center when attempting to save the template or workspace?
May I test an export of your script?
o export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:- Click Tools -> Export -> NinjaScript...
- Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
- Click the 'Export' button
- Enter a unique name for the file in the value for 'File name:'
- Choose a save location -> click Save
- Click OK to clear the export location message
- (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
http://ninjatrader.com/support/helpG...-us/export.htm
Thanks
Comment
-
Hello MarthaClines,
Does this confirm that there are no errors in the Log tab of the Control Center when saving a template?
If the script cannot be posted publicly, can you copy the script and then remove the logic from OnBarUpdate() to reduce the script and post the reduced version?
A reduced version of the script that can reproduce is always preferable. Reducing the script will often highlight the code causing the issue.Chelsea B.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello MarthaClines,
Does this confirm that there are no errors in the Log tab of the Control Center when saving a template?
If the script cannot be posted publicly, can you copy the script and then remove the logic from OnBarUpdate() to reduce the script and post the reduced version?
A reduced version of the script that can reproduce is always preferable. Reducing the script will often highlight the code causing the issue.
I relay cant post the other. I am hoping the problem will be the same in both.
Attached Files
Comment
-
Hello MarthaClines,
Does this confirm that there are no errors in the Log tab of the Control Center when saving a template?
I would expect this script you have provided to cause errors.
This script cannot be serialized in a workspace or template because the attribute tags are not correct.
If you want public inputs to be in the parameters window these must be using [NinjaScriptProperty].
You cannot serialize a brush and this must be using the [XmlIgnore()] attribute. You must have a separate input that converts this to a string.
Below is a public link to the help guide.
Are you 100% there are no xml errors appearing in the Log?
I recommend that you create the shell of these scripts with the Strategy Builder so that it constructs the frame and inputs for you so these are properly serialized. Then add the logic after.
Below is a link to a forum post with helpful information about getting started with NinjaScript.
The public double values should be using the Range attribute.
Last, this is not as important, but you are using ResourceType = typeof(Custom.Resource) in the Display attribute. This likely won't hurt anything, but I am doubtful you actually have a resource dictionary that these values are supposed to pull from.Chelsea B.NinjaTrader Customer Service
Comment
-
Hi - I am also not able to save an indicator to a chart when I save the workspace.
I get the following error when I check the log file : - Could not save indicator 'NoBS4:' There was an error generating the XML document.
The indicator compiles with no errors and works properly otherwise.Last edited by johnvnwp; 04-11-2021, 02:37 AM.
Comment
-
Hello johnvnwp,
Most likely there is an un-serialized public variable that is not an int, double, bool, string, or enum.
Check all of the public inputs. Do you see any inputs that are not int, double, bool, string, or enum? Are they using the XmlIgnore() attribute?
As a heads up, this will not cause a compile error as this is not a compile error. This is a run-time logic error and will appear on the Log tab of the Control Center.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Perr0Grande, Today, 08:16 PM
|
0 responses
2 views
0 likes
|
Last Post
by Perr0Grande
Today, 08:16 PM
|
||
Started by elderan, Today, 08:03 PM
|
0 responses
5 views
0 likes
|
Last Post
by elderan
Today, 08:03 PM
|
||
Started by algospoke, Today, 06:40 PM
|
0 responses
10 views
0 likes
|
Last Post
by algospoke
Today, 06:40 PM
|
||
Started by maybeimnotrader, Today, 05:46 PM
|
0 responses
12 views
0 likes
|
Last Post Today, 05:46 PM | ||
Started by quantismo, Today, 05:13 PM
|
0 responses
7 views
0 likes
|
Last Post
by quantismo
Today, 05:13 PM
|
Comment