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

About the Time frame

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

    About the Time frame

    Hello,

    I am new. When the first condition found from 15 minutes and then the second condition found from 5 minutes.
    I would like to trade in 5 minutes and know the script.

    Thank you and excuse my English.

    Code:
    For example:
    Condition 1(15M) ->Condition 2(5M) -> Entry
    
      // Entry condition 1
       if (CrossAbove(RSI(14, 3), 30, 1)) 
       
         // Entry condition 2
        if (Close(0)<(EMA(20))      
             EnterLong("??");

    #2
    Hello delta234,

    You will need to add a secondary bar series to your script.

    For example if you run this on a 5 minute chart, add a 15 minute series to your script. Then use that BarsArray object to supply the 15 minute bars to the indicator call.

    In Initialize():
    Add(PeriodType.Minute, 15);

    In OnBarUpdate():
    if (BarsInProgress == 0 && CrossAbove(RSI(BarsArray[0], 14, 3), 30, 1) && Closes[1][0] < EMA(BarsArray[1], 20)[0])
    {
    // execute code
    }

    Below are a few links to the help guide on working with multiple time frames.

    Multi-Time Frame & Instruments - http://ninjatrader.com/support/helpG...nstruments.htm

    Add - http://ninjatrader.com/support/helpGuides/nt7/add3.htm

    BarsArray - http://ninjatrader.com/support/helpG.../barsarray.htm

    BarsInProgress - http://ninjatrader.com/support/helpG...inprogress.htm

    Closes - http://ninjatrader.com/support/helpG...nt7/closes.htm
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    238 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    383 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    1 view
    0 likes
    Last Post oviejo
    by oviejo
     
    Started by pechtri, 06-22-2023, 02:31 AM
    10 responses
    125 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Working...
    X