Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entering market during a bar

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

    Entering market during a bar

    I want to backtest a break-out rule,
    The simple entering strategy is:at the beginning of the bar, I have a level (either calculated based on bars before or predfined) that I would like to buy if break up during the new bar begin to end time period. Is there anyway to achieve this or at least approximate this?

    I am using OnBarUpdate() method and looks can not achieve this goal. The following is something I did:

    protected override void OnBarUpdate()
    {
    if(this.DonchianChannel(PREDFINEDLEVL < this.GetCurrentAsk()){
    enterlong(1);
    }
    }

    The problem is when currentask > PREDEFINEDLEVEL, it is usually too late to enter.

    #2
    Originally posted by sunjoke399 View Post
    I want to backtest a break-out rule,
    The simple entering strategy is:at the beginning of the bar, I have a level (either calculated based on bars before or predfined) that I would like to buy if break up during the new bar begin to end time period. Is there anyway to achieve this or at least approximate this?

    I am using OnBarUpdate() method and looks can not achieve this goal. The following is something I did:

    protected override void OnBarUpdate()
    {
    if(this.DonchianChannel(PREDFINEDLEVL < this.GetCurrentAsk()){
    enterlong(1);
    }
    }

    The problem is when currentask > PREDEFINEDLEVEL, it is usually too late to enter.
    From the Reference Samples subForum:
    You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by

    Following are links to all available NinjaScript reference samples within this forum section: Strategy Reference Samples (NinjaTrader 8) - also applicable to NT7 Using a time filter to limit trading hours (http://www.ninjatrader.com/support/forum/showthread.php?t=3226) Using multiple entry/exit signals simultaneously

    Comment


      #3
      Hi Sunjoke,

      Thank you for posting.

      Koganam, provided a couple links for good references samples.
      The intrabar granularity is important because it allows you to have your strategy calculate on a tick by tick basis as you ran the strategy with CaluclateOnBarClose set to false.

      I would take a look through those and see what can help you.

      Let me know if I can be of further assistance.
      Cal H.NinjaTrader Customer Service

      Comment


        #4
        Never mind. I got it.

        It was really helpful looking at those example. I have a further question about the definition of "session" which I read in the post "Strategy: Monitoring for and trading a breakout".

        Can you elaborate more about how does a session begin and end? I guess it might be related to a full cycle of entering till closing a trade? If that is the case, if I have multiple entering signal and multiple closing rules, how does a session defined?
        Last edited by sunjoke399; 12-13-2013, 11:11 PM.

        Comment


          #5
          Is this a joke Q?

          Ah from sunJOKE..

          Research session template. ..

          What are you trading?

          Originally posted by sunjoke399 View Post
          It was really helpful looking at those example. I have a further question about the definition of "session" which I read in the post "Strategy: Monitoring for and trading a breakout".

          Can you elaborate more about how does a session begin and end? I guess it might be related to a full cycle of entering till closing a trade? If that is the case, if I have multiple entering signal and multiple closing rules, how does a session defined?
          Last edited by sledge; 12-13-2013, 10:35 PM.

          Comment


            #6
            Sunjoke,

            A session is the trading session of the instrument that you are trading.

            If you were trading the NYSE on the regular trading hours, you would be trading from 9:30 AM til 4:00 PM Eastern Standard Time.

            http://www.ninjatrader.com/support/h...on_manager.htm
            Cal H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            69 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            42 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            24 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            27 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            54 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X