How to use BarInProgress with AddDataSeries to get the realtime value. please help us with few examples to get value of bar in real time using BarInProgress. Also, if you have better way to get real time value in bar, please suggest.
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
real time value in bar,
Collapse
X
-
real time value in bar,
Hi
How to use BarInProgress with AddDataSeries to get the realtime value. please help us with few examples to get value of bar in real time using BarInProgress. Also, if you have better way to get real time value in bar, please suggest.Tags: None
-
Hello yeshujbp,
Thanks for your post.
To work with real time data (or playback with market replay data) and have access to the currently forming bar, the script must be run with Calculate.OnEachTick (or Calculate.OnPriceChange).
To access data from added data series you can work with the code segmented by the BarsInProgress index and/Or by using the "plurals" of the price type.
The BarsInProgress identifies which of the data series has called the OnBarUpdate() method. BarsInProgress 0 is the chart Bars, 1 is the 1st listed added data series, 2 is the 2nd added dataseries, etc. etc.
There are a number of ways to write your code and which way depends on your needs. For example, if you wanted to access the High of the first two added data series when the chart bars call OnBarUpdate():
if (BarsInprogress == 0)
{
if (SMA(20)[0] > Highs[1][0] && SMA(20)[0] > Highs[2][0]) // Is the Chart bars SMA20 current value greater than the current high of the first and second added data series
{
// do something
}
We highly recommend that you review the help guide on Multi series and multi time frame as this provides an education of all things related to the subject and covers all of your questions with detail ed examples and diagrams: https://ninjatrader.com/support/help...nstruments.htm The best way to review is in the sequence written that covers these topics:
Working With Multi-Time Frame Objects
Adding Additional Bars Objects to NinjaScript
Creating Series<T> Objects
How Bars Data is Referenced
Using Bars Objects as Input to Indicator Methods
True Event Driven OnBarUpdate() Method
Accessing the Price Data in a Multi-Bars NinjaScript
Entering, Exiting and Retrieving Position InformationPaul H.NinjaTrader Customer Service
-
Originally posted by yeshujbp View PostHi
How to use BarInProgress with AddDataSeries to get the realtime value. please help us with few examples to get value of bar in real time using BarInProgress. Also, if you have better way to get real time value in bar, please suggest.
Do you now have a final version of the Alert/Smsalert indicator that works ? Could you please post/share it.
Best Regards.
Lolu
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Allwest, Yesterday, 10:25 PM
|
2 responses
15 views
0 likes
|
Last Post Today, 04:18 AM | ||
Started by bmandonlidal, Today, 03:34 AM
|
0 responses
1 view
0 likes
|
Last Post
by bmandonlidal
Today, 03:34 AM
|
||
Started by LincolnOrtiz, Today, 03:10 AM
|
0 responses
2 views
0 likes
|
Last Post
by LincolnOrtiz
Today, 03:10 AM
|
||
Started by Dr Kerry, Today, 02:03 AM
|
0 responses
3 views
0 likes
|
Last Post
by Dr Kerry
Today, 02:03 AM
|
||
Started by AndriXF7, 12-06-2023, 10:09 AM
|
5 responses
163 views
1 like
|
Last Post
by Lunorri
Today, 01:56 AM
|
Comment