NinjaTrader_Josh
08-05-2009, 04:51 PM
Reference sample for NinjaTrader 6.5.xxxx.x or greater.
Depending on your trade ideas, the timing of entries and exits could be crucial. Sometimes waiting 30 seconds for a bar to close is too long when you are trying to exit a position. To address this you could select your strategy to calculate on every single tick, but this may impact your entry timings. For example, crossover entries could flip back and forth making it difficult to place entry orders. If you are facing this issue, it is possible to separate out parts of your strategy logic to calculate on every single tick and other parts to calculate once at the end of each bar.
This reference sample demonstrates the following concepts:
Running some logic once per bar
Running other logic on every single tick
Important methods and properties used include:
CalculateOnBarClose (http://www.ninjatrader.com/support/helpGuides/nt7/calculateonbarclose.htm)
FirstTickOfBar (http://www.ninjatrader.com/support/helpGuides/nt7/firsttickofbar.htm)
Other methods and properties of interest include:
CrossBelow() (http://www.ninjatrader.com/support/helpGuides/nt7/crossbelow.htm)
EnterLong() (http://www.ninjatrader.com/support/helpGuides/nt7/enterlong.htm)
Import instructions for NinjaTrader 6.5.XXXX.X or greater:
Download the file contained in this thread to your PC desktop
From the Control Center window, select the menu File > Utilities > Import NinjaScript
Select the downloaded file
Depending on your trade ideas, the timing of entries and exits could be crucial. Sometimes waiting 30 seconds for a bar to close is too long when you are trying to exit a position. To address this you could select your strategy to calculate on every single tick, but this may impact your entry timings. For example, crossover entries could flip back and forth making it difficult to place entry orders. If you are facing this issue, it is possible to separate out parts of your strategy logic to calculate on every single tick and other parts to calculate once at the end of each bar.
This reference sample demonstrates the following concepts:
Running some logic once per bar
Running other logic on every single tick
Important methods and properties used include:
CalculateOnBarClose (http://www.ninjatrader.com/support/helpGuides/nt7/calculateonbarclose.htm)
FirstTickOfBar (http://www.ninjatrader.com/support/helpGuides/nt7/firsttickofbar.htm)
Other methods and properties of interest include:
CrossBelow() (http://www.ninjatrader.com/support/helpGuides/nt7/crossbelow.htm)
EnterLong() (http://www.ninjatrader.com/support/helpGuides/nt7/enterlong.htm)
Import instructions for NinjaTrader 6.5.XXXX.X or greater:
Download the file contained in this thread to your PC desktop
From the Control Center window, select the menu File > Utilities > Import NinjaScript
Select the downloaded file