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-09-2007, 11:43 PM   #1
abikambic
Junior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 23
Thanks: 0
Thanked 0 times in 0 posts
Default Does this look finished in the coding

This code below is for a stop and reverse type of trading for price movement only, no indicators.I will always be in the market, going short,than closing the short and than going long, than closing the long and than going short, just following the price movement,always in the market. Does this look finished and complete or am I omitting something.


/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (High[0] > High[1])
{
EnterLong(DefaultQuantity, "");
}

// Condition set 2
if (Low[0] < Low[1])
{
EnterShort(DefaultQuantity, "");
}
}

#region Properties
#endregion
}
}

There cannot be much missing, if there is something missing, this type of stop and reverse is a very simple and short code.

Thanx,
Steve
abikambic is offline  
Reply With Quote
Old 05-09-2007, 11:54 PM   #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

Your code below does not look unreasonable. However, you need to test and verify. Note: Due to bandwidth reasons we can not provide support to a level of "does my strategy work as I would expect".
NinjaTrader_Dierk 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
Money Management Coding wiguidry Strategy Development 1 04-11-2007 07:53 AM


All times are GMT -6. The time now is 07:02 AM.