Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question about BackColor

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

    Question about BackColor

    I have an indicator that contains the following statement:

    BackColor = Color.FromArgb(downIntensity,backColorDown);
    ...
    BackColor = Color.FromArgb(upIntensity,backColorUp);

    This indicator determines the proper color for BackColor from a higher timeframe.

    So if I run this indicator on a 5 minute chart, it determines the BackColor from a 10 min timeframe. This indicator is working correctly.

    My problem is when the chart is being updated in realtime, it won't change the BackColor to a different color when it should. It just continues to paint the next bar with the previous bar BackColor.

    But if I hit F5 to refresh the chart, then BackColor is updated correctly.

    How do I get the indicator to update BackColor in realtime?

    #2
    Hello,

    BackColor is able to update in real time, this sounds like an issue with the logic that changes the color.

    Can you provide a sample of this logic? If the color is remaining as the prior bars this would indicate something with the color variable you are using is not being reset or changed.

    I look forward to being of further assistance.

    Comment


      #3
      Hello Jesse,

      I'm attaching a code snippet

      if( CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired ) return;

      //
      if( BarsInProgress == 1 )
      {
      /* Instantiate rcsPriceActionSwingGOMArrowsTrueClose */ _rcsPriceActionSwingGOMArrowsTrueClose = rcsPriceActionSwingGOMArrowsTrueClose(dtbStrengthS ,showArrowsS,swingSizeS,swingTypeS,tickSizeValueS, useCloseValuesS);
      /* Initialize rcsPriceActionSWingGOMArrowsTrueClose */ _rcsPriceActionSwingGOMArrowsTrueClose.PASGATC[0] = null;

      if( _rcsPriceActionSwingGOMArrowsTrueClose.PASGATC[0] == "Down" ) _currentTrend = "down";
      if( _rcsPriceActionSwingGOMArrowsTrueClose.PASGATC[0] == "Up" ) _currentTrend = "up";
      }

      if( BarsInProgress == 0 )
      {
      //Print(Time[0] + " " + "_currentTrend = " + _currentTrend);

      if( _currentTrend == "down" )
      {
      BackColor = Color.FromArgb(downIntensity,backColorDown);
      overallTrend.Set(0, "down");
      }

      if( _currentTrend == "up" )
      {
      BackColor = Color.FromArgb(upIntensity,backColorUp);
      overallTrend.Set(0, "up");
      }

      /*
      Print(Time[0] + " " + "_currentTrend = " + _currentTrend);
      Print(Time[0] + " " + "overallTrend[0] = " + overallTrend[0]);
      Print("");
      */

      }

      Regards,
      R. C.

      Comment


        #4
        Hello,

        I wont be able to run this but looking at the syntax and logic being used, I would suspect this is caused by _currentTrend not being reset to a blank string.

        in BIP == 1, I see you are setting it:

        Code:
        if( _rcsPriceActionSwingGOMArrowsTrueClose.PASGATC[0] == "Down" ) _currentTrend = "down";
        if( _rcsPriceActionSwingGOMArrowsTrueClose.PASGATC[0] == "Up" ) _currentTrend = "up";
        In BIP == 0, I see you are using it:

        Code:
        if( _currentTrend == "down" )
        {
        BackColor = Color.FromArgb(downIntensity,backColorDown);
        overallTrend.Set(0, "down");
        }
        
        if( _currentTrend == "up" )
        {
        BackColor = Color.FromArgb(upIntensity,backColorUp);
        overallTrend.Set(0, "up");
        }

        I would expect some sort of reset to " " for this variable, otherwise this is just a string which would carry its value to the next OnBarUpdate.

        So the _currentTrend == "down"

        the down color is set
        OnBarUpdate is called again but neither of the conditions to set _currentTrend become true, it remains "down".

        Because I can not run the script this is just an observation so if you are resetting this elsewhere in the script please ignore this. Otherwise I would recommend following that variable to see if it is reset on every bar, if not you will carry over the existing value.

        I look forward to being of further assistance.

        Comment


          #5
          Yes. I'm not resetting _currentTrend inside OnBarUpdate. I will try that tomorrow and reply again. Tx.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X