Automated trade execution on the Ghost Bar OR scanning multiple timeframes simultaneously?
Author: romaioi
Creation Date: 9/22/2010 12:24 AM
profile picture

romaioi

#1
For automated trading using daily charts, is it possible in WLD5/6 to send trade orders on the ghost bar (rather than on the following trading bar - BuyAtMarket)? Also, do indicators update as the ghost bar value dynamically updates?

Alternatively, is it possible (and is there example code) to simultaneously scan daily and intraday timeframes for automated trading? – this is one way I see of get around the.

Reason for question: Some of my trading strategies require trade execution on the day the signal occurs (which I currently execute manually). e.g the moment that one price crosses the level of a previous peak. This would be the equivalent of executing the trade on the ghost bar (- I currently have WLD4 – indicators no not update on while the ghost bar)
profile picture

Eugene

#2
Hi,

Indicators do not update on the ghost bar (partial bar in WL6 terminology) in WL6 either, but it has the potential to do so and from what I heard will be enabled in a future release.

Sending trade orders on the ghost bar is planned for 6.1, making possible to use streaming strategies that access Open[bar+1] w/o any workarounds.

What do you mean scanning daily/intraday timeframes? Multi-time frame feature is not removed, it's possible to access a Daily chart from a strategy running on intraday data (and even the other way round - a trick not possible in WL4).
profile picture

romaioi

#3
Hi Eugene,

Thanks for the response.

What I mean is having one chart script that will scan over both timeframes at the same time, providing alerts for both. This would enable a workaround for the example I gave - taking the trade on the next bar on a 30 minute timeframe would be better than the next day (but the daily timeframe would be used to indicate that the criteria is close to being met). The alternative would be to have two machines (or instances of WL) running at the same time, I guess.

Is there an ETA on when 6.1 may be released?
profile picture

Eugene

#4
Fidelity doesn't provide ETAs, but based on the history of previous releases, it can be estimated to this winter.

I believe here's that something what you are looking for (just the time frame is different, but the principle applies):

Incorporating End-of-Day Data into a Monthly Strategy
profile picture

romaioi

#5
Thanks Eugene, It sounds like the theme I'm after.
profile picture

richard1000

#6
"Sending trade orders on the ghost bar is planned for 6.1, making possible to use streaming strategies that access Open[bar+1] w/o any workarounds."

So is this possible now with 6.2 using Fidelity streaming? I'm getting an index out of range error when I try to access Open[bar+1].
profile picture

Eugene

#7
A new (in 6.1) WealthScript method - GetSessionOpen - allows to get the current session's opening price and thereby execute (typically Daily) Strategies based on current day's open.
profile picture

Cone

#8
See the QuickRef for an example of how to use GetSessionOpen, and, keep in mind that the function caches the opening prices of all the symbols in the DataSet on the first call. If you're going to use the method, split up your DataSets to minimize the number of symbols in each to reduce delay from the first call.
profile picture

Eugene

#9
QUOTE:
keep in mind that the function caches the opening prices of all the symbols in the DataSet on the first call.

Please note that there is no global Wealth-Lab cache of the opening prices, so that cache is maintained individually by data providers supporting this feature. They do it in one of two ways:

1. As Robert said, Fidelity Static Provider requests the opening prices of all the symbols in the DataSet on the first call - and caches them. This is faster for multi-symbol backtests than #2.

2. Other (read: free) data providers without the luxury of returning all the opening prices in one call - like BBFree, Finam, Google, and QuoteMedia - cache the opening price requested by GetSessionOpen on demand (i.e. on a symbol by symbol basis).
profile picture

kbellare

#10
I have a similar situation where I need to evaluate indicators (such as TSF, KAMA that use the Median (High+Low)/2) - considering 2 approaches -

1) either evaluate at Partial Bars (Ghost Bars), if I can program such a feature in my strategy or if it's now available in the latest WL (I'm using WL-6.5) .. since it is not using Close, it need not wait for the full OHLC to be generated and can use the Partial High and Low
- Is the feature to evaluate the indicators using the Ghost bar High and Low now available? If not, can i somehow program it in my strategy

OR

2) evaluate at lower time intervals by building multiple time-frame intervals into the strategy i.e. Indicators are defined at Higher bar intervals (Daily/Hourly) but run the strategy at Lower bar intervals (e.g. Daily/Hourly or Hourly/10minute) and use the parameters (H,L) of the Lower bar intervals as the last input for the indicators.
- I saw the code for building in http://www.wealth-lab.com/Forum/Posts/Incorporating-End-of-Day-Data-into-a-Monthly-Strategy-30882, but challenge is my indicators are more complex - could you point me to the code of TSF and KAMA?
- Is there an easier way of having the indicator pick up the Lower Interval (H,L) parameters for the last bar?

I am seeing an advantage in doing this (vs waiting for Close) and am being careful about not peeking ahead.

Pl advise which option to use - Any sample code would help..

thanks
Kiran



thanks
Kiran
profile picture

Eugene

#11
QUOTE:
could you point me to the code of TSF and KAMA?

Like any built-in indicators from Fidelity, KAMA is closed source (although it should be quite easy to rebuild following Kaufman's formula available on the internet/books). Fortunately, TSF is open source:

Download project from the Wiki.

QUOTE:
If not, can i somehow program it in my strategy

No, you can't. It's important to understand how Strategies are executed to realize that no partial bar will help with this:

Is it necessary to have access to intra-bar tick data to daytrade with Wealth-Lab?

QUOTE:
OR

2) evaluate at lower time intervals

Yes, this is the way to go and you can:

1. Access a lower time frame from a higher bar scale using this trick:

Intraday / Multi-Time Frame | Accessing Intraday data from Daily (also applies to intraday/intraday)

2. Update an indicator on the higher bar scale using its data from the lower time frame:

Intraday / Multi-Time Frame | Mixing intraday and daily data > Updating a Daily indicator using Intraday values
profile picture

Eugene

#12
Offtopic discussion on troubleshooting custom strategy extracted into a new thread:

Troubleshooting TSF/KAMA based strategy
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).