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 > Application Technical Support > Miscellaneous Support

Miscellaneous Support Miscellaneous support issues.

Reply
 
Thread Tools Display Modes
Old 05-24-2008, 04:20 PM   #1
stephenszpak
Senior Member
 
Join Date: Apr 2006
Location: , ,
Posts: 192
Thanks: 3
Thanked 0 times in 0 posts
Default my first script

I seem to be missing something here.
I can't get NinjaScript to work at all.
I'm just trying to get it to print Hi at the output window and
ever time I add anything to the bottom of what is below
I will get an error. If I figure this out tonight I will repost.
Putting // with comments if just fine
but anything else results in an error, usually Namespace
Member Declaration Expected.




Thanks to any replies. -Stephen

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
[Description("Enter the description of your new custom indicator here")]
public class MyCustomIndicator : Indicator
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = false;
}

/// <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]);
}

#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot0
{
get { return Values[0]; }
}

[Description("")]
[Category("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}
stephenszpak is offline  
Reply With Quote
Old 05-24-2008, 05:04 PM   #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

Try deleting this script and start again.

Close it, then select Tools > Edit NinjaScript > Indicator > selec this and press Delete button.
NinjaTrader_Ray is offline  
Reply With Quote
Old 05-24-2008, 05:34 PM   #3
stephenszpak
Senior Member
 
Join Date: Apr 2006
Location: , ,
Posts: 192
Thanks: 3
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
Try deleting this script and start again.

Close it, then select Tools > Edit NinjaScript > Indicator > selec this and press Delete button.
Clearing the screen doesn't help.

This is the program I wish to use:

//Either/Or decision
int x=1;
if (x==0)
{
Print("Hi");
}
else
{
Print("Buy");
}

>>>>>>>>>>>>> Sorry..

Might be on the wrong screen, but I don't think you want me to delete all
the NinjaTrader indicators??
Last edited by stephenszpak; 05-24-2008 at 05:38 PM.
stephenszpak is offline  
Reply With Quote
Old 05-24-2008, 07:28 PM   #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

I wanted you to delete the indicator causing the issue and start from scratch.

Here is a reference for debugging compile errors.

http://www.ninjatrader-support.com/v...ead.php?t=4678
NinjaTrader_Ray is offline  
Reply With Quote
Old 05-24-2008, 07:35 PM   #5
stephenszpak
Senior Member
 
Join Date: Apr 2006
Location: , ,
Posts: 192
Thanks: 3
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
I wanted you to delete the indicator causing the issue and start from scratch.

Here is a reference for debugging compile errors.

http://www.ninjatrader-support.com/v...ead.php?t=4678
Ray

Thanks, there is no indicator to my knowledge.
I'm just trying to get some of the simple programs at "Getting Started with NinjaScript-
Basic Syntax" to run. The program below is just 10 lines of code. I think I must
be putting it in the wrong screen or something. Sorry this is so confusing to us.

Is it possible for you to post an image of what I should be seeing on my computer
and also where to add my short program within the image?

-Stephen
Last edited by stephenszpak; 05-24-2008 at 08:59 PM.
stephenszpak is offline  
Reply With Quote
Old 05-25-2008, 07:58 AM   #6
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

Stephen,

What you should be seing is "no errors".

- Shut down NT
- Restart
- Tools > Edit NinjaScript > Indicator
- Select "any" indicator, press F5
---> Does it compile?

- NO, then delete the problem files as per my earlier messages/links
- YES, great then there is no problem
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
Script is Script is Script Json Suggestions And Feedback 19 04-23-2008 08:23 AM
tradestation script frankvdplas Miscellaneous Support 1 02-19-2008 02:08 AM
Script conversion ronblack Strategy Development 3 12-02-2007 09:55 AM
Add API instruction in the script. khawaja Automated Trading 10 10-31-2007 01:46 PM
Help with my first script (3 bar reversal) ClydeMacLeod General Programming 4 10-21-2007 05:58 AM


All times are GMT -6. The time now is 12:39 PM.