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 04-05-2009, 08:53 PM   #1
ntfarmer
Junior Member
 
Join Date: Mar 2009
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Testing first strategy

Total newbie here, to both NT and C#. Trying to test a simple strategy to ensure I understand the concepts. Just want it to draw a dot when the condition is met. I bring up a daily chart using a Yahoo connection, apply the strategy. Doesn't seem to be working. Thanks for help.

ps....wish you ran more "Intro to Ninjascript" online classes. Hard to come by.

#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.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
///<summary>
/// Indicates Three Lower Closes
///</summary>
[Description("Indicates Three Lower Closes")]
publicclass ThreeLowerClosesTest : Strategy
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion
///<summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
///</summary>
protectedoverridevoid Initialize()
{
CalculateOnBarClose =
true;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
// Condition set 1
if (Close[0] < Close[1]
&& Close[
1] < Close[2]
&& Close[
2] < Close[3])
{
DrawDot(
"My dot" + CurrentBar, false, 0, 0, Color.Blue);
}
}
#region Properties
#endregion
}
}
#region Wizard settings, neither change nor remove
ntfarmer is offline  
Reply With Quote
Old 04-05-2009, 09:34 PM   #2
roonius
Certified NinjaScript Consultant
 
Join Date: Oct 2008
Location: Chicago, IL
Posts: 523
Thanks: 0
Thanked 3 times in 3 posts
Send a message via Skype™ to roonius
Default

Quote:
Originally Posted by ntfarmer View Post
Total newbie here, to both NT and C#. Trying to test a simple strategy to ensure I understand the concepts. Just want it to draw a dot when the condition is met. I bring up a daily chart using a Yahoo connection, apply the strategy. Doesn't seem to be working. Thanks for help.

ps....wish you ran more "Intro to Ninjascript" online classes. Hard to come by.

#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.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
///<summary>
/// Indicates Three Lower Closes
///</summary>
[Description("Indicates Three Lower Closes")]
publicclass ThreeLowerClosesTest : Strategy
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion
///<summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
///</summary>
protectedoverridevoid Initialize()
{
CalculateOnBarClose = true;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
// Condition set 1
if (Close[0] < Close[1]
&& Close[1] < Close[2]
&& Close[2] < Close[3])
{
DrawDot("My dot" + CurrentBar, false, 0, 0, Color.Blue);
}
}
#region Properties
#endregion
}
}
#region Wizard settings, neither change nor remove
Your dots are beeing drawn at price level 0. And with autoscale set to false you simply don't see them.
roonius 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
Testing a strategy against indices SuperDriveGuy Strategy Analyzer 4 03-18-2009 02:10 PM
Strategy Testing kipper Strategy Development 1 01-07-2009 05:59 AM
Testing Stochastic with Strategy Analyzer ek1688 Strategy Analyzer 6 01-05-2009 06:47 AM
Testing the same strategy on a continuous future pablo_lasuncion Strategy Analyzer 9 10-17-2008 04:17 PM
forward testing a strategy miketpcc2 Strategy Analyzer 1 08-18-2008 09:36 AM


All times are GMT -6. The time now is 10:23 AM.