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

Number UpDown Control on NT8 Chart That Accepts Double Values

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

    Number UpDown Control on NT8 Chart That Accepts Double Values

    Hi, I need to add a Number UpDown control to NT8 chart. The UpDown control has to be able to accept decimal/double values, 0.53 for example. I have successfully added QuantityUpDown control to a grid and the grid is added to the chart. However, QuantityUpDown is only accepting integers. Is there a way out to make it accept double values?
    If the above is not possible, is it possible to add System.Windows.Forms.NumericUpDown control to grid and the grid is added to NT8 chart. The System.Windows.Forms.NumericUpDown control can accept double values. I tried doing this through the following code (only included the relevant portion of code) and it ended up with the following errors:

    The best overloaded method match for 'System.Windows.Controls.Grid.SetRow(System.Window s.UIElement, int)' has some invalid arguments. Argument 1: cannot convert from 'System.Windows.Forms.NumericUpDown' to 'System.Windows.UIElement'.

    private System.Windows.Controls.Grid buttonGrid,
    System.Windows.Forms.NumericUpDown NUD;
    //private QuantityUpDown QUD;

    NUD = new System.Windows.Forms.NumericUpDown();
    //QUD = new QuantityUpDown();

    System.Windows.Controls.Grid.SetRow(NUD, 2);
    System.Windows.Controls.Grid.SetColumn(NUD, 2);
    buttonGrid.Children.Add(NUD);

    //System.Windows.Controls.Grid.SetRow(QUD, 2);
    //System.Windows.Controls.Grid.SetColumn(QUD, 2);
    //buttonGrid.Children.Add(QUD);

    The same code works well when used with QuantityUpDown (QUD). The end objective is a Numerical control on NT8 chart that has UpDown arrows and can accept double/decimal values. Seek an expert's advice to get out of this problem. Thanks.

    #2
    Hello Mubeen Haider,

    Thank you for the post.

    The error is specifically because you are trying to pass a windows forms control to a WPF UIElement method. NT8 does not use windows forms so trying to use any controls from that namespace would be difficult. There are certain ways to host a winforms control but that does not work with the NT8 windows due to the use of transparency being enabled. I would not suggest trying to use any windows forms controls as there are quite a few roadblocks by doing so. The quantity selector that NT8 uses is NinjaTrader.Gui.Tools.QuantityUpDown. however the NT8 quantity selector specifically uses an int for its value so that would be unable to use decimal place numbers based on how it is developed.

    The only other way I am aware of would be to use a text box and type in the value, your logic that uses the value could parse the string as a double.

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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by agraham, Today, 01:05 PM
    0 responses
    21 views
    0 likes
    Last Post agraham
    by agraham
     
    Started by jagswe, Today, 01:34 PM
    0 responses
    13 views
    0 likes
    Last Post jagswe
    by jagswe
     
    Started by PaulMohn, Yesterday, 05:25 AM
    9 responses
    34 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by srbdoc, Today, 12:20 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by blar58, Today, 12:19 PM
    1 response
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X