Skip to content
Black Friday: sale starts November 15th.

TimeBlock

TimeBlock marks blocks of time and specific times of day, for use in BloodHound’s Threshold solver.

Use it with the Threshold solver to pick out any of its outputs. For example:

  • A block of time, for an exit signal that flattens any open position before the market closes.
  • A specific time, to reset a Function node that’s blocking signals so signals can resume.
  • Trading holidays, to keep a system from trading on them.

It also gets around a limitation of the Time Session solver. NinjaTrader doesn’t transfer custom session templates to other computers, so a BloodHound template that uses Time Session with a custom session template only works on another computer if that session template is recreated there. TimeBlock in a Threshold solver doesn’t have that problem.

Properties

TimeBlock properties
SettingWhat it does
Start TimeThe start of the block of time.
End TimeThe end of the block of time.
Use on Monday … SundayWhich days of the week the block applies to.
Show TextWrites the outputs’ current values on the chart (see the image below).
Text ColorThe color of that text.
Text LocationWhere on the chart the text goes.
Color chart backgroundColors the chart background with the three colors below.
Before Start Time ColorFrom midnight to the Start Time (yellow in the image above). With the default times, usually pre-market hours.
Between Start & End Time ColorFrom the Start Time to the End Time (dark in the image above). With the default times, usually trading hours.
After End Time ColorFrom the End Time to midnight (purple in the image above). With the default times, usually after-hours.
TimeBlock's chart text showing each output's value

Outputs for BloodHound

Each output is true or false (a BoolSeries): 1 for true, 0 for false. In a Threshold solver, a rule like “equals 1” produces a signal on the bars where the output is true.

OutputTrue (1) on
IsStartBarThe bar at the Start Time.
IsEndBarThe bar at the End Time.
BeforeStartTimeEvery bar from midnight up to, but not including, the Start Time bar.
BetweenTimesEvery bar from the Start Time to the End Time.
AfterEndEvery bar after the End Time bar, up to midnight.
FirstBarOfDayThe first bar after midnight. Useful for resetting Function nodes at the start of each day.
IsTradingHolidayBars on a holiday or partial holiday, according to the instrument’s Trading Hours template.

Blocking signals on holidays

To stop a system trading on holidays, let signals through only on non-holiday bars:

  1. Add a Threshold solver that outputs 1 when IsTradingHoliday equals 0 (not a holiday).
  2. Connect it to the last AND node in your logic. On holidays it outputs 0, so the AND node blocks the signal.

Keep Trading Hours up to date

IsTradingHoliday only works if NinjaTrader’s Trading Hours templates are up to date. NinjaTrader support can help you update them.

Videos

Still stuck? Contact support