Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Data speed in the strategy vs chart

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

    Data speed in the strategy vs chart

    Hi all,

    I have a strategy that has Minute as the primary Data Series, and in my strategy, I add Seconds Data Series

    Code:
    else if (State == State.Configure)
    {
    AddDataSeries(BarsPeriodType.Second, 1);
    }
    ​​

    In my strategy, I print out the time I receive the first second data, and for some stock tickers, I receive Seconds data 30 seconds after the the market opens, and can take more than 1 minute for other tickers. Initially, I thought the problem is caused by my brokerage, Charles Schwab, but today, I have the chart open, and saw the chart updates the price right when the market opens, but my strategy doesn't receive seconds data.

    Are the strategies and charts getting the stock price from difference source?

    Thanks

    #2
    Hello op1031,

    Thank you for your post.

    Are you connected to more than one connection? (check the Connections menu of the Control Center)

    Keep in mind that the strategy (unless coded otherwise) will also first process all historical data on the chart before processing realtime data.

    If your first and only added series in the 1 second series, at the top of OnBarUpdate print out the time filtered by the BarsInProgress index of that series:

    Code:
    if (BarsInProgress == 1)
    Print(Times[0][0]);
    Are you still seeing the same behavior?

    Comment


      #3
      Are you connected to more than one connection? (check the Connections menu of the Control Center)
      Yes, I am only connected to Charles Schwab

      If your first and only added series in the 1 second series, at the top of OnBarUpdate print out the time filtered by the BarsInProgress index of that series:
      I can only observe this at the beginning of the market, so I will report back tomorrow.

      Thank you

      Comment


        #4
        I can see the price started right away. My mistake was

        Code:
        if (CurrentBar < BarsRequiredToTrade)
          return;
        I assume this is needed because I am using indicator like SMA in my primary series.

        should I be doing the following instead?

        Code:
        if (BarsInProgress == 0)
             ​if (CurrentBar < BarsRequiredToTrade)
                 return;

        Comment


          #5
          Hello,

          That would almost be doing the same thing essentially. We wouldn't recommend removing the CurrentBar check in your script as this can prevent indexing errors. The CurrentBar check makes sure you have enough bars in your script before it begins processing. Below is a page this discusses.



          Actually, since you have an added data series, we would actually recommend making sure both Bars objects have a CurrentBars check.

          Code:
          if (CurrentBars[0] < BarsRequiredToTrade || CurrentBars[1] < BarsRequiredToTrade) return;
          Please let me know if you have any further questions.

          Comment


            #6
            I think my main problem is that I Charles Schwab doesn't provide historical seconds data, so my strategy was waiting to load 20 bars before getting into my trading logic.
            Thank you, Gaby. My issue is resolved.​

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            41 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            124 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            64 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            41 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X