• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Placing an order before the end of a bar

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

    Placing an order before the end of a bar

    I tried finding this information on the Support Forum but haven't been able to find it. If these questions have already been answered, please point me in the right direction.

    I am writing a strategy that trades Equities and uses 2 time frames, LTF (Lower Time Frame) and HTF( Higher Time Frame). The LTF will always be in minutes (5 min, 15 min, etc). The HTF may be in minutes (30, 60, 120 etc). It can also be daily, weekly or monthly.

    The entry/exit decisions are done at the end of the HTF bar. Market Orders are placed for the open of the next bar. For backtesting this is not an issue. However for Real Time Trading, at the end of the day (even if the HTF is in minutes), I want to place the trade before the end of the day. I don't want to place a market order for the open of the next day. I have a few questions

    1) Is there a way for the strategy to determine, in real time, that the current time is x minutes or y seconds from the end of the current trading day?

    2) Will this method "know" if "today" is a short trading day

    3) If using weekly or monthly bars on the HTF, is there a way to determine if "today" the current day, is the end of the week or end of the month?

    #2
    Hello krofs,


    Thank you for the post.


    1) Is there a way for the strategy to determine, in real time, that the current time is x minutes or y seconds from the end of the current trading day?
    Generally, the SessionIterator object is used for any session related information, you can find the session times using this object which could then be compared against the processing series time:

    https://ninjatrader.com/support/help...oniterator.htm


    2) Will this method "know" if "today" is a short trading day
    Only if you add this type of logic, the concept of a short trading day only relates to your strategies logic and it detecting it to be a short trading day.

    3) If using weekly or monthly bars on the HTF, is there a way to determine if "today" the current day, is the end of the week or end of the month?
    You can do various comparisons with the DateTime objects, this will depend on what you mean by "Today". Do you mean the time from one of the secondary series or would this be the higher timeframe?

    If you mean the lower timeframe series, you can use its Time object to determine where in time that BarsInProgress currently is. If you mean at the time of the bar close for the higher time frame, the Times reported on that call would only be intervals of the series, so 1 week, month interval timestamps. The lower time frames would have more granular timestamps or you could also use the OnMarketData override to get the last ticks time. Again this depends on which series you are referring to here, I could suggest using Prints in your script and Print the timestamps as it processes to get an idea of the processing it takes.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you, I'll give it a try

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by StealthM93, Today, 07:58 PM
      0 responses
      2 views
      0 likes
      Last Post StealthM93  
      Started by Mykro, Today, 11:01 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by bauerjj10, Today, 12:24 PM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Newtrader101, Today, 06:01 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_EricB  
      Started by Steve L, Today, 03:50 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X