TS code for next day MOO exit using 5min data

Discussion in 'Data Sets and Feeds' started by Jock, Feb 21, 2007.

  1. Re what I said earlier:
    I wasn't very clear here. I mean any order to be executed on the Close of the last intra-day bar of the day (instead of Close of the current bar) when you will be checking for the Date of Next Bar.

    I might not be entirely correct here. MOO will not work. Not sure about normal on Close order. I am no longer using intra-day data so I am not able to test it out myself.
     
    #11     Feb 26, 2007
  2. I've found that there are too many sessions that close earlier than the regular session close, but virtually all sessions open at the right time.

    What I would do is just exit at the close of the first 5-min. bar.

    ExitTime = CalcTime(SessionStartTime(0,1), BarInterval);
    ExitLevel = Close;
    If Time = ExitTime Then
    Sell ("Exit") Next Bar at ExitLevel Limit;

    If you can't stand waiting the five minutes, you can exit on the end of the first tick of the session by enabling intrabarordergeneration.

    RoughTrader
     
    #12     Feb 26, 2007
  3. Jock

    Jock

    RoughTrader, thanks for your input on this. I agree … there are too many early closes that need to be addressed differently.

    However regards exiting on the close of the first 5 minute bar, my preference is very much for the open. Unfortunately I only have 5 minute (rather than tick) data so can’t test exiting on the end of the first tick.

    That said I’m pretty happy with ChoSingKum’s suggestion of …

    "If Date < Date of Next Bar then ... ;"

    … this now works well for me.
     
    #13     Feb 26, 2007
  4. Re my earlier post:
    Sorry, that should be: MOC will not work.
     
    #14     Feb 26, 2007
  5. You misunderstood what I meant about exit on the close of the first tick.

    TS offers the ability to execute order inside a bar, so you don't have to wait until the bar is closed to issue an order. If you enable "intrabar order generation" in your strategy, you can write code so that the first tick movement after the open you will exit your position.

    You don't need tick data. You can just assume that your fill will be close enough to the opening price that any difference can be regarded as slippage.

    RoughTrader
     
    #15     Feb 27, 2007
  6. Hi RoughTrader,

    Jock will not be able to use the IntraBarOrderGeneration attribute in his TS 2000i. Also no SessionStartTime(x,x).

    These are only available in versions after TS 2000i.
     
    #16     Feb 27, 2007
  7. Jock

    Jock

    OK I get it now, thanks for the advice. Unfortunately ...

    ... that is indeed the case.
     
    #17     Feb 27, 2007