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 rdtdale, Today, 01:02 PM
      0 responses
      3 views
      0 likes
      Last Post rdtdale
      by rdtdale
       
      Started by alifarahani, Today, 09:40 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by RookieTrader, Today, 09:37 AM
      4 responses
      18 views
      0 likes
      Last Post RookieTrader  
      Started by PaulMohn, Today, 12:36 PM
      0 responses
      7 views
      0 likes
      Last Post PaulMohn  
      Started by love2code2trade, 04-17-2024, 01:45 PM
      4 responses
      41 views
      0 likes
      Last Post love2code2trade  
      Working...
      X