Page 1 of 1

tracking intraday sequences (time stamps) on daily bars

Posted: Mon May 23, 2011 11:44 am
by ACM10022082
Hi Tim,

We have a system that works on daily bars issues same day target and stop loss orders after entered into a position, this has been coded in EntryOrderFilled logic. We identified system might get stopped out at end of day but in reality it will not be hitting Target or Stop Loss, this is happening due to lack of intraday sequences information. Please suggest:

a) Is there any possibility in trading blox to fix this issue using daily bars only ?
b) If (a) is not possible please give details of how to fix this issue using both data series of daily bars and intraday bars.


Thanks,
ACM

Posted: Mon May 23, 2011 12:55 pm
by sluggo
I guess you could write out Blox scripting code to handle every conceivable configuration of Open (O), High (H), Low (L), and Close (C) -- making whichever assumptions you wish about the meandering pathway of intraday prices.

The first four bar configurations in your comprehensive catalog, might be the ones shown as A, B, C, D in the attached figure. You may decide that
  • Bar type "A" was probably created by intraday price path #1.

    Bar type "B" was probably created by intraday price path #2.

    Bar type "C" was probably created by intraday price path #1.

    Bar type "D" was probably created by intraday price path #1.
Now it's just a simple matter of filling out your catalog of bar-types, then for each bar-type, choosing a price path you want to assume.

Don't forget to include tall bars (bars where (H minus L) > 20 ticks) and short bars (bars where (H minus L) < 5 ticks) and limit-locked bars and no-movement-whatsoever bars and enormous-gap-from-yesterday bars, in your catalog. You might want to glance at one or two books on candlestick patterns, for other possible ideas.

Posted: Mon May 23, 2011 1:32 pm
by ACM10022082
Hi Sluggo,

Problem here is unable to trace out what actually happened intra-day using just daily bars. Using just daily bar(A) OHLC, we cannot choose #1 vs #2 unless we need additional information of intraday price pattern.

If we pick #1 (trade entered at middle of day but still using b4 actual fill information it might be get stopped out), but in reality #1 could not stopped out as price has not traversed through Stop or Target price after entered into a position.

Please do let me know if misunderstood your explanation.

Thanks,
ACM.

sluggo wrote:I guess you could write out Blox scripting code to handle every conceivable configuration of Open (O), High (H), Low (L), and Close (C) -- making whichever assumptions you wish about the meandering pathway of intraday prices.

The first four bar configurations in your comprehensive catalog, might be the ones shown as A, B, C, D in the attached figure. You may decide that
  • Bar type "A" was probably created by intraday price path #1.

    Bar type "B" was probably created by intraday price path #2.

    Bar type "C" was probably created by intraday price path #1.

    Bar type "D" was probably created by intraday price path #1.
Now it's just a simple matter of filling out your catalog of bar-types, then for each bar-type, choosing a price path you want to assume.

Posted: Mon May 23, 2011 3:10 pm
by RedRock
You would of course, use intraday timeframe data in order to have that information.

I would like a feature request along the lines of clairvoyant parameters. Something like, "if next trade is winner, then do so-n-so"... An extension of these new options may be an intra-bar knowledge of events. Hmmm imagine the possibilities...

Posted: Mon May 23, 2011 3:18 pm
by Qsquare
Interesting topic.

I've been wondering if any provider has such a sequential ordering attribute embedded within (it would only take one column). It looks to be the only way to capture such information reliably is to have the higher frequency sampled data. For a long time, I just scrambled the order of high and low, since I assumed they were 50/50, but I've begun to remodel those assumptions. If anyone has any pointers to studies on stylized facts covering this, I'd be glad to see!

thanks.

Posted: Mon May 23, 2011 4:00 pm
by rabidric
don't underestimate the market's ability to touch at/near the high and low multiple times. It happens more often than you would think.

e.g. a 0.5-1 ATR stop if coupled with a re-entry might get whipsawed 2,3 or more times.

this is especially the case on days with major figures where the market can't decide(a turning point for trend maybe?), or where there are multiple figures back to back that conflict.

At a guess i'd say that this kind of behaviour is more prevalent the longer the trading session...(e.g. currencies, and most european markets trade europe and us sessions.)

Posted: Mon May 23, 2011 4:42 pm
by jankiraly
If the ONLY information you have is the daily Open, High, Low, Close then the Shortest Path Heuristic is one of your (very few) options:
  • Choose the piecewise linear price trajectory of shortest total length.

