• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Math problem

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

    Math problem

    Hi, im an arts guy, math was always my Aquiles heel, i been trying to find a way to input a percentage i wanna display between 2 values, i been looking around, googled it but cant find the right formula

    Basically i have "Value X" & "Value Y", and i want to, manually via parameters display the 30% increase between those two numbers ..

    double Calc= ( ? formula ?? PercentageInput ? );

    help please

    #2
    Hello kabott,

    If I'm understanding correctly, you are trying to find a result of a 30% increase in two numbers -- is that correct? You can accomplish this by multiplying the value by 1.30. For example:

    double Calc = xValue * 1.30;

    Or, if you're looking to calculate the total of two numbers, both of which increased by 30%, you can use parenthesis to separate the multiplication from the addition, like so:

    double Calc = (xValue * 1.30) + (yValue * 1.30);

    Alternatively, if you are trying to find the percentage change between two numbers, you can use the formula for percentage change, like so:

    double Calc = ((newValue - oldValue) / oldValue) * 100;

    Please let me know if I can assist further.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Hi Davel, im not sure which one is it, i have 2 numbers

      x ---------------- example 1.568 (being the 100%)


      y----------------- example 1.250 (being the 0%)

      and by imputing in parameters example "30"

      i want a percentage line to show what the 30% is between those two numbers, so



      x ---------------- example 1.568 (being the 100%)

      p------------------ ?? (being the 30 %)
      y----------------- example 1.250 (being the 0%)


      man, i suck at math lol
      Last edited by kabott; 12-01-2014, 04:15 PM.

      Comment


        #4
        Hi kabott,

        I see what you mean now. We normally do not dive too deep into handling math and logic problems, but one way to do this would be to determine the value equal to 30% of the distance between x and y, then add that value to y, like so:

        p = y + ((x-y) * .30);

        This thread will remain open to allow other forums members to add their comments, as well.

        Please let me know if I can assist further.
        Dave I.NinjaTrader Product Management

        Comment


          #5
          Originally posted by kabott View Post
          Hi Davel, im not sure which one is it, i have 2 numbers

          x ---------------- example 1.568 (being the 100%)


          y----------------- example 1.250 (being the 0%)

          and by imputing in parameters example "30"

          i want a percentage line to show what the 30% is between those two numbers, so



          x ---------------- example 1.568 (being the 100%)

          p------------------ ?? (being the 30 %)
          y----------------- example 1.250 (being the 0%)


          man, i suck at math lol
          Davel gave you the formula. Just want to edit it a little bit, since you want to input "30" instead of "0.3", the formula will be:

          p = y + (x - y)*Factor/100
          where Factor is your input, such as 30, 20, 40...
          (assuming Factor is a "double")

          Cheers,
          Pi
          Last edited by ninZa; 12-02-2014, 10:06 PM.
          ninZa
          NinjaTrader Ecosystem Vendor - Ninza

          Comment


            #6
            Yep! that one i figured out on my own! XD Thanks Ninza!

            Comment


              #7
              slippage in stocks

              Hello, how to calculate slippage in stocks?

              example;

              I necestio one action = $ 0.10 As slippage?

              Thank you.

              Comment


                #8
                Hello Optimuss,

                Just to clarify -- are you currently trading live through a broker, or are you using a Sim account? If you are trading live through a broker, there will not be a way to add a set amount of slippage to historical order reporting. The slippage that occurs naturally on live orders can be calculated by comparing your order entry prices to their corresponding fill prices.

                If you are using a Sim account, you can set NinjaTrader to mimic a slight delay in transmitting orders and in order fill processing. To do this, click Tools > Options from the Control Center, then click the Simulator tab. In the Simulator tab, change the values in the "Delay Comm" and "Delay Exchange" fields.

                Furthermore, if you are using the Strategy Analyzer to backtest an automated trading strategy, you can set a specific amount of slippage to include on each trade.

                Please let me know if I can assist further.
                Dave I.NinjaTrader Product Management

                Comment


                  #9
                  Originally posted by NinjaTrader_DaveI View Post
                  Hello Optimuss,

                  Just to clarify -- are you currently trading live through a broker, or are you using a Sim account? If you are trading live through a broker, there will not be a way to add a set amount of slippage to historical order reporting. The slippage that occurs naturally on live orders can be calculated by comparing your order entry prices to their corresponding fill prices.

                  If you are using a Sim account, you can set NinjaTrader to mimic a slight delay in transmitting orders and in order fill processing. To do this, click Tools > Options from the Control Center, then click the Simulator tab. In the Simulator tab, change the values in the "Delay Comm" and "Delay Exchange" fields.

                  Furthermore, if you are using the Strategy Analyzer to backtest an automated trading strategy, you can set a specific amount of slippage to include on each trade.

                  Please let me know if I can assist further.
                  Hey, if it is to backtest Strategy.

                  For 1 action = $ 0.10 to catidad I put in slippage?

                  Comment


                    #10
                    Hi Optimuss,

                    I'll be happy to walk you through the process. However, please note that the slippage must be entered in terms of ticks, so you will not be able to specify a certain monetary value of slippage per trade.

                    Please use the following steps to add slippage to your strategy backtest results:

                    - In the Strategy Analyzer, select the instrument that you wish to use for the test, then click the "backtest," "optimize," or "walk forward" button near the top of the window
                    - In the options window that appears on the right of the Strategy Analyzer, enter a tick value in the "Slippage" field, in the "Historical Fill Processing" section

                    Please let me know if I can assist further.
                    Dave I.NinjaTrader Product Management

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Conall, Today, 06:11 AM
                    1 response
                    9 views
                    0 likes
                    Last Post NinjaTrader_Kate  
                    Started by CaptainAmericaXX, Today, 07:41 AM
                    1 response
                    3 views
                    0 likes
                    Last Post NinjaTrader_Jim  
                    Started by Longhornmark, Today, 07:06 AM
                    2 responses
                    7 views
                    0 likes
                    Last Post Longhornmark  
                    Started by 2sureshk, Today, 07:29 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post 2sureshk  
                    Started by uday12, Yesterday, 10:26 PM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_PaulH  
                    Working...
                    X