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 with multiple data series Minute and Tick

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

    Working with multiple data series Minute and Tick

    Hello,

    Some information on my strategy:
    - instrument = S&P e-mini
    - Calculate = OnBarClose
    - primary data series = 30 minute
    - secondary data series = 1 tick
    - profit target = 4 ticks
    - the strategy only works between to hours of 8:30 AM to 9:00 AM (30minutes)

    The strategy is supposed to capture the open price of the initial bar (Open[0]) and should take profit 4 ticks away. For backtests purposes, obviously the only values known to the computer is the OHLC so it wont capture intrabar granularity.

    Is it possible to write a line of code like this while using two data series:
    ------------------------------------------------------------------
    if ((Close[1] >= (Open[0] + (4 * TickSize))))

    EnterLong(Convert.ToInt32(OrderQuantity), "LSEntry");
    ------------------------------------------------------------------

    Also, in the beginning of OnBarUpdate, I have these lines written:
    ------------------------------------------------------------------

    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 1
    || CurrentBars[1] < 0)
    return;

    ------------------------------------------------------------------

    How can I change these to allow the script to run multiple data series?

    #2
    Hi, thanks for posting. Strategies can add extra data series with the AddDataSeries method. We have a full guide on multi time frame and instrument scripts here:



    There are also two full examples in the platform that come default called SampleMultiInstrument and SampleMultiTimeFrame.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by junkone, Today, 11:37 AM
    2 responses
    14 views
    0 likes
    Last Post junkone
    by junkone
     
    Started by frankthearm, Yesterday, 09:08 AM
    12 responses
    44 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by quantismo, 04-17-2024, 05:13 PM
    5 responses
    35 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by proptrade13, Today, 11:06 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    35 views
    0 likes
    Last Post love2code2trade  
    Working...
    X