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

Range Indicator creation

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

    Range Indicator creation

    Hi,
    As a junior develooer I need your help.
    I'm trying to create a new indicator that:
    Gets three inputs
    1. A market price (double). for example 11225.00
    2. First number (double) 1.001
    3. Second number (double) 0.999

    The indicator returns two double numbers
    A. Input #1 * Input #2 (For ex. 11236.00)
    B. Input #1 * Input #3 (For ex. 11214.00)
    The two return outputs creates a range indicator between both

    Second issue:
    How to round a number
    0.5 and up --> Round to upper value ( 1.0 )
    0.49 and down --> Round to lower value ( 0.0 )

    Thanks !
    Lior

    #2
    Hello klior14,

    Thank you for writing in.

    In regards to your first issue, could you please provide more information on what you are trying to do or what the issue is exactly? What do you mean by inputs, are these user defined values? Are these price values?

    To round a number to the nearest whole number you should use,

    Math.Round(xNumToRound,0);

    For example,

    double xNumToRound = .49;
    double numRounded =Math.Round( xNumToRound,0);

    See Math.Round method;
    Use the Math.Round method to the nearest desired value. Examine the MidpointRounding enum type.


    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by maybeimnotrader, Yesterday, 05:46 PM
    2 responses
    22 views
    0 likes
    Last Post maybeimnotrader  
    Started by adeelshahzad, Today, 03:54 AM
    5 responses
    32 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by stafe, 04-15-2024, 08:34 PM
    7 responses
    32 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by merzo, 06-25-2023, 02:19 AM
    10 responses
    823 views
    1 like
    Last Post NinjaTrader_ChristopherJ  
    Started by frankthearm, Today, 09:08 AM
    5 responses
    22 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Working...
    X