OHLC programming

Discussion in 'Trading Software' started by saturnine, Jul 3, 2005.

  1. I am an experienced trader who is only beginning to program systems. I have a basic question about OHLC programming. I am sure there is something quite simple I am overlooking (so no sarcasm) but what concerns me is the following:

    Let's assume that entry for a given system is on a Monday, now if the exit turns out to happen on the same day wouldn't this generate some false signals? The point here is this: There is no way the software can tell which came first H or L, correct? EXAMPLE:

    O 816
    H 823
    L 812
    C 815

    Now let's assume we enter a trade + 2 from each open (theroretical system) but we also exit + 3 points. Now assuming we have no stop this is no problem. However, if we say our stop is 2 points the system will still call this a winner without knowing whether the stop occured first or second... Am I missing something here?

    Mind you I do understand some might state that you would simply need to use intraday tick data for such a short-framed system, which I understand BUT, even longer-frame systems will occasionally hit a target or stop in the same day; so how does an OHLC programmer compensate for this?

    So this could cause problems I would assume unless there is something I am missing. Thoughts on this? Thanks.
     
  2. age old problem... use one minute or tick data I guess...or assume the worst with your daily data and build it into your system.

    or exit on close....
     
  3. kut2k2

    kut2k2

    You need two variables: BOD position and EOD position. If EOD doesn't match BOD, then you know you got stopped out for whatever logic your system is set up for.
     
  4. I'm not sure I fully understand your suggestion on the BOD <> EOD logic. Could you offer and example? Thanks.
     
  5. telozo

    telozo

    There is no way around it. You need a finer time interval, like 5min or 1min, otherwise you will not be able to tell which was hit first, your stop loss or you profit target. Usually, strategies that only use one bar per day, will only check for the stop loss and use the end of day for exits. You get the idea.
     
  6. kut2k2

    kut2k2

    You asked "even longer-frame systems will occasionally hit a target or stop in the same day; so how does an OHLC programmer compensate for this?" I gave you an answer from a longer-frame trader POV. When I enter a trade, I enter a stoploss at the same time. If I get stopped out the same day as I entered, having two market position variables, beginning-of-day and end-of-day, allows me to account for that. My timescale is one-day. I can't use a single market position variable unless I want to always be far behind in following my signals, and I don't want that. The solution is two position variables, BOD and EOD. If, at the end of a day, BOD<>0 but EOD=0, then I know the trade got stopped out during the day. And if I have a new entry signal, I can act on it first thing tomorrow.
     
  7. I now understand what you are saying, but I am not havin trouble accounting for when I am in or out of a trade EOD, or even BOD. I am actually pondering the "age old" issue of how to handle stops and targets that theoretically both hit on the same daily bar. I believe as Michael B. states, that this is a situation where one is forced to either assume the worst; however this is terribly inaccurate. Bummer... Thanks for the input, any other input or ideas are welcome

     
  8. kut2k2

    kut2k2

    The logical solution is don't have a target. That's never made any sense to me. Why limit how much you can gain? If you insist in certain constraints, you can't reasonably complain when they limit what you can do.
     
  9. So he would only get out on a stop that moves up (if he were long)...like the low of the previous bar? The ol' Forest Gump....


     
  10. kut2k2

    kut2k2

    I don't know anything about any "Forrest Gump".

    Either use a stop or a reversal signal to get out. At least then he doesn't wonder if he got stopped or hit some "target". I don't know why he can't just check his equity to see if it went up or down.
     
    #10     Jul 4, 2005