![]() |
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
|
|||||||
| Version 7 Beta General Questions & Bug Reports Ask questions here and post bug reports. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: May 2009
Location: Asia
Posts: 304
Thanks: 0
Thanked 9 times in 5 posts
|
Hi Ninja Team,
This is probably a simple thing but has me scratching my head. I have a simple MA cross strategy with an entry and trail stop running on five min bars, CalculateOnBarClose = false so that it enters and trails on every tick. The thing is I want the indicators (the MAs) to be CalculateOnBarClose=true. I've tried Add(PeriodType.Tick, 1) with the Strategy COBC set to true, then moved the SetStopLoss() logic from Initialize() to OnBarUpdate like this; ...OnBarUpdate() if(BarsInProgress ==1)// 1 tick series { SetTrailStop(etc etc); } DoSomethingElse at close of bar; But that still seems to only fire at close of bar. Am I missing something simple? Thanks! |
|
|
|
|
|
#2 | |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
Quote:
http://www.ninjatrader.com/support/f...ad.php?t=19387 This would allow you to combine OnBarClose and OnEachTick calcs in the strategy using one frame only.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
|
#3 |
|
Senior Member
Join Date: May 2009
Location: Asia
Posts: 304
Thanks: 0
Thanked 9 times in 5 posts
|
Forgot about that one!
In the mean time, adding a line to reset my trail stops when flat seems to have solved my issue. In OnBarUpdate() before the trade logic: PHP Code:
|
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strategy.CalculateOnBarClose=true vs. Indicator.CalculateOnBarClose=false | karimatka | Strategy Development | 7 | 05-23-2011 03:39 AM |
| CalculateOnBarClose = false\true | nkonkov | Strategy Development | 3 | 06-17-2010 03:28 AM |
| CalculateOnBarClose=true; but then false | stephenszpak | Strategy Development | 1 | 01-02-2010 01:42 AM |
| Statements if/true/false | skikg | General Programming | 2 | 12-09-2009 01:45 PM |
| Simulation, true or false? | RVRoman | General Programming | 1 | 09-02-2008 02:34 AM |