• 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 Newtrader101, Today, 08:01 AM
    0 responses
    4 views
    0 likes
    Last Post Newtrader101  
    Started by Johnny Santiago, 10-11-2019, 08:21 AM
    6 responses
    101 views
    0 likes
    Last Post 4x777
    by 4x777
     
    Started by pjsmith, Today, 02:42 AM
    2 responses
    16 views
    0 likes
    Last Post pjsmith
    by pjsmith
     
    Started by moyerchopra, Yesterday, 11:43 PM
    0 responses
    5 views
    0 likes
    Last Post moyerchopra  
    Started by ttodua, Yesterday, 11:40 PM
    0 responses
    6 views
    0 likes
    Last Post ttodua
    by ttodua
     
    Working...
    X