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

Labeled Lines Drawing Tool (no constant value with ray)

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

    Labeled Lines Drawing Tool (no constant value with ray)

    Hi, i have downloaded the Labeled Lines Drawing Tool from NinjaTrader_Jim. great work! when using the LabeledRay, the price is changed when moving the chart without changing the line. but the value should remain the same, like the LabeledHorizontalLine. I use as startY and endY the same value see below:

    Code:
    [COLOR=#e74c3c]intradayHigh [/COLOR]= Instrument.MasterInstrument.RoundToTickSize(Math.M ax(intradayHigh, High[0]));
    labeledRay = Draw.LabeledRay(this, "intradayHigh", false, startBar, [COLOR=#e74c3c]intradayHigh[/COLOR], 0, [COLOR=#e74c3c]intradayHigh[/COLOR], IntradayHigh.Brush, IntradayHigh.DashStyleHelper, Convert.ToInt32(IntradayHigh.Width), true);
    W​at could be my problem?

    Last edited by sidlercom80; 10-23-2020, 01:40 AM.
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom80,

    Thanks for opening the thread, and I'm happy you found my tool to be useful.

    To get the price where the ray collides with the PriceScale, I create a vector using the start and end coordinate, and then I project it outward to get a collision with the left or right boundary of the ChartPanel, once I get that collision, I can get a Y coordinate that I can convert to a price value with ChartScale.GetValueAtY. I also do this so I know where to draw the text box on the chart.

    So this involves projecting the line which adds some minor variance, and then if the ChartScale is modified, like if we adjust the scale or scroll the chart with Auto Scale enabled, we would be changing the price value on the scale where the ray collides.

    Based on how it is programmed, this would be one of those "expected" things. I'm really not sure how I can stabilize it to prevent the "bouncing."

    I do have a "Text Display Mode" property that you can set to use "EndPointAtPriceScale" which will use the EndPoint for the price value and present that value along the price scale. This won't bounce, but it won't show the "projected" value so it may not be a solution for you.

    Let me know if you have any additional questions!
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks a lot NinjaTrader_Jim that helped me a lot, I have now set it to "EndPointAtPriceScale" and so far no problems!
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Kaledus, Today, 01:29 PM
      0 responses
      3 views
      0 likes
      Last Post Kaledus
      by Kaledus
       
      Started by PaulMohn, Today, 12:36 PM
      1 response
      15 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by yertle, Yesterday, 08:38 AM
      8 responses
      36 views
      0 likes
      Last Post ryjoga
      by ryjoga
       
      Started by rdtdale, Today, 01:02 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by alifarahani, Today, 09:40 AM
      3 responses
      18 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X