![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
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) '". |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Likely because sample 2 is not part of an indicator method or the method is a static method.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
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.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |