Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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:
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.
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.JimNinjaTrader Customer Service
-
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()
JimNinjaTrader Customer Service
Comment
-
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.)JimNinjaTrader Customer Service
Comment
-
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
JimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by geddyisodin, 04-25-2024, 05:20 AM
|
8 responses
60 views
0 likes
|
Last Post Yesterday, 10:45 AM | ||
Started by jxs_xrj, 01-12-2020, 09:49 AM
|
4 responses
3,286 views
1 like
|
Last Post
by jgualdronc
Today, 10:02 AM
|
||
Can someone turn this thinkscript into a ninjascript. 5PM CST OHL and Previous Day
by Option Whisperer
Started by Option Whisperer, Today, 09:55 AM
|
0 responses
5 views
0 likes
|
Last Post Today, 09:55 AM | ||
Started by halgo_boulder, 04-20-2024, 08:44 AM
|
2 responses
22 views
0 likes
|
Last Post Today, 09:41 AM | ||
Started by mishhh, 05-25-2010, 08:54 AM
|
19 responses
6,189 views
0 likes
|
Last Post
by rene69851
Today, 09:29 AM
|
Comment