• 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

Relative Performance Charts Comparing Two Instruments

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

  • Splex
    started a topic Relative Performance Charts Comparing Two Instruments

    Relative Performance Charts Comparing Two Instruments

    Hey,

    I was wondering how I can view the relative performance of two instruments. For example, this is achieved on other platforms by entering [Instrument 1]/[Instrument 2], essentially dividing one by the other.

    Thanks

  • NinjaTrader_PaulH
    replied
    Hello 2sureshk,

    Thanks for your post.

    Sorry for the error in the example, please try Values[0] = Closes[0][0] / Closes[1][0]; // divide the current bar value of the chart bars by the added data series.

    Leave a comment:


  • 2sureshk
    replied

    Hi When I use the script with NT8 it gives and error during compilation
    myditorIndicator.cs Operator '/' cannot be applied to operands of type 'NinjaTrader.NinjaScript.PriceSeries' and 'NinjaTrader.NinjaScript.PriceSeries' CS0019 59 13
    Values[0] = Closes[0] / Closes[1]; any help with syntax is appreaciated thanks

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Splex,

    You would need to add this calculation to an indicator.

    Open a NinjaScript Editor from the New menu
    Right-click the Indicators folder and select New Indicator
    In the Indicator Wizard on the Additional Data page add a secondary instrument
    On the Plots and Lines page add a plot
    Generate the script

    Within the OnBarUpdate() methods action block add the code
    Code:
    if (CurrentBars[0] < 1 || CurrentBars[1] < 1)
    {
    Values[0] = Closes[0] / Closes[1];
    }
    Then right-click the code and select Compile.
    Next add the indicator to a chart.

    Below is a public link to a post with helpful information about getting started with NinjaScript.
    http://ninjatrader.com/support/forum...609#post503609

    A link to a Spread indicator which shows the difference between two instruments.
    https://ninjatrader.com/support/foru...php?linkid=936

    As well as a few links that discuss dynamically using variables to load a secondary series.
    https://ninjatrader.com/support/foru...349#post424349
    https://ninjatrader.com/support/foru...489#post451489

    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by richa61416, Today, 01:18 PM
0 responses
1 view
0 likes
Last Post richa61416  
Started by Robotman, Today, 01:08 PM
0 responses
3 views
0 likes
Last Post Robotman  
Started by StevenNelson, Today, 12:29 PM
1 response
5 views
0 likes
Last Post NinjaTrader_Kate  
Started by anupsoni, Today, 12:23 PM
1 response
3 views
0 likes
Last Post NinjaTrader_Kate  
Started by aligator, Yesterday, 12:15 PM
7 responses
62 views
0 likes
Last Post aligator  
Working...
X