Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Draw.TextFixed Changes Location Based on Chart Time Fram

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

    Draw.TextFixed Changes Location Based on Chart Time Fram

    Hello. I have an indicator that uses the Draw.TextFixed() method to place information on the price panel of a chart. The indicator works well in many circumstances (it compiled properly, etc.), but in certain circumstances it has odd behavior.

    Let's say I am placing the fixed text at the lower right of the chart. In this case, it is the S&P500 cash chart. And, it is at night - when there are no price changes. When I manually change the time-frame of the chart from 30-minutes to 60-minutes - meaning fewer bars, and the scale of the chart obviously changes. Now, instead of appearing at the lower right of the 30-minute chart, the indicator now appears on the right-hand side of the chart, but mid-way up, instead of at the lower right.

    This behavior did not occur in NT7.

    I am currently re-drawing the indicator "On Price Change" per the indicator template to help save resources. What is occurring when the time-frame of the chart is changed, but there is no price change, and is Draw.TextFixed supposed to respond to that, or is the code now supposed to be able to respond to it?

    If it's supposed to be done in code, what do you suggest?

    #2
    Hello,

    Thank you for the post.

    DrawTextFixed should do as its name suggests and stay fixed.

    I tried a simple test of making an indicator that just draws text, and then applied that to a chart with Calculate.OnPriceChange but I could not see the same result. I tried to disconnect and also tried putting it on an out of session instrument but did not see the movement when changing timeframes.

    Could you try a simple test for me to see if you can reproduce this in any ways using the sample? If so, I would like you to note the steps used and also to save the workspace and provide that to me for review.

    I have attached a script, please feel free to modify this as needed to reproduce what you are seeing. If you do need to modify the test, please include that back to me as well.

    If you are not able to see the simple test result in the same moving, this could potentially be related to the logic you are using in the script. We could take a look closer into that if that were the case.

    I look forward to being of further assistance.
    Attached Files
    JesseNinjaTrader Customer Service

    Comment


      #3
      Problem Resolved

      This problem has been resolved. The problem is caused by the interaction of Scale.Justification with the Draw.TextFixed method. When Scale.Justification.Overlay is chosen, the behavior of the fixed text moving around the screen is reproduced. When Scale.Justification.Right is chosen, the fixed text remains in the proper location, regardless of what chart time-frame is chosen.

      (As an aside, when the IsOverlay property is set to 'false' as in the test script you asked me to import, an extra blank indicator window was opened. So the correct set-up is to have the IsOverlay property set to 'true', and the Scale.Justification set to right, as in the underlying chart, and as above.)

      On reflection, the Indicator Wizard doesn't really well cover the case where a text indicator is being added. And this would be a nice enhancement some day as it exceptionally confusing for all but highly skilled programmers.

      Thanks for your help.
      Joe

      Comment


        #4
        Hello,

        Thank you for the reply.

        I am glad the change of settings seems to have resolved this for you. I am still questioning what may be happening with the situation you described here.

        If you still have the ability to reproduce this, I would still like to get a copy of testing workspace to see if I can also see this. I am not certain the movement would be expected as this specific tool should stay fixed in place.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Christopher_R, Today, 12:29 AM
        0 responses
        9 views
        0 likes
        Last Post Christopher_R  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        166 responses
        2,235 views
        0 likes
        Last Post sidlercom80  
        Started by thread, Yesterday, 11:58 PM
        0 responses
        3 views
        0 likes
        Last Post thread
        by thread
         
        Started by jclose, Yesterday, 09:37 PM
        0 responses
        8 views
        0 likes
        Last Post jclose
        by jclose
         
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        10 responses
        1,415 views
        0 likes
        Last Post Traderontheroad  
        Working...
        X