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!
See more
See less

Partner 728x90

Collapse

Series[0] Realtime and IntraBar

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

    Series[0] Realtime and IntraBar

    Hello to the Forum,

    I would like to use a series in real-time mode.
    If a condition within a bar becomes true, this should be displayed on the next tick with Series[1].
    Unfortunately this does not work.
    For clarification I have written the following code:

    Code:
    counter++;
    testCondSeries[0] = counter == 1;
    if (counter >= 4) counter  = 0;
    
    
    Print(Time[0]
     + "   testCondSeries[0]  " + testCondSeries[0]
     + "   testCondSeries[1]  " + testCondSeries[1]
     + "   counter    " + counter);
    I get the following result:

    Click image for larger version  Name:	Unbenanntes Bild.png Views:	0 Size:	28.7 KB ID:	1104283



    Obviously Series[1] only works for historical data.

    What is the best practice to solve my problem?
    Thanks for your support!

    PS: it's not about backtesting but about the running operation
    PPS: I use Calculate.OnEachTick and work on a minute basis

    #2
    Hello user10,

    The series is going to be synced to the primary by default so if you are not using a 1 tick primary you will be referencing the same primary series minute bar for each new tick.

    You may be able to sync a series to a secondary 1 tick series if you intend to have 1 index per tick rather than per bar.



    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      thanks for the advice.
      I have now changed the data series to 1 tick (AddDataSeries(Data.BarsPeriodType.Tick, 1);
      The strategy was removed from the chart and restarted.
      Unfortunately it still does not work.

      I also don't understand why I need a second data series when working in the tick area.

      Comment


        #4
        hello user10,

        That would not be the same as what I had described. your primary would need to be the 1 tick or you would need to add a synced Series. did you use what is shown in the sample i had linked for syncing a secondary series? the secondary tick series is part of what the sample i linked shows.

        if you use a plot or default series here that is going to be for your primary bars. the alternate is to use a secondary synced Series.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        2 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        40 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X