NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 05-23-2008, 10:23 AM   #1
WDieter
Junior Member
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Print()

Why has the following compiled without error:

/*else*/if (e.MarketDataType == MarketDataType.Ask)
Print(
"Ask = " + e.Price + " " + e.Volume);

But.....

if (LastClientPipeHandle.IsInvalid)
Print(
"No LastClientPipeHandle");

Creates the error:

"An object reference is required for the non-static field, method or property 'NinjaTrader.Indicator.IndicatorBase.Print(string) '".
WDieter is offline  
Reply With Quote
Old 05-23-2008, 10:48 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Likely because sample 2 is not part of an indicator method or the method is a static method.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 05-23-2008, 10:55 AM   #3
WDieter
Junior Member
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default

OK, thanks for the tip. I had defined the method that this snippet was a part of as 'static'. Took that word out and it all compiles ok. Thank you.
WDieter 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
Accessing Print() from custom class... funk101 Indicator Development 9 04-27-2012 04:15 PM
Print Triangle at MA Crossover cutter Indicator Development 9 05-30-2009 03:45 AM
Very Starnge outputs between Print & File!? mktrend Automated Trading 2 04-10-2008 03:12 PM
Print() and INT() doesn't work. Jenny Strategy Development 8 07-26-2007 05:47 PM
NinjaScript Debug Methods: Print command OnePutt General Programming 1 11-18-2006 10:18 PM


All times are GMT -6. The time now is 09:33 PM.