NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 07-11-2007, 07:38 AM   #1
MindSabre
Junior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
Default ExitLongLimit from different strategy

Is there any way to use 2 separate strategies one for entries, the other for exits?

The reason is that I want the exit strategy to use CalculateOnBarClose=false, while the entry strategy is CalculateOnBarClose = true.

Alternatively is there any way to use CalculateOnBarClose=true but selectively run some of the code only on the bar close (or vice-versa)?

MindSabre
MindSabre is offline  
Reply With Quote
Old 07-11-2007, 08:09 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

No.

But what I would do is have one strategy and set CalculateOnBarClose=false.

Then filter your entry logic like:

// Entry logic
if (FirsTickOfBar)
{
if (Close[1] > Close[2])
// Go long
}

Since you really want to process the close of the bar, you need to check for values 1 bar ago since you are on the first tick of the new bar.
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-11-2007, 08:13 AM   #3
MindSabre
Junior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
Default

Yes, but won't "if (Close[1] > Close[2])" compare closes of the past 2 *ticks* rather than the past 2 bars?

How do I compare bars when CalculateOnBarClose=false ?

Also how do I use indicators? Will the indicators calculate on actual bars or ticks?
MindSabre is offline  
Reply With Quote
Old 07-11-2007, 08:16 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

You are *always* comparing bars, never ticks. The difference is, OnBarUpdate() is called on each incoming tick vs the close of each bar. The data references is either the close of the bar data or the bar data as it is in formation.
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
ExitLongLimit order with Signal Name Nathamus Strategy Development 5 03-13-2007 04:14 AM
ExitLongLimit order with Signal Name Nathamus Automated Trading 4 12-31-1969 06:00 PM


All times are GMT -6. The time now is 07:32 PM.