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

1 second graph

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

    1 second graph

    Good afternoon, I need data from an instrument every 1 second, however when using close candles every 1 second in "data series", not all candles are every 1 second, but some are every 5 seconds or more, I think it has what to do with the data or ticks, but how do I configure, (or is it possible) to configure the graph so that even so all the candles are every 1 second, that every second that passes a candle appears?


    I hope you can help me, greetings from Chile.
    Last edited by samir; 04-17-2018, 11:55 PM.

    #2
    I have noticed, testing robots on multiple instruments that the data updates have an all instruments distribution.

    Does the broker have to see that in the chart the price is not updated every 1 second, or every 5 (exactly) ?, for example, when putting 5 seconds and with a stopwatch, it is not always accurate every 5 seconds, a 40%, of course it has cost me but with a chronometer I have noticed.

    Anyway, if it was the fault of the data provider (broker) can you set up Ninjatrader 8 so that, even so, I updated the graph every second, regardless of whether the prices changed or not?

    Anyway I am trading with another broker (real account), online platform and is tremendously the distribution of the price update, I think it's because I use demo account with FXCM broker, I will consult with them about this.

    But anyway, is it possible to graph the data every second on the graph? (I do not want it to be accurate, but the interval does not change more than 20% of the time, placing the interval 1 second deviates more than 1,000% difference, with 10 seconds much less, in minutes it is not possible to detect difference.

    Comment


      #3
      Hello samir,

      The Bars on the chart are data driven. If no data is received while the bar is open then NinjaTrader can't build that bar.

      This means if no data is received over a 1 second bar, then no bar appears for that second.

      The only work around would be to create your own connection adapter in an external custom developed application and feed the data to NinjaTrader through the API and the External interface.

      There isn't anything in NinjaTrader that would allow you to create bars where there was no data.

      Below is a link to a forum link with details about using the API.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Maybe a way ?

        Hi Samir !

        I don't know if you figure out what you wanted to do, but i found a little turn around that can allow to create some sort of a count at each seconds, even if its not perfect at all, i would like to share it with you :

        Code:
        if (Time[0] >= ValueOfTimePlusTheIntervalUsedHasDataSeries
        || ValueOfTimePlusTheIntervalUsedHasDataSeries == null)
        	{//After the interval has passed, the TimeUsed will be equal to the TimePlusInterval, and set back the Time Saved
        	ValueOfTimePlusTheIntervalUsedHasDataSeries = (Time[0].AddSeconds(SecondInterval));
        	IsFirstTickOfBarForVirtualDataSeries = true;	
                }
        
        //SecondInterval would be 1 in our case
        
        if (IsFirstTickOfBarForVirtualDataSeries == true)
        {
        //Do your stuff
        IsFirstTickOfBarForVirtualDataSeries = false;
        }
        
        //and also, use this "DateTime? AverageSpreadValueOfTimeUsedHasDataSeries = null;" in default to have the DateTime on null and not 00:00 on startup
        
        I also use this method in the "protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)" section, and not in barupdate, to avoid issues
        I'm not sure if it would fix your issues, because we still need to use a Series based on a one second chart to store data (and the one second is not really one second like Chelsea explained really well), and so, since it look like you want to use some candles, with this, you could technically identify a property of a candle every second and using it right away, and yet, it would tricky to store it on each second, you can still use it, and make your script work at each second.

        You could also try to create a custom data series (even if i never tried and i'm not sure if its even possible), based on one second, yet again, you would face some issues with the storage of the data on each second (unless if you precisely know how much seconds you need, and that you can store the data trough multiples double's and not series double). Also, if you look to try it, i'm unsure if it would work well onbarupdate, but it work really well onmarketdata.

        Anyway, this little trick help me a bit for what i was doing, maybe it can help you too !

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DJ888, 04-16-2024, 06:09 PM
        4 responses
        12 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        7 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        6 views
        0 likes
        Last Post nandhumca  
        Started by The_Sec, Today, 03:37 PM
        0 responses
        3 views
        0 likes
        Last Post The_Sec
        by The_Sec
         
        Started by GwFutures1988, Today, 02:48 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X