Announcement

Collapse
No announcement yet.

Chart painting .....

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

  • Chart painting .....

    I have an EFS question relating to painting of chart bars.
    I have an EFS which invokes a callFunction which paints the bars one color if the trend is up (trend as I define it) and another color if down. Otherwise, there is a default bar color (setDefaultPriceBarColor) in preMain. This is done for all bars except the current (last) bar...tested with isLastBarOnChart().

    The current(last) bar is treated differently (green if open > close, red otherwise, using candlestick theory logic)). I think you can see the problem here. When it is time to paint a new bar, the prior bar remains as is i.e. green or red, and I lose my uptrend/downtrend coloring, so I am forced to manually reload the EFS, for a number of charts.

    I would like to resolve this with EFS. I don't think reloadEFS() is the answer, and I am not sure of how -or if - to use repaintChart().

    Thanks
    George
    function PriceBarColorsTrend(UpTrend,DownTrend) {
    if(!isLastBarOnChart()) {
    if (UpTrend==t) {setPriceBarColor(Color.RGB(0x00, 0x00, 0xFF));}//blue
    else
    if (DownTrend==t) {setPriceBarColor(Color.RGB(0xFF, 0x00, 0x00));}//red
    }
    else {callFunction("FunctionLib.efs", "PriceBarColors", open(), close() );}
    return null
    } //END FUNCTION PriceBarColorsTrend*****
    Last edited by wombat953; 11-25-2003, 06:37 PM.

  • #2
    Hello George,

    The routine you're trying to create isn't possible I'm afraid. What you need is a method for coloring the price bar of bar -1 at the instance of the new bar to reflect the blue or red trend color. Unfortunately, the setPriceBarColor() function only affects the current bar being processed (bar 0 in real time), which is why it retains the color based on the open()-close() relationship every time a new bar starts.

    The condition, !isLastBarOnChart(), is only going to return true and paint the bar blue or red while the formula is loading. Remember that the formula starts processing at the oldest bar first. Once the formula is loaded it will only be processing on bar 0, which returns false for !isLastBarOnChart().

    I would recommend removing the condition for !isLastBarOnChart() and allow the formula to paint each bar blue or red and use some images or shapes drawn at the current bar to reflect the colors you use to indicate the relationship between the open() and close(). Hope this helps.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Jason - Yes, I think you are right on this one, and I will have to be more creative.
      What is the proper and intended use of repaintChart() function?
      Thaks
      George

      Comment


      • #4
        Hello George,

        repaintChart() only updates, or redraws, drawn objects such as text, shapes, and images. It won't affect the price bar colors the way you were probably hoping it would for your formula. I can't really say at this point what the proper usage for the function would be. I haven't come across a situation yet where I needed this function. Perhaps someone who has can share their experience with it.
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment

        Working...
        X