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

Trying to figure out the CustomSamplePlot

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

    Trying to figure out the CustomSamplePlot

    In the attachment "Right Side Rectangle" is a picture of the code I'm attempting to write. It is a rectangle on the right side that represents the recent highs and lows of an indicator. This rectangle will be centered at zero and the highs and lows will follow the indicator.

    In the attachment "Right Side Rectangle Attempt#1 you can see the red rectangle below the zero line.

    In this line of code:
    Rectangle rect = new Rectangle(X,Y, 23,54);

    For "Y" I'm using:

    int Y = (bounds.Y + bounds.Height) - ((int) ((( 0 - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height))-1;

    Which seems to work good and gives me the zero reference.

    But for the height term, I'm currently inserting 54 which is approximately the correct value. This is not the correct term as it is only a fixed value.

    But before I can determine the algorithmic term for the height I need to first understand why when I use a negative term, it does not plot a rectangle. Example, if I use -54, no rectangle appears.

    I'm still very confused on how to best get the Y and the Height terms to dynamically plot the rectangles.

    regards,
    taddypole...
    Attached Files

    #2
    I think I can answer my own question.
    If X & Y designate the upper left of the rectangle, width and height can only be positive as a relative position. Specifying a negative value for width or height will place those points outside the boundaries of the rectangle. Once I accepted this and figured out the algorithm for the rectangle width and height, all is now working.

    regards,
    taddypole...

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kaywai, Today, 06:26 AM
    1 response
    5 views
    0 likes
    Last Post kaywai
    by kaywai
     
    Started by ct, 05-07-2023, 12:31 PM
    6 responses
    203 views
    0 likes
    Last Post wisconsinpat  
    Started by kevinenergy, 02-17-2023, 12:42 PM
    118 responses
    2,780 views
    1 like
    Last Post kevinenergy  
    Started by briansaul, Today, 05:31 AM
    0 responses
    10 views
    0 likes
    Last Post briansaul  
    Started by traderqz, Yesterday, 12:06 AM
    11 responses
    28 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X