• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

real time value in bar,

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    #2
    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 Information
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by yeshujbp View Post
      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.
      Hi yeshuijbp,

      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 Mykro, Today, 11:01 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by bauerjj10, Today, 12:24 PM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Newtrader101, Today, 06:01 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_EricB  
      Started by Steve L, Today, 03:50 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by kherzfeldt6953, Today, 06:11 PM
      0 responses
      1 view
      0 likes
      Last Post kherzfeldt6953  
      Working...
      X