NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Suggestions and Feedback > Suggestions And Feedback

Suggestions And Feedback New feature suggestions and feedback.

Reply
 
Thread Tools Display Modes
Old 04-12-2008, 09:01 AM   #1
GaryAlbers
Senior Member
 
Join Date: Nov 2007
Location: Arlington Heights, IL
Posts: 100
Thanks: 0
Thanked 4 times in 4 posts
Default Color variable not being initialized if Indicator is included in a Template

I have an indicator which has a parameter that is a Color type.
Everything works as expected when that indicator is added to the chart through the Indicators selection dialog. However, if that indicator is saved
as part of a template and then that template is used as the default Chart Template when opening a new chart, then the variable which is supposed to be initialized to a Color is NOT initalized.

I have attached a simple indicator to demonstrate. Note that the variables are given inital values just like the wizard does.
The indicator simply prints to the output window the value of the variables.

To reproduce the bug:
-Save the indicator as part of a template.
-Open the output window.
-Open a chart with the template as the default.
-You will see in the output that the value of the color variable is empty.
-There are other variables, (an int and a double) that clearly have their values initialized correctly.

I believe this is some kind of bug that the color field is not being initialized like other variables are.

-Gary
Attached Files
File Type: cs GVariableInitTest.cs (6.0 KB, 3 views)
GaryAlbers is offline  
Reply With Quote
Old 04-12-2008, 10:14 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

You need to serialize the color.

See here - http://www.ninjatrader-support.com/v...ead.php?t=4977
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-14-2008, 09:04 PM   #3
GaryAlbers
Senior Member
 
Join Date: Nov 2007
Location: Arlington Heights, IL
Posts: 100
Thanks: 0
Thanked 4 times in 4 posts
Default

Ray, thanks for the solution.

Can I take a moment to point out that this is one of several issues I have
run across in my learning curve to pick up NinjaScript where the
documentation is not adequate. I could not find anything describing why
serialization for parms was required. Keep in mind, I would not know what
to search the forums for.
(BTW, I don't think forums are the best way to organize your
knoweldge base and make it easy for developers to learn.)

Other examples of issues I needed doc for:
- In the OnOrderUpdate method, what are the rules for knowing what bar
is being referred by Close[0]?
- More info is needed to describe the timing of all the various callbacks
NT can make.
- I have seen code that overrides some lower level paint method (I forget
exact name) but I did not see any doc on why you might care to do this
and rules to follow if you did
(code that needs to be done for the method to work right, etc).

It is hard to learn these 'NT software architecture' concepts from a help system meant for people using the trading platform.

I like the platform and think you guys have done a great job, but trying
to learn what it takes to use the NinjaScript well should not be so hard.

Keep up the good work.

Regards,
Gary
GaryAlbers is offline  
Reply With Quote
Old 04-15-2008, 07:10 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Thanks for your comments.

- Close[0] always refers to the current bar (Close[1] would refer to 1 bar ago)
- Not sure what you mean about timing of call backs but if you are referring to the sequence of how they are called --> I would never rely on any consistent order in which they may be triggered. Code your stratey in a away that accounts for randomness
- You don't see help since this is not overriding plot method is not officially supported
NinjaTrader_Ray is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
externally accessible custom indicator variable? Lost Trader General Programming 5 01-12-2008 02:27 AM
Commissions not included in PnL calculation Rollins Historical NinjaTrader 6.5 Beta Threads 10 12-13-2007 08:16 AM
Using a formula or variable as an input to an Indicator nolantx Indicator Development 5 05-24-2007 03:58 PM
Color Price Bar example or template rmactaggart Indicator Development 1 11-19-2006 03:22 PM
Will the new indicators be included in future NT revisions? Lupus Indicator Development 1 04-06-2006 09:17 AM


All times are GMT -6. The time now is 12:36 AM.