Risk Disclosure

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View full risk disclosure.

SiRaven


SiRaven is a NinjaTrader Strategy, which extends the functionality of BloodHound to automatically place trade entries and exits.  It is free and complementary with BloodHound.

With SiRaven (Raven), you can take your BloodHound template and use it to place trade entries for a fully automated trading system within NinjaTrader.  You can specify a Profit target and Stop Loss, and Raven can even use BloodHound signals to flatten the position.

Using Raven

In NinjaTrader, you can choose to run a strategy by attaching it to a chart (similar to how you would start BloodHound) or by adding it directly to the Strategies tab in the NinjaTrader Control Center.  For more information on how to instantiate a NinjaTrader strategy see NinjaTrader’s documentation here.

Both methods are identical in terms of setting up Raven.  Below we will cover the more common way of running a Strategy by adding Raven to a chart.
Special Notes from NinjaTrader when running a strategy:
Strategy Position vs. Account Position

Setup

Begin by opening up a chart in NinjaTrader with your desired timeframe and indicators.  It is suggested to leave BloodHound off the chart, because Raven will add BloodHound to the chart.

Having BloodHound already on your chart before adding Raven will not affect Raven in any way, since the instance of BloodHound on the chart will be separate from Raven’s copy of BloodHound.

To add Raven start by right clicking on the chart and selecting “Strategies…”, followed by selecting SiRaven.  On the right hand side you will see the parameters for SiRaven. If Strategies… is grey & disabled see NinjaTrader’s documentation here to enable it.

Scroll to the top of the parameters list.  Begin with the Template parameter by clicking the “…” button, and opening the desired BloodHound template that you wish to auto-trade or back=test.

Specifying Entries

If your BloodHound template has Logic templates defined, and you would like to use one as your entry signals, select it from the Entry Logic parameter.  If you do not have a Logic template defined, Raven will default to BloodHound’s Solver tab signals, which incorporates all the checked solvers on the Solver tab (the Standard version only has the Solver Tab).

Once a position has been opened Raven will not open or add any more contracts to the current position, in the same direction. For example, if your BloodHound system gives a Long signal and Raven opens a Long position, then a few bars later BloodHound gives another Long signal, Raven will not open anymore Long positions until the current Long positions is closed or reversed.

Advanced feature: If your BloodHound file contains multiple Logic templates for different entry signals, Raven can switch between them on-the-fly. For example, say your BloodHound file has two Logic templates, one of the Logic templates works best in a trending market condition. The other Logic template works best in a consolidating market. In order to switch Raven from one Logic template to the other on-the-fly, leave the Entry Logic parameter on None. Then, after Raven is loaded on the chart, use the pull-down menu as seen above, next to the Orange labeled button, to select which Logic template you want Raven to use to execute trade signals.

Specifying Exits

Just as you can specify the entry conditions to open a trade, you can also use BloodHound’s logic to create exit signals which will close/flatten a position.

To do this, create a new Logic template that gives signals when you want to exit a trade.  Keep in mind that exit signals are opposite of entry signals.  A Short signal will close a Long position, and a Long signal to close a Short position.  Select the exit template from the drop down menu in the Exit Logic parameter.  If a Exit signal occurs on the same bar of an Entry signal, the Entry signal is ignored.

A Short signal will close a Long position, and a Long signal to close a Short position. Exit signals can Not open a position or reverse a position.

Starting & Ending Raven

There are a couple of NinjaTrader settings that affect order handling when enabling or disabling Raven.  The NinjaTrader settings mentioned are found in Options > Strategies tab > NinjaScript tab.
When enabling Raven, having NinjaTrader’s ‘Immediately submit live working historical orders‘ selected, Raven > Backtest Mode = True, and Raven > Manage Trades Using = Default, NinjaTrader will immediately submit an entry order in the direction of Raven’s last historical entry order.  Setting Raven > Backtest Mode = False will prevent immediate order submission.  If Raven > Manage Trades Using = ATM, ATM orders can not be immediately submitted, because NinjaTrader can not track/backtest historical ATM orders. To see the Backtest Mode option, ‘Start Auto Enabled On’ must be True or ‘Show Chart Trader’ must be False.

In Options > Strategies tab > NinjaScript tab > Order handling, you may want to select ‘Cancel entry orders when a strategy is disabled, and uncheck ‘Cancel exit orders when a strategy is disabled’.

If you do not fully understand the setting in Options > Strategies tab > NinjaScript tab, then we suggest selecting ‘Wait until flat before executing live’

Parameters


