PDA

View Full Version : Strategy: Resetting values at the beginning of new trading sessions


NinjaTrader_Josh
07-29-2009, 02:49 PM
Reference sample for NinjaTrader 6.5.xxxx.x or greater.

Normally calculated values are carried over between trading sessions, but sometimes you may want to reset these values to begin a trading session fresh. The technique demonstrated in this reference sample can be useful to do things like resetting counters you may be running or clearing bool flags you may have set.

This reference sample demonstrates the following concepts:

Resetting a variable at the beginning of a new trading session
Limiting the number of trades a strategy can make per trading session

Important methods and properties used include:

FirstBarOfSession (http://www.ninjatrader.com/support/helpGuides/nt7/firstbarofsession.htm)
FirstTickOfBar (http://www.ninjatrader.com/support/helpGuides/nt7/firsttickofbar.htm)

Other methods and properties of interest include:

EnterLong() (http://www.ninjatrader.com/support/helpGuides/nt7/enterlong.htm)
ExitLong() (http://www.ninjatrader.com/support/helpGuides/nt7/exitlong.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