Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Alert when there are 3+ consecutive bars
Collapse
X
-
Alert when there are 3+ consecutive bars
Hello, a newbie to ninja script and alert, I wonder how to build an alert to alert me when there are 3 or more consecutive bars appears in any given time? For e.g. I am trading ES 5 mins chart, I am looking for an alert that alerts me when there are 3 consecutive bull bars, especially when the size of bar keep increasing and when the bull bar close above 50% of the body, see bar 62, 63, 64 in attached screenshot. Vice versa for bear bars. Can anyone give me some guidance or has anyone done this before?Tags: None
-
Hello diabloooo0,
Thanks for your question.
We would reference pervious bars with BarsAgo references.
So you could check 3 consecutive up bars by checking:
Close[0] > Open[0] checks the current bar,Code:if (Close[0] > Open[0] && Close[1] > Open[1] && Close[2] > Open[2])
Close[1] > Open[1] checks 1 bar ago.
Close[2] > Open[2] checks 2 bars ago.
The above would check if the bar is an up bar and the close of that up bar is above 50% of the body of the previous bar.Code:if (Close[0] > Open[0] && Close[0] > Open[0] + (Close[1] - Open[1]) / 2)
For more information on referencing price data so you can create custom conditions, please see the detail below. I am also linking our Help Guide reference for developing indicators and using Alert().
Working with Price Series - https://ninjatrader.com/support/help...ice_series.htm
Indicator Tutorials - https://ninjatrader.com/support/help...indicators.htm
Strategy Tutorials - https://ninjatrader.com/support/help...strategies.htm
Alert() - https://ninjatrader.com/support/help.../nt8/alert.htm
Making sure there are enough bars in the data series you are accessing - https://ninjatrader.com/support/help...nough_bars.htm
We look forward to assisting.
-
Thanks Jim, looks like this is not something that can be achieved using the "Alert" menu after right click on the chart? Based on your reply it seems I need to build an indicator which runs the logic you mentioned and the use the Alert() function to pop up a small window on my screen? Also another question is, does the alert only work when the chart is open or it doesn't matter? Say if I am able to build such alert, and added it to AAPL, then I switch to TSLA on the same window, will the alert continue to work for AAPL?
Comment
-
Hello diabloooo0,
The three consecutive Up bars can be made with Chart Alerts. The mathematical offsets used in for the second condition would not be possible with Chart Alerts and would need to be done with NinjaScript.
Using Alerts - https://ninjatrader.com/support/help...ing_alerts.htm
Condition Builder - https://ninjatrader.com/support/help...on_builder.htm
When you change instruments on a chart with an Alert applied, you will be prompted if you want to move the alert to the new chart. If you do not move the alert, it will be removed.
Alert() in NinjaScript will create Alert messages that can be seen in the Alerts Log window, but if you want a pop up, you would need to use NTMessageBoxSimple.Show()
Comment
-
Thanks for the quick reply, just want to make sure I understand it correctly, so if I choose to move the alert, will the alert still be effective on the old instrument? in my example, if changes from AAPL to TSLA, will the alert still be effective on AAPL?Originally posted by NinjaTrader_Jim View PostHello diabloooo0,
When you change instruments on a chart with an Alert applied, you will be prompted if you want to move the alert to the new chart. If you do not move the alert, it will be removed.
Comment
-
Hello diabloooo0,
If you change the instrument on a chart that has an indicator applied, you will be prompted if you want to move the alert to the new symbol.
If you select Yes, the Alert moves to the new symbol, if you select No, the Alert is removed from the chart (and is no longer active on the previous symbol.)
Comment
-
Thanks, that clarifies, so is there any way to set alerts that runs at the backend(i.e. the server side) even the instrument is not open on any window at the client side?Originally posted by NinjaTrader_Jim View PostHello diabloooo0,
If you change the instrument on a chart that has an indicator applied, you will be prompted if you want to move the alert to the new symbol.
If you select Yes, the Alert moves to the new symbol, if you select No, the Alert is removed from the chart (and is no longer active on the previous symbol.)
Comment
-
Hello diabloooo0,
NinjaTrader would run on your PC, and the alert cannot be run "server-side."
The Alert logic can be set up in a strategy, and the strategy could be added to the Control Center so it is not tied to a chart.
If you wanted to use a Condition Builder to set up simple alerts (like the Chart Alerts) in a strategy, the Strategy Builder can be used.
Strategy Builder 301 (publicly available resource) — https://www.youtube.com/watch?v=_KQF2Sv27oE
Conditions examples — https://ninjatrader.com/support/help...on_builder.htm
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
66 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
141 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
46 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
51 views
0 likes
|
Last Post
|

Comment