Announcement

Collapse
No announcement yet.

How to use the wick color option?

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

  • How to use the wick color option?

    Hello,

    I would appreciate any help with a difficulty I am having with the Formula Editor.

    I have a formula which I use to paint the price bars red or blue based upon the value returned from an indicator.

    I use:

    ...then the following will happen everytime:
    setPriceBarColor(Color.RGB(0,0,128))

    This successfully paints the whole bar, or candlestick, the chosen color. in this case Blue, (step two is for Red)

    However, I want to modify this line so that when using candlestick bars, only the wicks will be painted, not the bodies which I want to remain the colors set with edit studies, (red and green for up and down)

    I note from different articles that there is an option to set the wick color: setPriceBarColor(color [wickcolor] [, bthin] [,bhollow] ) I have tried many variations without success.

    Thank you for any assistance!

    David Hoffman, Lic. Ac.

  • #2
    David
    Once you use the setPriceBarColor() command you override the default color scheme and cannot use the Up/Down colors selectable in Edit Studies. The solution is to lay down every possible condition so as to color the candle and the wicks indipendently
    In the example shown below the first color paints the body while the second paints the wick. The first Boolean parameter is for the wick (true is thin false is thick) and the second for the body (true is hollow false is filled)
    Alex

    PHP Code:
    if(close() > open() && myUPcondition == true)
        
    setPriceBarColor(Color.green,Color.blue,true,false);
    else if(
    close() < open && myUPcondition == true)
        
    setPriceBarColor(Color.red,Color.blue,true,false);
    else if(
    close() > open() && myDOWNcondition == true)
        
    setPriceBarColor(Color.green,Color.red,true,false);
    else if (
    etc

    Comment

    Working...
    X