PDA

View Full Version : ExitLongLimit from different strategy


MindSabre
07-11-2007, 07:38 AM
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

NinjaTrader_Ray
07-11-2007, 08:09 AM
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.

MindSabre
07-11-2007, 08:13 AM
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?

NinjaTrader_Ray
07-11-2007, 08:16 AM
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.