![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Dec 2008
Posts: 118
Thanks: 0
Thanked 0 times in 0 posts
|
I am new to ninjaScript. I try to print something out on to the Output window. Nothing being print out. This is what I did.
I first create a indicator called 'MyFirstIndicator'. Then I open the output window by clicking Tools/OutputWindow... in Control Center Window. Now I Open the chart and insert to the 'MyFirstIndicator' indicator. I can see the indicator show up on the chart, but nothing being displayed in the output. Here is my code. I wonder if there is an flag I need to set. protected override void Initialize() { Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0")); CalculateOnBarClose = true; Overlay = false; PriceTypeSupported = false; Print ("My First Indicator"); Print (Instrument.FullName); } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Use this method for calculating your indicator values. Assign a value to each // plot below by replacing 'Close[0]' with your own formula. Plot0.Set((Close[0]+Open[0])/(High[0]+Low[0])); Print (Close[0]); } |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
All errors will show up in your Control Center logs. The line of code that is most likely producing an error is this one: Print (Instrument.FullName);
You likely cannot access that property from within the Initialize() method. If you just want to print out the instrument name once I suggest you do it in the OnBarUpdate() method within this if-statement: Code:
if (CurrentBar == 0)
{
Print (Instrument.FullName);
}
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Certified NinjaScript Consultant
Join Date: Sep 2006
Location: New York, USA
Posts: 774
Thanks: 1
Thanked 7 times in 5 posts
|
First, I don't think you can use the Print function in Initialize().
Always check the LOG when things aren't as you think they should. The Print on the bottom should look like this. Code:
Print("Close = " + Close[0].ToString());
"You look closely enough, you can find everything has a ... weak spot where it can break, sooner or later"
PureLogikTrading |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: May 2009
Location: DFW
Posts: 20
Thanks: 0
Thanked 0 times in 0 posts
|
Actually, you can use Print statements in initialize.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Output window | funk101 | Strategy Development | 7 | 07-12-2010 01:35 PM |
| why is this not printing to the output window | junkone | General Programming | 8 | 11-26-2008 07:35 AM |
| Print to Output | heech | Strategy Development | 3 | 11-15-2008 07:41 PM |
| What are these in the OUtput Window? | paco99 | Strategy Development | 2 | 08-10-2008 10:27 AM |
| Printing the Output Window | RVRoman | General Programming | 3 | 08-07-2008 10:57 PM |