![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Apr 2007
Location: , ,
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Apr 2007
Location: , ,
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |