• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Opening Gap trading, code/functions

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

    Opening Gap trading, code/functions

    Hi,

    I am trying to backtest a strategy for stocks where I enter a buy order at the high of the first candlestick (5 min) (Start of the market). Could you help me the code or functions to achieve this.

    #2
    Opening Gap trading, code/functions

    Hello pkittali,

    Thanks for writing in to our Support team.

    You can create a check using Bars.FirstBarOfSession to make sure that you are on the first bar, and then submit a buy order at the High using the EnterLongStop() method.

    For example:
    Code:
    if(Bars.FirstBarOfSession)
    {
    EnterLongStop(High[0]);
    }
    You can follow these links to our help guide which explain FirstBarOfSession and High:

    FirstBarOfSession: http://ninjatrader.com/support/helpG...rofsession.htm
    High:
    http://ninjatrader.com/support/helpGuides/nt7/high.htm

    You can find more information on the EnterLongStop() method here:
    http://ninjatrader.com/support/helpG...erlongstop.htm

    Please let me know if I may be of any further assistance.
    Alan S.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by aslane, Today, 12:41 PM
    0 responses
    3 views
    0 likes
    Last Post aslane
    by aslane
     
    Started by NinjaCustomer, 06-06-2018, 08:47 AM
    15 responses
    1,079 views
    0 likes
    Last Post cls71
    by cls71
     
    Started by Johnny Santiago, 04-29-2019, 04:13 AM
    3 responses
    170 views
    1 like
    Last Post bltdavid  
    Started by Darringona, Today, 07:43 AM
    0 responses
    7 views
    0 likes
    Last Post Darringona  
    Started by simonkloot, Today, 07:28 AM
    0 responses
    8 views
    0 likes
    Last Post simonkloot  
    Working...
    X