Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Exit right before Session Close

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

    Exit right before Session Close

    Trying to do a strategy that will automatically close a position for the ES (S&P 500 e-mini) on session close (the "day" session), preferably before the close such as at 3:55pm EST... but when I put the strategy on a chart... it closes the trade at the 17:00 Eastern bar. Even if I have "Exit on Session Close" selected in the strategy and on the chart and have the "Exit on Session close in seconds" set to 3600 and it doesn't seem to have an effect on the exit time when I plot the strategy on a chart.

    Also, does anyone have an idea on how to figure out when the opening range of a market is in ticks such as the ES between 8am and 10am EST... and if it's over "X" amount of ticks... don't take the signal? I have a real good free indicator that I got off of Futures.io called ama_Opening_Range that will visually mark the opening range based on the times we give it... and plots the opening range high and opening range low. So, I would think that the "math" is already laid out by referencing that indicator. Just not sure how to do it via code or in the strategy builder. In laymans terms, I guess I would "say" take the opening range high plot and subtract the opening range low plot from it and if that number result is over say 5 ticks... pass on the trade.

    #2
    Hello TicksBandit,

    Thank you for your note.

    The reason why the exit on close is on bar close historically is because only OHLC are known historically. In real time, the exit on close would work as expected. If you'd like historical trades to occur before the bell, you should add a secondary tick series. I have provided a link giving me detail,
    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


    You may also be interested in,


    Regarding subtracting 1 plot from another to calculate the opening range, this would not be possible to write in the builder and would require you open the editor and modify the code, but your logic does seem correct.

    Below is a link on using the NS editor,

    NT8 NinjaScript Editor:
    Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.


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

    Comment


      #3
      Your explanation I think was to something I posted in another thread... in reference to closing on the close of a bar and doing the trade on the next bar rather than entering a trade on the current bar, right when it signaled.I'm using delayed data (the $55 package from Kinetick)... which I assume is different than EOD historical data? Also, for Forex... I'm using the Free Trial you guys give from FXCM... and it's still doing it.... and I have Calculate.OnEachTick for everything... the indicators and the strategy.

      This thread's post is how do I make a 15M chart for example... ie an intraday chart close the trade at 3:45pm EST on a S&P 500 emini trade.

      I think your answer was because of historical data that if I had a signal at 11:45, on a 15M Chart, the entry would be on the 12:00 bar... I wasn't asking about that in this thread. I want it to close the trade near the end of the day, just not at 1700 (EST time).

      Comment


        #4
        Also, to address your answer and the question I proposed in another thread (not what my question on this thread was)... what the guy talks about in the link: https://ninjatrader.com/support/foru...ead.php?t=6652 is exactly what I want to do (enter on the same bar the signal hits on) but that link just provides code and a broad overview... how can we actually do it. That would be most helpful... in layman's terms. I don't get what he means when he says, send the order to another time frame to get intrabar execution - ie. entry execution on the same bar the signal goes off on. I saw the download file he had on that thread but I don't understand how to make it happen.

        At this point, I have 2 distinct questions... and then I can move forward with my NT journey:
        1. I have a strategy that is based on 15m chart and has a condition to exit. If that isn't met... exit just before the session close. Preferably at 3:45pm and not on the official session closed as NT 8 sees it, which is at 1700 on the ES (S&P e-mini). I don't think this has to do with on bar close per se... because the entry could have had happened earlier in the day on the 15m charts... it's the end of session process you guys have... or just before it that I'm trying to close the trade out on.

        2. This is separate and different than #1 above. For the intrabar stuff. How do I get it so that I can go long (or short) with an entry... and get the system to enter on the same bar as the signal bar. Not just with entries but on exits too (not talking session close exits). I'm using delayed intraday data (from kinetick) and the free trial FXMC data, which I assume is "real time" and all my entries occur on the next bar not the one where the signal went off on. I get it on historical data, there is no tick data to do it on. I went to the pages you mentioned in your reply and those aren't helping me out.

        Comment


          #5
          Hello TicksBandit,

          The link you post is the same link I provided in reply 2, which is the same post where I address subtracting two plots for the opening range, which addresses both questions you answered in your opening question.

          Yes, the link provides a general sample for which you could refactor into a working solution. To do this would require coding experience and would require you to work outside the strategy builder. May I ask if you write code?

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

          Comment


            #6
            Yes, I read all of your replies on this thread and others. I know the link you posted is the same one... I was referencing it in my reply.

            I implemented the simulated feed... didn't work as I wanted, still executing the entry on the 2nd bar. I tried the BarsInProgress code and it still did the same thing. I looked around on the threads on here and some people are suggesting it's a known NT 8 glitch. This is frustrating, to say the least as what bar to enter on should be a fundamental thing.

            In terms of me writing code... yes, besides successfully trading for 20 years and having a trading following due to that success... I have owned and run a web development company for years. I code in about 5 languages... none of which is c#... although I'm learning. I'm surprised that it would require coding just to get the entry to occur on the right bar... ie. where the signal actually occurred.

            I have used platforms like NT8 since back in the days of the old TradeStation EasyLangauge stuff (circa... maybe 2000 or so).

            I just don't get why all of my entries happen on the next bar and not the "signal bar". I tried what you said... and this "glitch" or whatever it is... is the only thing keeping me from being a paying customer and brokerage client. I have come a long way from knowing nothing with NT8 to feeling comfortable now... in just 10 days or so... but this is something I cannot sort out.

            I read the help docs... I tried what you said and either I'm not explaining it right or you're not understanding what I'm saying or for some reason, you're sending me all over the place rather than letting me know how to just make this work.

            Also, still need an answer on how to close my trades by a set time, if they haven't already been closed.
            I use end of session, which from a practical trader's POV is 4:15pm EST on the S&P 500 not really 1700 like how NT8 seems to have it... or at least closed my trades based on the End of Session setting. BUT, what I need (And this is different than the entry being 1 bar late) is to close the trade by a set time... say 1545 hours Eastern. When I asked it earlier, you gave a response to the other question I had and not that one.

            Is there someone I can talk to on the phone about this? This is excruciatingly frustrating and I think one quick call could solve it. I can see on the charts that the signal I setup is going off... I see that everything is looking good EXCEPT it's entering the trade 1 bar too late.

            Comment


              #7
              Hello TicksBandit,

              I have replied to your other thread with an email for you to reply to.

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

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by love2code2trade, Yesterday, 01:45 PM
              4 responses
              28 views
              0 likes
              Last Post love2code2trade  
              Started by funk10101, Today, 09:43 PM
              0 responses
              7 views
              0 likes
              Last Post funk10101  
              Started by pkefal, 04-11-2024, 07:39 AM
              11 responses
              37 views
              0 likes
              Last Post jeronymite  
              Started by bill2023, Yesterday, 08:51 AM
              8 responses
              44 views
              0 likes
              Last Post bill2023  
              Started by yertle, Today, 08:38 AM
              6 responses
              26 views
              0 likes
              Last Post ryjoga
              by ryjoga
               
              Working...
              X