You can work out the arithmetic yourself; there are only two cases to consider. The conclusions are:
  • If (Open > Close) then the shortest path is Open -> High -> Low -> Close. Assume instrument made its High before making its Low
  • If (Open < Close) then the shortest path is Open -> Low -> High -> Close. Assume instrument made its Low before making its High
"The race is not always to the swift nor the battle to the strong, but that's the way to bet" - Damon Runyon

Posted: Tue May 24, 2011 8:30 am
by rabidric
given the perversity of markets and their tendency to take an indirect route from A to B, I would start with assuming the market will take the LONGEST route! :wink:

i.e. O>C then assume O->L->H->C !!!!

of course this isn't the case with trend days etc. in the end it is probably a 60/40 - 50/50 chance on any given day that your shortest route assumption would hold!

which takes Qsquare back to erm, square one....(sorry couldn't resist 8) )

Interesting...

Posted: Tue May 24, 2011 5:54 pm
by Anthony Marsland
Could BLOX code/structure identify the necessary symbols from daily data to trade next day (maybe at Rank Block) and then pull the 1,5,15, etc mins data (maybe at Entry Block, before trading day script) just for those instruments, for just that day and trade the entry and exit code on this finer granularity data?

If so this logic will solve the issue without a massive data/memory overhead...

This capability would help me greatly too. Any thoughts Tim?

Posted: Tue May 24, 2011 6:01 pm
by Tim Arnold
Some customers trade using the intraday data, but base the signals on daily data. Likewise you could trade daily based on weekly data.

Higher Resolution Data

Posted: Wed May 25, 2011 4:26 am
by Anthony Marsland
Hi Tim,

Just to be clear... When you say other clients use higher resolution data to create lower resolution bars (minute data creating daily bars) I guess you mean they load all the high resolution data into memory for all the instruments to be tested at before simulation stage. They then have BLOX create a lower resolution bars for use in signal creation..?

Conceptually, with the tools available in BLOX as it stands, could I code a data call of minute data having selected a set of instruments who need this higher resolution from a daily bar ranking?

Posted: Wed May 25, 2011 12:08 pm
by Tim Arnold
You could use intraday data alone and have Trading Blox create the daily, weekly, and monthly bars which you could then use to create indicators and signals.

Or you could load two separate data files as two separate instruments appending the daily with a -D. Then use LoadSymbol to load up the daily bar instrument and its corresponding indicators like this:

Code: Select all

dailyInstrument.LoadSymbol( instrument.symbol + "-D" )
IF dailyInstrument.myMovingAverage > 100 THEN
 Broker.EnterLongOnStop( entryBreakoutHigh )
ENDIF
Only the intraday symbol would be in the portfolio and traded, but the daily bar version of the instrument could be loaded as needed.

The reverse of example 2?

Posted: Wed May 25, 2011 12:27 pm
by Anthony Marsland
Could I load the daily bars from one file, creating indicators, trade set-ups etc and then load the separate intra day file for entry and exit as needed?

So in the case of my reversion to mean research:

Psuedo code:

if c < lowest(c,10) on Daily Data then
load intraday data for instrument
broker.enterlongonlimit(1 ATR lower than close, 2 ATR Stop)
endif

Posted: Thu May 26, 2011 1:13 pm
by Qsquare
FWIW, I ran exactly about a years worth of QQQ hourly data and noted the order of daily LH. Out of 240 observations, the results were an astounding
50.4% L,H and 49.5% H,L ordering... talk about efficient.

Nor did the autocorrelation have any significance.
> runs.test(pf)

Runs Test

data: pf
Standard Normal = 1.683, p-value = 0.09237
alternative hypothesis: two.sided

I suppose scrambling order assumption wasn't too bad after all.

Posted: Fri Jun 10, 2011 5:43 am
by Angelo
jankiraly wrote:If the ONLY information you have is the daily Open, High, Low, Close then the Shortest Path Heuristic is one of your (very few) options:
  • Choose the piecewise linear price trajectory of shortest total length.

You can work out the arithmetic yourself; there are only two cases to consider. The conclusions are:
  • If (Open > Close) then the shortest path is Open -> High -> Low -> Close. Assume instrument made its High before making its Low
  • If (Open < Close) then the shortest path is Open -> Low -> High -> Close. Assume instrument made its Low before making its High

Hi ACM,

if these assumptions are enough for your needs, you could have a look a this thread, located in the User's support Forum:

viewtopic.php?t=3487&highlight=

Hope this helps.