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

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 Segwin, 05-07-2018, 02:15 PM
      14 responses
      1,788 views
      0 likes
      Last Post aligator  
      Started by Jimmyk, 01-26-2018, 05:19 AM
      6 responses
      837 views
      0 likes
      Last Post emuns
      by emuns
       
      Started by jxs_xrj, 01-12-2020, 09:49 AM
      6 responses
      3,293 views
      1 like
      Last Post jgualdronc  
      Started by Touch-Ups, Today, 10:36 AM
      0 responses
      12 views
      0 likes
      Last Post Touch-Ups  
      Started by geddyisodin, 04-25-2024, 05:20 AM
      11 responses
      62 views
      0 likes
      Last Post halgo_boulder  
      Working...
      X