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 Felix Reichert, 04-26-2024, 02:12 PM
    9 responses
    50 views
    0 likes
    Last Post Felix Reichert  
    Started by AaronKoRn, 04-27-2024, 09:49 PM
    3 responses
    31 views
    0 likes
    Last Post AaronKoRn  
    Started by f.saeidi, Today, 07:07 AM
    6 responses
    19 views
    0 likes
    Last Post f.saeidi  
    Started by cmtjoancolmenero, Today, 02:31 PM
    6 responses
    15 views
    0 likes
    Last Post cmtjoancolmenero  
    Started by Graci117, Yesterday, 11:40 PM
    5 responses
    27 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X