Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to enter only 1 trade per 1 candle only

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

    How to enter only 1 trade per 1 candle only

    Hi
    im making a hot but the problem I come across is it enter another trade After my first was done all in same candle. So I enter trade on tick but not price closed. So sometime nq have big a move move in 1 candle. It take profit and enter another trade that candle still haven't finish. How to avoid that.
    Attached Files

    #2
    Hello SuperDude123,

    Thanks for your post.

    To limit your strategy to once per bar, create an int type variable called EntryBar. In your entry set, add the condition of Misc>Current Bar, Not equal, user variables>EntryBar. In the same set add the action Misc>Set EntryBar and in the field click set then select Misc>Current bar.

    The first time through EntryBar will not be equal to the systems bar counter Current bar and the first trade will occur and in doing so EntryBar is set to the value of Current bar, so on the next occasion(s) the entry will not be permitted.

    Please note that we are asking for your help in keeping our forums organized and in this case this topic is more appropriate for the NinjaTrader8 Strategy Forum. When creating a topic please consider which forum it should be placed in. We will move this topic to the appropriate forum.

    Comment


      #3
      Never mind I got it thank you
      Last edited by SuperDude123; 10-05-2021, 03:47 PM.

      Comment


        #4
        Click image for larger version

Name:	1111111.png
Views:	666
Size:	50.1 KB
ID:	1176834

        So this code would only be in the Entry Condition and Action?
        Wouldnt you need to reset it for once youre out of the trade and its not the same bar? thanks

        Comment


          #5
          How did you figure it out SuperDude123? How did you do yours to only have 1 trade per candle? thanks

          Comment


            #6
            Hello ezrollin,

            Thanks for your posts.

            What you are showing in post #4 is correct, that will limit to one entry per bar when you are using the strategy calculate setting of Calculate.OnPriceChaneg or Calculate.OnEachTick.

            What happens is if the first time the entry conditions are true, the order is placed and the entrybar variable is set the same as the current bar (system bar counter). On subsequent incoming ticks or price change ( when your other entry condition are true the entry condition of EntryBar Not Equal CurrentBars[0] will not be true and so the action section will not be entered, until a new bar has formed.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            66 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            141 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            75 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            46 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            51 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X