Announcement

Collapse
No announcement yet.

Drawing Problems with realtime vs older bars

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

  • Drawing Problems with realtime vs older bars

    I have a problem where I am basically drawing lines for swing hi's and lo's which I do at getBarState()== BARSTATE_NEWBAR.

    The problem is I get different results in realtime then I do loading the chart. The points are off by 1 bar in real-time.

    What do I do?

    Thanks,
    Bernie

  • #2
    Offset your graphics functions..

    You can resolve this be offsetting your graphics functions....

    It should be handled by creating two sets of code within your file (one for historical and another for RT). Like this...


    if (getCurrentBarIndex() < 0) {
    // Older Historical bars
    drawShapeRelative(0,.......);
    } else {
    // Real-time bars
    drawShapeRelative(-1,.......);
    }

    Notice how I'm using "0" or "-1" to offset my graphics functions. This allows the code to work one way for historical bars and another for RT bars. It should be doing the same thing, but in RT you might have to test "past bars" for your condition and draw the shapes at "-1" to have them appear on the proper bar.

    Hope this helps.

    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Thanks, I just figured out how to do it without the two cases. I now always just work on the bar previous to the current one (-1) and then offset by -1 my bars and it seems to work fine.


      I have another problem in that the drawLineRelative() always draws a solid line even if I specify PS_DOT or PS_DASHDOT.

      Any ideas?

      Bernie

      Comment


      • #4
        Bernie
        That is a known bug related to the drawLine command. eSignal has acknowledged it and said it is in the list of items to fix.
        Alex

        Comment


        • #5
          ok, thanks

          Comment

          Working...
          X