Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit a position at specific time using renko?

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

    Exit a position at specific time using renko?

    Hi NT Team,
    After hours of searching online I decided to get the help directly from you.
    I built a strategy in strategy builder using NinZaRenko Bars. I applied a time filter to enter trades and I set a profit target. I only have one position open at a time. I want to exit my long or short position at the endtime set by my time filter. The filter works great for entries but I can't get the position to close at that particular time and end up holding until session close. Is it possible in strategy builder to exit at a specific time? what would the code look like to accomplish that. Thank you for helping!​

    #2
    Hello HappyTrader76,

    Thanks for your post.

    A Time condition could be created that checks if the current Time is equal to the time you want to place your Exit order and then call your Exit method within that condition.

    See this help guide page for more information about creating Time Conditions: https://ninjatrader.com/support/help...imeComparisons

    Note that if you are using Calculate.OnBarClose, the strategy will only process logic at the close of each bar. To exit orders intrabar, you would need to use either Calculate.OnPriceChange, or Calculate.OnEachTick.

    Calculate: https://ninjatrader.com/support/help.../calculate.htm
    Conditions: https://ninjatrader.com/support/help...on_builder.htm
    Actions: https://ninjatrader.com/support/help...t8/actions.htm

    Let me know if I may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      ​Thank you for that fast reply BrandonH. Unfortunately I had already tried this and it doesn't work (I tried it again just now). Attached is a Screenshot of my conditions and actions Tab. I wonder if my profit target set under "Stops and Targets" somehow overrides this condition? I thought that I either reach the target or else I exit the position at the set time. But that obviously doesn't work Or do I have to add a minute time series to run this condition through that time series? But I wouldn't know how to set that up.
      Thank you for your assistance!

      Comment


        #4
        I hope this picture works...

        Comment


          #5
          Hello HappyTrader76,

          Thanks for your note.

          After further researching this I have found that since a Renko bar is not a time-based bar and is based on price movement, there wouldn't be any way of knowing what the close time of the bar will be.

          You could instead add a 1-minute series and have the time conditions be based on that added 1-minute series so you have predictive bar closes. Note that this requires unlocking the script from the Strategy Builder using the 'Unlock code' button and manually programming your logic into the script using the NinjaScript Editor window.

          AddDataSeries(): https://ninjatrader.com/support/help...dataseries.htm
          Working with Multi-Timeframe/Multi-Instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm

          Use prints to understand the behavior of the script. Prints will appear in a New > NinjaScript Output window.

          Using prints to understand behavior: https://ninjatrader.com/support/foru...ing#post791121

          Let me know if I may assist further.​
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment


            #6
            Hello BrandonH,
            Thank you for the quick response, I found out, that a market order seems to work but Limitorders with either Bid or Ask price doesn't work. I guess that has to do with the backtesting data. I'll try and implement the additional time series as you suggested. Thanks!

            Comment

            Latest Posts

            Collapse

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