Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Show instrument performance based on time range

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

    Show instrument performance based on time range

    Hi,

    Is it possible to show instrument performance, let's say from daily open (or from YTD)? Would need it as an indicator or as a plain number.

    br,
    Chris

    #2
    Hello suroot,

    Thank you for your post.

    Can you clarify what you are referring to as the performance on the instrument? Is this your own trade executions on the instrument or the performance of the instrument over the year?

    Any additional details you can provide will be most helpful.

    I look forward to your response.

    Comment


      #3
      Hi,

      Thanks for Your reply!

      I would like to see the instrument performance in % (in Market Analyzer or on the chart somehow etc.).

      Example:
      - SPY performance today = +1.23%
      - SPY performance YTD = +9.8%
      - SPY performance last 7 days = +2.3%

      It would also be nice to plot the price as % as in this chart below:


      Thanks!

      br,
      Chris

      Comment


        #4
        Hello suroot,

        Thanks for your reply.

        I just wanted to let you know that I am reviewing your inquiry and will follow up with you here once I have determined the best course of action to take moving forward.

        Please let me know if I may be of any further assistance.
        Alan S.NinjaTrader Customer Service

        Comment


          #5
          Hi,

          Thanks for looking into this.

          I though guess that there is no way of doing this with built in features in Ninjatrader. However, I was looking at some indicators with NinjaScript Editor and saw an example where "Bar.IsFirstBarOfSession".

          Could someone point me in the right direction, could I use "Bar.IsFirstBarOfSession" and divide it with current bar close to get the percentual movement for a selected instrument?

          Any help is much appreciated!

          br,
          Chris

          EDIT:

          Tried to look more into this and now figured out that I somehow need to use CurrentDayOHL().CurrentOpen[0] to get the daily open price.

          Still though not sure how to divide it with Close[0]
          Last edited by suroot; 06-26-2017, 06:29 AM.

          Comment


            #6
            Hello suroot,

            Thanks for your reply and your patience.

            There are no supported methods to change the primary panel's y-axis values to be displaying the percent change rather than the price, but you can add the ROC indicator to your chart to plot the percent change in price from one period to the next in its own indicator panel.

            You can find more info on the ROC indicator in our help guide here:http://ninjatrader.com/support/helpG...change_roc.htm

            In order to divide the current open price with the current close, you would need to save that value to a double, like so:

            // this saves the result of dividing the Current open on the current bar by the close value of the current bar to the openCloseChange variable
            double openCloseChange = CurrentDayOHL().CurrentOpen[0]/Close[0];

            Please let me know if I may be of any further assistance.
            Alan S.NinjaTrader Customer Service

            Comment


              #7
              Hi!, where in the code would I insert the code above?

              Comment


                #8
                Hello starman85,

                Welcome to the NinjaTrader forums!

                This code would likely be in OnBarUpdate(), updating values each time the bar updates with new information.


                I am including a link below to a forum post with helpful information about getting started with NinjaScript.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks! I'm not actually a developer but I'll take a look at the links.

                  protected override void OnBarUpdate()
                  {
                  double inputPeriod = Input[Math.Min(CurrentBar, Period)];

                  if (inputPeriod <= 0)
                  return;

                  Value[0] = ((Input[0] - inputPeriod) / inputPeriod) * 100;
                  // this saves the result of dividing the Current open on the current bar by the close value of the current bar to the openCloseChange variable
                  double openCloseChange = CurrentDayOHL().CurrentOpen[0]/Close[0];
                  }

                  Is this correct?

                  Comment


                    #10
                    Hello starman85,

                    Yes, OnBarUpdate() would be the proper place for this custom logic.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Hi Chelsea,
                      Thanks for your reply, what I'm actually looking for is an indicator that would plot the change in price movement from a specific point in time e.g. 24h or whatever the range is on the chart. The value that this is returning doesn't seem to correlate. Is there another add-on that does this?

                      Comment


                        #12
                        Hello starman85,

                        I am not personally aware of an indicator that does this.

                        It would be possible to get the bar number of a specific bar with a DateTime using Bars.GetBar(), and with that bar number get any price information about that bar such as the Close price.


                        With this you could calculate the change between the close price of that bar and the current price, or price of another bar found through Bars.GetBar().
                        Chelsea B.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by PhillT, Today, 02:16 PM
                        2 responses
                        6 views
                        0 likes
                        Last Post PhillT
                        by PhillT
                         
                        Started by Kaledus, Today, 01:29 PM
                        3 responses
                        10 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by frankthearm, Yesterday, 09:08 AM
                        14 responses
                        47 views
                        0 likes
                        Last Post NinjaTrader_Clayton  
                        Started by gentlebenthebear, Today, 01:30 AM
                        2 responses
                        14 views
                        0 likes
                        Last Post gentlebenthebear  
                        Started by PaulMohn, Today, 12:36 PM
                        2 responses
                        17 views
                        0 likes
                        Last Post PaulMohn  
                        Working...
                        X