B4 Indicator [NinjaTrader 8]

thetradeengine

New member
Platform
  1. NinjaTrader
9hhc9Vm.jpg


File Download: B4 Indicator (NinjaTrader 8)

Here's my first copy of the B4 Indicator for NinjaTrader 8 (built off of v3.0.1 for TOS). To import go to Control Center -> Tools -> Import -> NinjaScript Add-On, then select the zipped file you downloaded named "B4Indicator.zip". You will then likely see some dialogs asking if you want to update copies of the built-in indicators used within in the script (MACD, StDev, etc), to which you can select "No".

Buy/Sell Signals
  • Signals are plotted on the upper chart as triangles above or below the candles
  • Accessible in the strategy builder as "BuySellOutput" (Buy = 1, Sell = -1, Neutral = 0)
Bull/Bear Vertical Lines
  • Vertical stripes are painted through both the upper and lower chart panels
  • Accessible in the strategy builder as "VerticalLineOutput" (Bull = 1, Bear = -1, Neutral = 0)
Candle Color
  • Accessible in the strategy builder as "CandleColorOutput" (Green Candle = 1, Red Candle = -1, Gray Candle = 0)
Squeeze
  • When in a squeeze the MACD & MACD Bollinger Bands turn orange
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

Update: Version 2
File Download: B4 Indicator (Ninjatrader 8) - V2

This version is exported with the most recent version of NinjaTrader 8 (8.0.25.0).

Changes:
  • Added squeeze dots.
  • Vertical lines plots are contained to just the indicator box and do not extend through the entire chart. I wanted to add a setting option for this, but adding additional inputs would be a breaking change for anyone that has already included the indicator in a strategy. If you want to change the vertical line style to how it was in the first version, on lines 245 and 250, change "BackBrush" to "BackBrushAll"
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

Update: Version 3
File Download: https://drive.google.com/file/d/1D0g5Rmtr6L9uWRpn9XH7HfL7lCtaWzs1/view?usp=sharing

This version exposes the Buy/Sell Output variable (Buy = 1, Sell = -1) so you can create alerts. With the indicator on a chart, you can right click and open the alerts panel, then inside the "Conditions" section you can click "Add", and create a condition for a buy or sell signal as shown in this screenshot. One of the available alert actions is to play a sound. Here are sound files for a voice saying "Buy/Sell ES", "Buy/Sell NQ": https://drive.google.com/drive/folders/1-YuKi6KzLIrNHEUrjFxfxWXqSAUT-Azw?usp=sharing
 
Last edited:

retire020

New member
@thetradeengine Thanks for creating this indicator. I am testing a strategy this morning on my live Sim accnt. Will let you know how it does. On Strat Analyzer for past week on NQ it did pretty good, not so good ES,YM,RTY. But I have a canned strategy template I use. So each person's results will vary as how they apply the strategy. I changed the BackBrushAll to BackBrush to limit it to the indicator panel not the chart, just my preference.
 

retire020

New member
Just fired off first trade with NT strategy NQ 5 Min using VerticalLineOutput for a long trade no other conditions, my strategy takes first profit target at 30 times ticks so for NQ that is 30 times .25 or 7.5 and then it moves to breakeven after first trade succeeds then second target is 90 times ticks or 22.5 and so at 9:45am it traded long open 2 positions and hit first target immediately then the second target moved to BreakEven and eventually hit the target at 10AM for total profit of $600, course paper money.
*** Update: strategy opened 2 more positions at 15:40 for another $600 p/l looking forward to seeing how this does over time.
 
Last edited:

thetradeengine

New member
Thanks for the feedback. I'll add a setting to the next version so people can choose between vertical lines on the whole chart or just the indicator panel.

Nicely done with the strategy!
 

thetradeengine

New member
Update: Version 2
File Download: B4 Indicator (Ninjatrader 8) - V2

This version is exported with the most recent version of NinjaTrader 8 (8.0.25.0).

Changes:
  • Added squeeze dots.
  • Vertical lines plots are contained to just the indicator box and do not extend through the entire chart. I wanted to add a setting option for this, but adding additional inputs would be a breaking change for anyone that has already included the indicator in a strategy. If you want to change the vertical line style to how it was in the first version, on lines 245 and 250, change "BackBrush" to "BackBrushAll".
 

ark03

New member
Just fired off first trade with NT strategy NQ 5 Min using VerticalLineOutput for a long trade no other conditions, my strategy takes first profit target at 30 times ticks so for NQ that is 30 times .25 or 7.5 and then it moves to breakeven after first trade succeeds then second target is 90 times ticks or 22.5 and so at 9:45am it traded long open 2 positions and hit first target immediately then the second target moved to BreakEven and eventually hit the target at 10AM for total profit of $600, course paper money.
*** Update: strategy opened 2 more positions at 15:40 for another $600 p/l looking forward to seeing how this does over time.
I use NT8, did you create a strategy using Strategy Analyzer using B4 Indicator? Appreciate any inputs.
 

retire020

New member
@ark03 I have strategy template I used that has trade management, so yes adding B4 indicator as the condition
&& B4Ind.VerticalLineOutput[0] == 1 // Long entry point
&& B4Ind.VerticalLineOutput[1] != -1 // Make sure not preceded by Bear Signal
Besides profit and stop targets
also:
/// Exit Long on Bear Signal
if (UseBearSignal == true && B4Ind.VerticalLineOutput[0] == -1 && B4Ind.CandleColorOutput[0] ==-1 && CurrentBar > EntryBar +1 // entry bar prevents rapid orders
&& Position.MarketPosition == MarketPosition.Long)
{
ExitLong(Convert.ToInt32(Position.Quantity), "ExitonSell", "");
}
 

