Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawLine draws to incorrect Y coor when instrument scaled on LEFT.

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

    DrawLine draws to incorrect Y coor when instrument scaled on LEFT.

    I have a chart with 2 instruments, 6E scaled on LEFT in the top window.
    I have a strategy that does a DrawLine.
    The DrawLine places the line endpoints at the wrong price when the 6E is scaled on the LEFT. See attached picture #1
    When I switched the scaling for 6E to RIGHT, the line endpoints are correct.
    See attached picture #2.

    The chart is a LineOnClose type which clearly shows the price at the time of the
    DrawLine.

    Here is the DrawLine cmd I used:
    DrawLine(CurrentBar.ToString()+"L"+lineCount, true, barsAgo, Close[barsAgo], 0, Close[0], lineColor, DashStyle.Solid, 1);

    Seems like a bug.

    Gary
    Attached Files

    #2
    Hello,

    Thanks for the post and patience while I reviewed this.

    It looks like you have one of your chart data series set to transparent, can you please change it to a color and line on close and then resend the screenshot so I can see where the other data series is.

    Furthermore is this a multi time frame/instrument script? If so are you doing BarsInProgress filtering for your draw Object?

    If both these check out I will run a test script on my side and try to reproduce it with your code segment.

    Thanks.

    -Brett

    Comment


      #3
      Yes, there are two data series on the chart. The 2nd data series in the bottom panel is very scrunched up at the bottom of the chart previously attached. It is a thin red line because both data series are set to line-on-close.

      At the time I was running this strategy, it was after hours and I was connected to the Kinetick End-Of-Day data feed (so that the strategy would be enabled).
      The strategy itself does not add the 2nd data series. The strategy uses indicators that do use two data series. I had code in my strategy to determine if it was even being called for the 2nd data series OnBarUpdate and it is not (BarsInProgress never equals 1).
      Therefore, I conclude that this is NOT a BarsInProgress filtering issue.

      I am familiar with the code required to deal with multiple data series because the underlying indicators have that logic in them.
      On each OnBarUpdate call, the strategy calls [indicator].Update().

      The only variable that seems to affect the problem is where the data series (that is being drawn on) has it's scaling.

      When I switch data series 1 to be scaled on the left (same for 'Overlay'), the lines drawn are not correct vertically. When I switch it to be scaled on the right, they draw correctly.

      -Gary

      Comment


        #4
        In this case I would need to take a look at the code that is generating the drawing object. Can you please post a simplified example for me to reproduce this on my side and check into it further.

        -Brett

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mizzouman1, Today, 07:35 AM
        4 responses
        18 views
        0 likes
        Last Post Mizzouman1  
        Started by philmg, Today, 01:17 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by cre8able, Today, 01:01 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by manitshah915, Today, 12:59 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by ursavent, Today, 12:54 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X