Strategy Template

This parameter is used to load the BloodHound file that Raven will trade.  Clicking on this parameter will reveal an […] ellipsis button.   Click the button to open the BloodHound interface and load the file you want Raven to trade.
This pull-down menu is used to select which BloodHound Logic template that Raven will use to enter trades.  After the BloodHound file is loaded (see Template above) this pull-down menu will reveal all the Logic templates from that file.   Raven will use the signals from the selected Logic template to execute trades.  Tip: Leaving this set to (None) will allow you to change the Logic template Raven will trade on-the-fly by changing the pull-down menu on the chart. See Specifying Entries above for a detailed explanation.
This pull-down menu is used to select which BloodHound Logic template that Raven will use to close an open trade.  See Specifying Exits above for a detailed explanation.
This setting is common to the BloodHound ‘Compare Long and Short Confidence’ parameter.  A description can be found on this page.
This setting is common to the same BloodHound parameter.  A description can be found on this page.
This setting is common to the same BloodHound parameter.  A description can be found on this page.
This setting is common to the same BloodHound parameter.  A description can be found on this page.

Entry Order Options

Change to True if you wish to enter a trade using Limit orders. False will use Market orders.

The Limit order will be canceled if not filled after this number of bars have passed. Setting to -1 will leave the Limit order open indefinitely until the next entry signal occurs.

When ‘Calculate on Bar Close’ = True, this value is an offset from the Close price of the last bar.  When ‘Calculate on Bar Close’ = False, this value is an offset from the current price.

A negative value will place the Limit order at a “better” entry price which requires price to retrace back to get filled.  IE, -5 ticks will adjust a Long limit at 52.50 to 52.45 for better price, and a Short limit at 52.50 will be adjusted to 52.55.

A positive value will generally get filled immediately, because it will place the Limit order at the market price or beyond.  If the limit price is beyond the current market price the exchange will immediately fill the Limit order(not Stop Limit) at the best available price.   Please note: Raven does not submit Stop Limit orders.  Click the link for information on Measured In units.

This setting only applies when ‘Calculate on Bar Close’ = False.  When set to False, Raven will enter a trade only once per bar.  When True, it will be possible for Raven to enter multiple trades in the same bar after the Profit target or Stop Loss is filled (placing Raven flat) and the trade signal still exists.

Options

When False, all Entry Logic signals will be taken, which will reverse a trade if necessary.  When True, Entry Logic signals will be ignored if there is an open position.  Reversing a trade will not happen.

This is a safety feature that turns the Auto Enabled button off, putting Raven in a disabled state when it loads on the chart.  Click the Auto button when you want Raven to start auto trading.  When False, Raven’s auto trading is disabled on start up.  This also disables back-testing.  When True, Raven will start auto trading immediately.  For back-testing set this to True and the Backtest Mode parameter will appear.

‘Start Auto Enabled On’ must be True or ‘Show Chart Trader’ must be False to use this option.

When False, back-testing is turned off.  Only trades on live data are executed.  When True, back-test results can be seen, and Strategy Performance reports generated. Please note, NinjaTrader can not back-test an ATM.  Please see the notes below in the Trade Management section.

When True, Raven’s Chart Trader panel is visible.  When False, the Chart Trader panel is turned off, and the ‘Start Auto Enabled On’ parameter is removed, since it becomes irrelevant.  Backtest Mode becomes visable, unless ‘Manage Trades Using’ is set to ATM.  In which case, Backtest Mode is set False and removed, because NinjaTrader can not back-test an ATM.

When True, Raven’s entry & exit signals will override a trade placed by Raven’s Manual Entry buttonse.g., If you use the ‘Go Long’ button, placing Raven in a Long position, and a Exit Long signal occurs Raven will flatten the position automatically (overriding your manual trade).  In the same situation, if a Short entry signal occurred Raven would reverse the manual Long position to a Short position. Please Note: A strategy runs in its own memory space. Therefore, Raven is unaware of other Raven strategies that are running or any other trades that may be open. This means that Raven can not affect or override any other trades. Raven can only affect its own instance of executed trades.

Trade Management

The Trade Management section allows you to choose options for managing the Profit target and Stop Loss. You can have Raven manage the orders or use your saved NinjaTrader ATM strategy. Raven will manage a single Profit target and Stop Loss. These are submitted as OCO orders.

Managing Trades Using

Select Default to have Raven manage the Target and Stop Loss.  Or, select ATM to have Raven submit your predefined ATM of choice. Click the tab below for each mode.

Quantity Set the number of contracts to trade.