ark03

New member
@ark03 I have strategy template I used that has trade management, so yes adding B4 indicator as the condition
&& B4Ind.VerticalLineOutput[0] == 1 // Long entry point
&& B4Ind.VerticalLineOutput[1] != -1 // Make sure not preceded by Bear Signal
thanks, will experiment
 

ark03

New member
Update: Version 2
File Download: B4 Indicator (Ninjatrader 8) - V2

This version is exported with the most recent version of NinjaTrader 8 (8.0.25.0).

Changes:
  • Added squeeze dots.
  • Vertical lines plots are contained to just the indicator box and do not extend through the entire chart. I wanted to add a setting option for this, but adding additional inputs would be a breaking change for anyone that has already included the indicator in a strategy. If you want to change the vertical line style to how it was in the first version, on lines 245 and 250, change "BackBrush" to "BackBrushAll".
any idea how to access squeeze dots in StrategyBuilder, basically to see is in squeeze or not?
 

ark03

New member
@ark03 I have strategy template I used that has trade management, so yes adding B4 indicator as the condition
&& B4Ind.VerticalLineOutput[0] == 1 // Long entry point
&& B4Ind.VerticalLineOutput[1] != -1 // Make sure not preceded by Bear Signal
Besides profit and stop targets
also:
/// Exit Long on Bear Signal
if (UseBearSignal == true && B4Ind.VerticalLineOutput[0] == -1 && B4Ind.CandleColorOutput[0] ==-1 && CurrentBar > EntryBar +1 // entry bar prevents rapid orders
&& Position.MarketPosition == MarketPosition.Long)
{
ExitLong(Convert.ToInt32(Position.Quantity), "ExitonSell", "");
}
wondering why the entries are triggered in the next bar instead of in the signal bar?

 

ttom999

New member
@ark03 I have strategy template I used that has trade management, so yes adding B4 indicator as the condition
&& B4Ind.VerticalLineOutput[0] == 1 // Long entry point
&& B4Ind.VerticalLineOutput[1] != -1 // Make sure not preceded by Bear Signal
Besides profit and stop targets
also:
/// Exit Long on Bear Signal
if (UseBearSignal == true && B4Ind.VerticalLineOutput[0] == -1 && B4Ind.CandleColorOutput[0] ==-1 && CurrentBar > EntryBar +1 // entry bar prevents rapid orders
&& Position.MarketPosition == MarketPosition.Long)
{
ExitLong(Convert.ToInt32(Position.Quantity), "ExitonSell", "");
}
I am using NT8 and would very appreciate any help in using this strategy. I am very un-familiar with NT8 but was able to look at where you would change the programing. Did not see any reference to a strategy template. Can you go into more detail on your setup?
 

retire020

New member
@ttom999 the strategy template is my own code, you would have to use the strategy builder to create your own version. Every person has their own idea of taking profit and stop losses.
 

ark03

New member
9hhc9Vm.jpg


File Download: B4 Indicator (NinjaTrader 8)

Here's my first copy of the B4 Indicator for NinjaTrader 8 (built off of v3.0.1 for TOS). To import go to Control Center -> Tools -> Import -> NinjaScript Add-On, then select the zipped file you downloaded named "B4Indicator.zip". You will then likely see some dialogs asking if you want to update copies of the built-in indicators used within in the script (MACD, StDev, etc), to which you can select "No".

Buy/Sell Signals
  • Signals are plotted on the upper chart as triangles above or below the candles
  • Accessible in the strategy builder as "BuySellOutput" (Buy = 1, Sell = -1, Neutral = 0)
Bull/Bear Vertical Lines
  • Vertical stripes are painted through both the upper and lower chart panels
  • Accessible in the strategy builder as "VerticalLineOutput" (Bull = 1, Bear = -1, Neutral = 0)
Candle Color
  • Accessible in the strategy builder as "CandleColorOutput" (Green Candle = 1, Red Candle = -1, Gray Candle = 0)
Squeeze
  • When in a squeeze the MACD & MACD Bollinger Bands turn orange
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

Update: Version 2
File Download: B4 Indicator (Ninjatrader 8) - V2

This version is exported with the most recent version of NinjaTrader 8 (8.0.25.0).

Changes:
  • Added squeeze dots.
  • Vertical lines plots are contained to just the indicator box and do not extend through the entire chart. I wanted to add a setting option for this, but adding additional inputs would be a breaking change for anyone that has already included the indicator in a strategy. If you want to change the vertical line style to how it was in the first version, on lines 245 and 250, change "BackBrush" to "BackBrushAll"
I'm testing a simple strategy using this indicator. It is definitely worth a shot.

However, I'm noticing that, the trades are not triggered when there is a signal and sometimes trades triggered without a signal. See here https://ra3-gmail.tinytake.com/medi..._preview&type=attachment&width=799&height=532

I'm using B4Indicator.VerticalLineOutput[0] == 1 for long entry and B4Indicator.VerticalLineOutput[0] == -1 for short entry

Any idea?
 
Top