Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entering on break of bar

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

    Entering on break of bar

    I've been trying to create a strategy whereby a trade is entered on the break of a previous bar. I have been using CrossBelow and CrossAbove but these don't provide accurate entries.

    For example, I want to:

    Identify a price level to enter trade based on previous bar high/low.

    As soon as price goes below/above this identified price, I want to be able to enter an order immediately on the next following bar which crosses that price boundary.

    I have tried using GetCurrentAsk() < MyPriceLevel for example, but this still doesn't work even though I've set Calculate.OnPriceChange within OnStateChange() so that OnBarUpdate is called on each price change.

    Example I've tried:

    protected override void OnBarUpdate()
    {

    if(GetCurrentAsk() < SomePriceLevel)
    {
    EnterShort(Convert.ToInt32(DefaultQuantity), @"TheBigShort");
    }

    }

    Can someone please suggest a method which will work or why this won't work.

    Thanks
    Gerard

    #2
    Hello Gerard,

    So I can best answer your question I will need some clarity.

    On the current bar, Close[0], you would like to set the value of SomePriceLevel, based off the high/low of the previous bar, and if the current bar goes above this price, wait until the next bar and execute long? Or would you like to enter on the current bar, Close[0] as soon as it breaches SomePriceLevel?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi there,

      Thanks for your reply.

      I hope this clarifies:

      Example: Bar 'X' closes. Record High of Bar 'X'. As soon as any next following bar as it is forming in real time, say Bar 'Z' equals or goes above the recorded high of Bar 'X' then enter trade immediately. Do not wait for bar 'Z' to close before entering the trade.

      I hope this is clear?

      Thanks
      Gerard

      Comment


        #4
        Hello globaljobber,

        I put together and attached a strategy which will buy the moment the previous bars high is taken out.

        You should run the strategy with Calculate set to On Each Tick. Also you'll want to enable tick replay for historical trades to plot correctly, see note one at the following link explaining this point.


        Please let us know if you need further assistance.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Thanks Alan,

          I'll take a look over the weekend, appreciated.

          Regards
          Gerard

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          39 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          124 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          64 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X