Note for Forex: Please see the NinjaTrader Help guide for settingForex contract sizes.

Measurement Unit Choose the unit of measurement that you desire to calculate the Profit Target & Stop Loss offset from the entry price.
    ATR Use a multiple of the ATR value to calculate the Profit target & Stop Loss offset.  This uses volatility to increase or decrease the size of your system’s Profit target or Stop Loss.  Here are some helpful articles on the ATR, Definition of ATRMeasure Volatility With ATR
    Percent Set a percentage offset, of the instrument’s price.  In the Profit Target field a value of 0.2 is 0.2%.  A value of 1 is 1%.  IE, If trading the 6E, and the entry price is 1.1000.  A 1 percent offset is a 0.0110 price difference (110 ticks)..  This measurement type may be more useful for stock traders.
    Ticks Set a fixed number of ticks offset.  Forex traders see this post by NinjaTrader support.
Profit Target This submits a limit profit target order to exit a position.  This value sets the offset from the position entry price.
Stop Loss This submits a Stop-loss order to exit a position.  This value sets the offset from the position entry price.  To set the Stop-loss to equal a dollar amount take the dollar amount and divide it by the tick value of the instrument being traded.  I.E. If trading /CL and you want a $150 Stop-loss, take $150 / $10 (CL=$10/tick) = 15 ticks.  /ES $150 Stop-loss = $150 / $12.50 = 12 ticks.
Trail The Stop Loss This will convert the above Stop-loss into a trailing Stop-loss.  The trailing distance is set by the above Stop Loss amount.  The Trailing Stop will be updated when the bar closes, when ‘Calculate on Bar Close’ = True.  The Trailing Stop will be updated on a tick by tick basis when ‘Calculate on Bar Close’ = False.
ATM Template Name Type the ATM name you desire to trade.  Do not use special characters such as, ! @ # $ % ^ & * ( )

Special Notes: NinjaTrader can only back-test an ATM using Market Replay data or in live forward testing.
Other notes from NinjaTrader when using an ATM strategy:
1) ATM PnL data is not shown in the Control Center > Strategies tab. PnL data can be generated in the Account Performance tab.
2) For Back-testing and various other strategy parameters that are affected when using an ATM please read NinjaTrader’s Help guide on Using ATM Strategies

Signals

Changing to True will reveal four audio settings that will allow you to select an audio file to play when a order is executed.  Note: NinjaTrade sounds, found in Options, override these alert sounds.


Common NinjaTrader Parameters


General

All the parameters in the General section are added by NinjaTrader and common to all strategies.  A description of each setting can be found in the Understanding strategy properties section of NinjaTrader’s Help guide.

Historical Fill Process

All the parameters in this section are added by NinjaTrader and common to all strategies.  A description of each setting can be found in the Understanding strategy properties section of NinjaTrader’s Help guide.

Order Handling

All the parameters in this section are added by NinjaTrader and common to all strategies.  Please note, regarding TIF parameter some instruments can not be traded using Gtc and must be changed to Day.  Your broker can help with in this matter.  A description of each setting can be found in the Understanding strategy properties section of NinjaTrader’s Help guide.

Order Properties

All the parameters in this section are added by NinjaTrader and common to all strategies.  A description of each setting can be found in the Understanding strategy properties section of NinjaTrader’s Help guide.


Video Tutorial


This video is from a weekly Workshop. The whole video is dedicated to the topic of Raven.


What’s the difference between Raven and BlackBird?



Raven’s Chart Trader


Raven’s Chart Trader provides manual control over Raven’s operations.  The exhibit below will explain the various interface components.

Raven Chart Trader

Number 1 This button instantly disables or enables Raven’s entry order submissions.  When disabled, Raven will stop placing new entry orders.  The Exit Logic is not disabled.  Raven will still close a position according to the Exit Logic.  Raven will continue to trail the stop loss if ‘Trail The Stop Loss’ = True.  Open/working orders are not affected.  To cancel an open entry order use the Close button.

Number_2 This group of buttons allows the trader to manually place an entry order.  If a position is open and a button is pressed to submit an order in the opposite direction, the current open position will be closed and the order reversed.  These buttons will place either a Default or ATM order as specified in Raven’s Trade Management section.

  • Go Long & Go Short buttons place Market orders.
  • Buy Ask & Sell Ask places a Limit order at the current Ask.
  • Buy Bid & Sell Bid places a Limit order at the current Bid.

Note:  The ‘Auto Trades Override Manual’ setting will change the behavior of Raven when a Manual Entry button is used.  Please review the ‘Auto Trades Override Manual’ section above.

