Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Working on two products (stocks) at the same time

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

    Working on two products (stocks) at the same time

    Hi, I want to perform backtesting using the notion of relative
    strength. I would compare price action for a given stock to the "price" action of a given index (e.g. Nasdaq).

    Visually, I would set up a chart with Panel-1 displaying stock price action and Panel-2 would display the Index price action.

    I what manner can I tell my ninjascript that I wish to manipulate the stock price in certain cases, then maninpulate the index price in others?

    If I wanted to code the following pseudo-code:

    IF Stock_Price_Last_Close > EMA(15)[0]
    AND Index_Price_Last_Close > EMA(15)[0]

    What would replace Stock_Price_Last_Close and Index_Price_Last_Close ?

    #2
    Hello marcusplexus,

    Thanks for your note.

    The Closes series will contain all of the added data series. You will need to add the additional data series to the script using the Add() function, separate from adding them to the chart's lower panel as well.

    For example, if the primary data series is GOOG and the secondary is ^NDX (Nasdaq 100):

    Closes[0] will contain the GOOG Close data series. Closes[0][0] will be current bar of GOOG.
    Closes[1] will contain the ^NDX Close data series. Closes[1][0] will be the current bar of ^NDX.


    Below is a link to the help guide Multi-Time Frame & Instruments. This is covered in the section 'Accessing the Price Data in a Multi-Bars NinjaScript'.
    http://www.ninjatrader.com/support/h...nstruments.htm


    Please let me know if I can be of any other assistance.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Solved! Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      566 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      330 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      547 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      548 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X