Announcement

Collapse
No announcement yet.

Changing price bar colors

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

  • Changing price bar colors

    I have a study created using the Formula Wizard that colors the bars based on certain parameters (blue, red or green). Any bar which does not meet the defined parameters is left as the default color (black). SetComputeOnClose(true) appears in the premain and the study is applied to a tick chart.

    What is happening is that when a bar changes to a condition that meet none of the defiuned criteria, it appears as white (see attached image) and only when the conditions are such that one of the defined criteria are met, do these white bars change to black. This could be 3 or 4 bars later for example.

    What do I need to do so that the bar is colored correctly at the time the bar closes? After the next bar (not shown obvioulsy) completed, the white bars changed to black.

    Thanks

  • #2
    Re: Changing price bar colors

    Johnsp
    What you are seeing happens because you have not defined a [default] color for the price bars when none of the conditions are true so the chart engine defaults the color to white. You have two solutions available to correct this.
    Open the efs with the Editor and add a setDefaultPriceBarColor(Color.black); statement in preMain just below the setColorPriceBars(true) statement (you can define any other color as the default).
    If instead you would like to be able to define a default price bar color from within the Formula Wizard then you need to add a Set (this should always be the last one) in which you write a condition that is always true by definition such as for example 1==1. Then in "the following will happen every time" set the color of the price bar to your desired default color
    Alex


    Originally posted by Johnsp
    I have a study created using the Formula Wizard that colors the bars based on certain parameters (blue, red or green). Any bar which does not meet the defined parameters is left as the default color (black). SetComputeOnClose(true) appears in the premain and the study is applied to a tick chart.

    What is happening is that when a bar changes to a condition that meet none of the defiuned criteria, it appears as white (see attached image) and only when the conditions are such that one of the defined criteria are met, do these white bars change to black. This could be 3 or 4 bars later for example.

    What do I need to do so that the bar is colored correctly at the time the bar closes? After the next bar (not shown obvioulsy) completed, the white bars changed to black.

    Thanks

    Comment


    • #3
      Thanks Alex

      Comment

      Working...
      X