Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
New Bar Alert
Collapse
X
-
Hello idude,
Thank you for your note.
I didn't see one in our user app share so I created a really simple one quickly - only one line of code needed. When you set an indicator to calculate On Bar Close, it runs once per bar, at the close as you might imagine. I simply created an indicator that plays a sound alert when the bar closes and the following bar opens.
Here is a basic guideline of how to Import NinjaScripts.
To import NinjaScripts you will need the original .zip file.
To Import- Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
- From the Control Center window select the menu File> Utilities> Import NinjaScript
- Select the downloaded .zip file
- NinjaTrader will then confirm if the import has been successful.
Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'
Once installed, you may add the indicator to a chart by:- Right click your chart > indicators > Select the Indicator from the list on the left > New > OK
Attached FilesKate W.NinjaTrader Customer Service
- Likes 1
-
Thanks for the BarCloseAlert indicator, simple and works well.
I am writing to ask if there is a way to edit the code for the indicator to alert prior to bar close.
In my case I need an alert for a 5min bar and a 15min bar close but both will not sound an alert at the same time. Also an alert 3 seconds prior to bar close would be very helpful
Is there a way to edit the code so the alert sounds prior to bar close?
Thank you very much for your assistance.
Comment
-
Hi, thanks for posting. Once the support team posts a simple example the example comes "As Is" and we will not be able to make further edits to it. To get intrabar alerts, you would need to set the indicator to run OnEachTick to read the DateTime.Now timestamp and trigger alerts based on conditions using this time stamp in real time. This would be one way to get an alert before the bar closes.
Kind regards,
-ChrisLChris L.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Kate View PostHello idude,
Thank you for your note.
I didn't see one in our user app share so I created a really simple one quickly - only one line of code needed. When you set an indicator to calculate On Bar Close, it runs once per bar, at the close as you might imagine. I simply created an indicator that plays a sound alert when the bar closes and the following bar opens.
Here is a basic guideline of how to Import NinjaScripts.
To import NinjaScripts you will need the original .zip file.
To Import- Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
- From the Control Center window select the menu File> Utilities> Import NinjaScript
- Select the downloaded .zip file
- NinjaTrader will then confirm if the import has been successful.
Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'
Once installed, you may add the indicator to a chart by:- Right click your chart > indicators > Select the Indicator from the list on the left > New > OK
Thanks
Comment
-
Originally posted by tradertom2012 View Post
Is it possible to update this new bar alert indicator for the latest version of NT8 with editable alert sounds?
Thanks
As needed add new alerts.
Enjoy.
BarCloseAlertv05.zip
Comment
-
-
Hi, I am attempting to send an email alert on a new bar with the following:
Code:SendMail("[email protected]", "New Bar Alert", "New Bar");
Code:/* Alert Trades On Excecition New Bar*/ if (SoundsOn && NewBarAlert && SoundsAlert && IsFirstTickOfBar) { Alert("myAlertNewBar", Priority.High, "Bar Closed", AAlert, ARE, Brushes.Black, Brushes.Yellow); PlaySound(AAlert); SoundsAlert = false; AlertA = 1; SendMail("[email protected]", "New Bar Alert", "New Bar"); }
Last edited by ow_xo; 09-20-2023, 08:04 AM.
Comment
-
Hello ow_xo,
Welcome to the NinjaTrader forums!
Note, the alerts and email would only be sent for real-time bar closes and are not sent in historical.
I've given this a test, and I am finding the call to SendMail() does appear to work correctly.
May I confirm that the Alert is appearing in the Alerts Log window? (This would confirm the code is being reached through the condition)
Chelsea B.NinjaTrader Customer Service
- Likes 1
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello ow_xo,
Welcome to the NinjaTrader forums!
Note, the alerts and email would only be sent for real-time bar closes and are not sent in historical.
I've given this a test, and I am finding the call to SendMail() does appear to work correctly.
May I confirm that the Alert is appearing in the Alerts Log window? (This would confirm the code is being reached through the condition)
THank you very much!
Comment
-
Hello Jan,
Welcome to the NinjaTrader forums!
To achieve this you will need to add a 1 second series to the script with AddDataSeries().
Then run the logic in a condition requiring BarsInProgress to be 1.
A public int property can be added for the number of seconds.
[NinjaScriptProperty]
public int SecondsBeforeBarClose
{ get; set; }
You can compare the datetime of the 1 second series to be equal to the primary series minus 30 seconds.
if (Times[1][0] == Times[0].AddSeconds(-30))
I am also including a link to a support article with helpful resources on getting started with C# and NinjaScript.
Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by GwFutures1988, Today, 02:48 PM
|
1 response
5 views
0 likes
|
Last Post Today, 03:09 PM | ||
Started by ScottWalsh, 04-16-2024, 04:29 PM
|
6 responses
30 views
0 likes
|
Last Post
by ScottWalsh
Today, 02:57 PM
|
||
Started by frankthearm, Today, 09:08 AM
|
10 responses
36 views
0 likes
|
Last Post
by frankthearm
Today, 02:54 PM
|
||
Started by mmenigma, Today, 02:22 PM
|
1 response
3 views
0 likes
|
Last Post Today, 02:34 PM | ||
Started by NRITV, Today, 01:15 PM
|
2 responses
9 views
0 likes
|
Last Post
by NRITV
Today, 01:51 PM
|
Comment