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

Code to Choose Nearest Value of Reference Number

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

    Code to Choose Nearest Value of Reference Number

    Hello,

    I need support to develop a code that between 5 variables, always choose the one near 1.00

    For instance:

    Day 1:
    A = 0.95
    B = 1.07
    C = 0.99
    D = 0.97
    E = 1.04

    Day 2:
    A = 0.90
    B = 1.02
    C = 0.94
    D = 1.03
    E = 0.97​

    So in day 1 must choose C variable over the other 4, and day 2 must choose B, and so on.

    thank you.



    #2
    Hello diorfo57,

    Thanks for your post.

    There are no NinjaScript methods that would retrieve a value that is closest to a specific number.

    This would require coming up with your own custom C# logic to accomplish. This could likely be accomplished by using a list of some sort, however, using a List goes outside our scope of support in the Support department at NinjaTrader. You could consider doing some research, such as a Google search, on how to accomplish this using custom C# logic.

    This forum thread will be open for other community members to share their insights on the matter.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ageeholdings, Today, 07:43 AM
    0 responses
    6 views
    0 likes
    Last Post ageeholdings  
    Started by pibrew, Today, 06:37 AM
    0 responses
    4 views
    0 likes
    Last Post pibrew
    by pibrew
     
    Started by rbeckmann05, Yesterday, 06:48 PM
    1 response
    14 views
    0 likes
    Last Post bltdavid  
    Started by llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    12 views
    0 likes
    Last Post burtoninlondon  
    Working...
    X