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 fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,406 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    98 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    8 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    160 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Yesterday, 09:29 PM
    0 responses
    9 views
    0 likes
    Last Post Belfortbucks  
    Working...
    X