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 JoMoon2024, Today, 06:56 AM
    0 responses
    6 views
    0 likes
    Last Post JoMoon2024  
    Started by Haiasi, 04-25-2024, 06:53 PM
    2 responses
    19 views
    0 likes
    Last Post Massinisa  
    Started by Creamers, Today, 05:32 AM
    0 responses
    6 views
    0 likes
    Last Post Creamers  
    Started by Segwin, 05-07-2018, 02:15 PM
    12 responses
    1,786 views
    0 likes
    Last Post Leafcutter  
    Started by poplagelu, Today, 05:00 AM
    0 responses
    3 views
    0 likes
    Last Post poplagelu  
    Working...
    X