Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Slowness looking at other timeframes in a window

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

    Slowness looking at other timeframes in a window

    Hi, good night!!


    I need to ask a question about slowness in the code when I insert data from other timeframes.

    When I enter these commands without mentioning them in the code, there is no slowdown.

    Code:
     AddDataSeries(Data.BarsPeriodType.Minute, 60);
     AddDataSeries(Data.BarsPeriodType.Minute, 240);​

    but when I reference the bars of this different timeframe, the graph is very slow

    Code:
    if (BarsInProgress == 1 && CurrentBars[1] >= 3)
                {
                    if (Highs[1][3] < Lows[1][1])
                    {
                        double perc_50_alta = (Highs[1][3] + Lows[1][1]​


    Below I am sending the part of the code containing what I mentioned.

    Code:
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Name = "FVG";
    Barra = 100;
    Print("resetei tudo");
    range_asia = 0;
    perc_50_asia = 0;
    range_londres = 0;
    perc_50_londres = 0;
    DateTime infiniteFuture = DateTime.Now.AddHours(1);
    timeAdjusted = false;
    }
    else if (State == State.Configure)
    {
    dtOpen = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, PositionOpeningTime.Hour, PositionOpeningTime.Minute, 0);
    dtClose = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, PositionClosingTime.Hour, PositionClosingTime.Minute, 0);
    
    tsOpen2 = new TimeSpan(PositionOpeningTime2.Hour, PositionOpeningTime2.Minute, 0);
    tsClose2 = new TimeSpan(PositionClosingTime2.Hour, PositionClosingTime2.Minute, 0);
    
    dtOpen3 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, PositionOpeningTime3.Hour, PositionOpeningTime3.Minute, 0);
    dtClose3 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, PositionClosingTime3.Hour, PositionClosingTime3.Minute, 0);
    
    AddDataSeries(Data.BarsPeriodType.Minute, 60);
    AddDataSeries(Data.BarsPeriodType.Minute, 240);
    }
    }
    
    protected override void OnBarUpdate()
    {
    
    // MARCAÇÃO FVG - INICIO
    if (BarsInProgress == 0 && CurrentBar < Bars.Count - Barra)
    return;
    if (BarsInProgress == 1 && CurrentBar < BarsArray[1].Count - 60)
    return;
    if (BarsInProgress == 2 && CurrentBar < BarsArray[2].Count - 240)
    return;
    
    if (BarsInProgress == 0 && CurrentBar >= 3)
    {
    if (High[3] < Low[1])
    {
    double perc_50_alta = (High[3] + Low[1]) / 2;
    Draw.Rectangle(this, "Alta" + Time[3], false, Time[3], High[3], Time[0], Low[1], Brushes.Transparent, Brushes.CornflowerBlue, 20, false);
    if(Ativar50)
    Draw.Line(this, "Alta_50" + Time[3], false, Time[3], perc_50_alta, Time[0], perc_50_alta, Brushes.CornflowerBlue, DashStyleHelper.DashDot, 1, false);
    }
    if (Low[3] > High[1])
    {
    double perc_50_baixa = (High[1] + Low[3]) / 2;
    Draw.Rectangle(this, "Baixa" + Time[3], false, Time[3], High[1], Time[0], Low[3], Brushes.Transparent, Brushes.Red, 20, false);
    if(Ativar50)
    Draw.Line(this, "Baixa_50" + Time[3], false, Time[3], perc_50_baixa, Time[0], perc_50_baixa, Brushes.Red, DashStyleHelper.DashDot, 1, false);
    }
    }
    
    if (BarsInProgress == 1 && CurrentBars[1] >= 3)
    {
    if (Highs[1][3] < Lows[1][1])
    {
    double perc_50_alta = (Highs[1][3] + Lows[1][1]) / 2;
    int text_60 = 10;
    DateTime text_60_text = ChartControl.GetTimeByX(text_60);
    
    Draw.Line(this, "Alt_50_60" + Times[1][3], false, Times[1][3], perc_50_alta, infiniteFuture, perc_50_alta, Brushes.Black, DashStyleHelper.DashDot, 1, false);
    Draw.Text(this, "Alt_50_60_text" + Times[1][3], false, "50% 1h", text_60_text, perc_50_alta, 10, Brushes.Black, myFont, TextAlignment.Left, Brushes.Transparent, null, 1);
    }
    if (Lows[1][3] > Highs[1][1])
    {
    double perc_50_alta = (Highs[1][1] + Lows[1][3]) / 2;
    int text_60 = 10;
    DateTime text_60_text = ChartControl.GetTimeByX(text_60);
    
    Draw.Line(this, "Baix_50_60" + Times[1][3], false, Times[1][3], perc_50_alta, infiniteFuture, perc_50_alta, Brushes.Black, DashStyleHelper.DashDot, 1, false);
    Draw.Text(this, "Baix_50_60_text" + Times[1][3], false, "50% 1h", text_60_text, perc_50_alta, 10, Brushes.Black, myFont, TextAlignment.Left, Brushes.Transparent, null, 1);
    }
    }
    }

    Could you explain to me if it's the platform or if I'm doing something that causes this slowness as part of the poorly structured code?​

    Thanks!

    #2
    Sorry, this problem is resolved !! Thanks

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    595 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    554 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X