Trades executed from Raven’s Chart Trader buttons will not affect other trades.  A strategy runs in its own memory space. Therefore, Raven is unaware of other Raven strategies that are running or any other trades that may be open. This means the Manual Entry Buttons can not affect or override any other trades.  Raven can only effect its own instance of executed trades.

 

Number_3 The Close button will flatten any open position or cancel all entry & exit positions.  The button will only close positions placed by that instance of Raven.  It will not close positions placed by other instances of Raven.

NinjaTrader’s Chart Trader Close button: Please note, the Close button on NinjaTrader’s Chart Trader will flatten all open positions in that instrument, and thus disable any running strategy, such as Raven, on that instrument.  NinjaTrader’s explanation can be found here Action Buttons and support forum.

If an error occurs and NinjaTrader loses tracking of an executed order, Raven will not be able to Close/Cancel its contracts or positions.  Should this occur use the NinjaTrader Control Center > Order tab to Cancel an order, or the Positions tab.  In an emergency use Control Center > File menu > Flatten Everyhing.
Number_4 The upper left shows the current position size, and turns green for a Long position or red for a Short position.  The upper right shows the average position price.  The black display area shows the PnL for the current open trade.  When Raven is flat the total PnL for all real-time trades is shown, since Raven was first started.  Clicking the PnL display area will toggle the display unit between Ticks, Percent, or Currency.

Note:  NinjaTrader’s DOM shows the last trade PnL, while Raven shows the strategies running total PnL from the time it was first started.  Disabling and re-enabling Raven will reset the PnL.
Number_5 This displays the current Ask price, Last trade price, and Bid price.
Number_6 Displays the current state of Raven’s order.

Discretionary Trade Management


Raven’s Chart Trader provides manual control over the Profit Target and Stop Loss price placement.

Raven Chart Trader Order Flags
Number 1 Modifying Order Price  To modify the price of an order, left click with your mouse on the order line or the right section of the label. A ghost order line will appear and display the number of ticks you are away from the market.
When above the ask the label will display a positive value, below the bid the label will display a negative value. At the ask the label will display @Ask and at the bid the label will display @Bid.
Once you have the ghost order at the price you desire, left click with your mouse to complete the modification. This is a click once and click again method, you do NOT click and drag.
Note:  When Trail The Stop Loss is True, the Stop Loss will always move back to the calculated trailing stop price.

Number_2 Cancelling an Order  To cancel an order, left mouse click on the red X on the order marker.

Strategy Analyzer


Using Raven in the Strategy Analyzer allows you to run historical analysis on a basket of instruments.  Click here for the Strategy Analyzer Help guide.  Due to some unusual behavior of the Strategy Analyzer these simple steps should be followed before running the Strategy Analyzer.  Open the NinjaTrader Historical Data Manager (found in the Control Center under the Tools menu) and download all the historical data you want to backtest against, while the data feed is connected.  Then disconnect the data feed before clicking Run Backtest.

Optimization

The Optimization feature is not able to access the indicator parameters inside BloodHound solvers, and therefore has limited practical value.  The Profit Target and Stop Loss parameters of Raven can be optimized.  We will be looking into a solution with BloodHound v2.

Tips & Misc. Backtest Help


Performance

It is a good idea from time to time to reset the NinjaTrader database to help with performance.  If you start to notice NinjaTrader pausing when an order is submitted, or a delay in the time it takes for an order to execute, or it takes a longer time for Raven to start up, then that might be a sign that NinjaTrader’s database is getting to big, and resetting it typically helps. To reset the database open the Options window, select the Data tab, then click Reset DB button.

Backtesting

Know the Risks of Computerized Trading

We want you to be aware there a numerious components, both hardware and software, involved with computerized and automated trading.  The process starts with your computer, running Windows, running NinjaTrader, and running Raven.  When Raven receives a “signal” from your BloodHound logic, it is sent to NinjaTrader’s order framework.  At which point NinjaTrader sends the order to your Broker, who must approve the order and then sends it to the Exchange.  If your order is filled the exchange notifies your broker, who then notifies NinjaTrader, and NinjaTrader updates Raven.  As this simplified example illustrates, there are several components & “players” involved and lots of software programs that make this all happen.  If there is any miscommunication among these components or internet issues, Raven may get out of sync with your positions at the Exchange.  If you suspect any issue with your live orders use the ‘Flatten Everything’ option in the NinjaTrader Control Center, and then call your broker immediately to verify.