1 (edited by krog 2011-06-14 03:12:16)

Topic: HTF fix thread: discussion, testing WTF beta series

I've got a couple of ideas, maybe they will work to fix the HTF indicators. This thread is for testing it and discussing how it should work. When it's consistent and reliable (ie, complaints and issues dwindle), the ready-to-use version will be posted on a new thread.
The first one I've got is for WTF Moving Average beta 1, attached. If you have time and would like to help, feel free to try it out and post any issues or unexpected behavior you find, and thanks in advance. If you like to work on the code, please feel free to do that too, I can explain my code if you have a question. We'll try this out, hopefully can get something that works, or conclude it's not going to work.

I've renamed them as WTF for Wider Time Frame so the series will be clearly different from HTF Higher Time Frame series. They are marked "beta" so people will know not to use these versions yet. If you have a favorite indicator, feel free to request and I'll post a beta. Hopefully we can get 3-4 WTFs for people to use to find the main bugs in the core WTF code, then can add to more indicators from there.

If you take screenshots with a bunch of indicators, there is a parameter so you can change the color of the line. Choosing a distinct color would help out a lot, it makes the screenshot clearer and reduces eyestrain/headaches/chart blindness   big_smile .


> * Please scroll to end of thread for latest version. I'll remove old versions as we go.  * <


original HTF thread:  http://forexsb.com/forum/topic/1372/new … ators-set/

edit 6/13/2011 -- removed WTF Moving Average beta - old version, please get from post #39

Re: HTF fix thread: discussion, testing WTF beta series

These are some key points of how the WTF series should work. These seemed to make the most sense to me, but I'm open to other ideas on how they should behave.

Expected:

1. The WTF signal should change as a multiple of the selected selected wider time frame.
Ex: choose WTF = "30 minutes" on a 1 minute series: you should see a new value at 1:00, 1:30, 2:00 etc every time, never at 1:10, 1:29, 1:45 etc.
(unless 1:00 to 1:09 is missing, then it will use 1:10).
Ex: choose WTF = "1 hour" on a 5 minute series: you should see a new value at 1:00, 2:00, 3:00 etc every time, never at 1:05, 1:30, 2:55 etc.
For Week, it's synced to Friday 00:00 (midnight); there's no way to figure out when your last 5 minute bar for the week is, so this is a compromise.
This should also solve in case you have lost a couple of bars of data, or going across weekend and holidays. I think it also solves matching FSB backtesting signals to sync with FST signals regardless of whenever you happen to log in, or whenever your data starts, so watch for if that does not happen.


2. Force always use previous WTF value.
Since there is no Bar Closing on the higher time frame, they should all be forced to use the previous or closed WTF value. This way, the WTF value can signal all the lower time frame bars that follow. I think this will prevent a lot of redrawing and FSB-FST mismatching problems.
Ex: Moving Average Open Slot: Enter the market at the Moving Average: the previous WTF value will be the entry point.
-- 5 Minute data, WTF = 1 hour: if your current bar is at 3:15, the entry price is the WTF MA value from 2:00 to 2:55, not the line you see from 3:00 to 3:55
http://s4.postimage.org/2ibfhvppg/MA_WTF_Open_Entry.jpg

Ex: Moving Average Open Filter: The Moving Average Rises: the previous 2 WTF values will be evaluated.
-- 5 Minute data, WTF = 1 hour: if your current bar is at 3:15, rising is based the WTF MA values 1:00 to 1:55 and 2:00 to 2:55, not the line you see from 3:00 to 3:55
http://s4.postimage.org/2ibh5f278/MA_WTF_Open_Filter_Rising.jpg


3. If the selected Wider Time Frame is larger than the Data Period, the indicator will not be added to the chart.
Ex: 4 hour data, WTF = 15 minutes: the indicator will not give any Enter or Exit signals. If you open the chart to view, you will not see the Moving Average (WTF Beta1) component or info.
It didn't make sense to me to allow a "Lower Time Frame" to the chart. Also, there was unfortunately no way to pop up a message to alert the user or blanking out the options from the drawdown without it interfering with Loading Custom Indicators and the Generator. Making it fail silently was the compromise.


4. "The bar opens above the indicator after opening below it" -- compares 2 lower time frame bars, not all the lower time frame bars in the wider time frame period.
Ex: 1 minute data, WTF = 1 hour:  60 bars make up the WTF period, and it uses any pair of 2 of them that are consecutive, like 2:36 and 2:37. 
I think the HTF series used the HTF price values against the HTF indicator. But then you'd have to wait for multiples HTF values, so if your HTF = 4 hours, means you'd have to 4, 8, or 12 hours.

Re: HTF fix thread: discussion, testing WTF beta series

Example Bugs -- these are some unexpected behaviors I've found, examples of the kind of things to look for:
- diagonal lines -- the MA should draw as a flat line, then move within one bar to next flat line. If you see a diagonal line longer than one bar, it's a bug
- the signal time gets out of sync
- the indicator drops sharply at the right end of the chart
- an open position passes through the Moving Average without being closed as expected
- Generator or Optimizer throws any kind of error
- FST and FSB trades totally mismatch

Re: HTF fix thread: discussion, testing WTF beta series

This is a great initiative because I believe that multi time frame startegies are more reliable than on one time frame. They are indicators that you cannot play with the parameters to extend the length for a calculation that would be similar to a result for a higher timeframe.

I'll follow this thead and do some tests of your modifications.

Re: HTF fix thread: discussion, testing WTF beta series

Thanks nico1969, that will help a lot. More users will cover more cases than I can think of. Keep an eye for mismatching values, or if entries and exits happen or not when you would expect them to.

One logic condition I am undecided how it should work: The bar opens below the Moving Average.

The way I have it in Beta 1: if the current lower time frame bar opens below the previous wider time frame MA value, it signals long. But this means all the lower time frame bars that follow could have different signals. I'm undecided if that is better, or if all the LTF bars in the following WTF period should have the same signal.
http://s2.postimage.org/1zz1ghqhw/MA_opens_Below_MA_WTF.jpg

I'm ok with the current behavior where it compares each current LTF bar individually against the previous WTF MA value, and they can have different long/short signals. If anyone thinks it should be the other way, feel free to discuss. If it were to match a true 1-hour chart, they would all be the same -- short.

Re: HTF fix thread: discussion, testing WTF beta series

Smoke Verification Passed: Matching WTF value against higher data set.

Method:
- EURUSD, 5 minute chart, add Moving Average WTF (Simple, Close, n=12), WTF = 1 hour
- EURUSD, 1 hour chart, add Moving Average (Simple, Close, n=12)

Results: 5 min MA WTF values for a given hour (eg, 2/25 1:00 - 1:55) match 1 hour MA values (eg, 2/25 1:00)

7 (edited by krog 2011-03-22 21:00:41)

Re: HTF fix thread: discussion, testing WTF beta series

Here is ADX WTF beta 1. This one is a separated chart.

> * 3/22 -- removed beta 1 -- please scroll to end to get latest beta pack * <

Re: HTF fix thread: discussion, testing WTF beta series

MA WTF: Acceptance Verification: Match FST and FSB entries

EU - MA WTF as Open slot
- FSB showed 2 entries not in FST
- edited FSB instrument to be 5 digits, cleared one issue
- 2nd FSB entry not in FST -- low exactly on MA Open price, assume slippage

GU - MA WTF as Open Filter
- FSB shows several consecutive entries, not in FST, but mostly match general time
- throw out results, strategy set to "Bar Closing" only, may be too fast to expect live trading order execution to keep up

Re: HTF fix thread: discussion, testing WTF beta series

MA WTF: Acceptance Verification: Match FST and FSB entries (2)

EU - MA WTF as Open slot (Enter the market at the Moving Average)
- FSB showed 1 entry not in FST
- passed opening price by 1.4 pips
- unknown why it was missed in FST

GU - MA WTF as Open Filter (The Moving Average rises)
- strategy with trades lasting several bars matches
- FSB -- can close and open a new trade in the same bar, but FST has to wait for next bar, explains difference

At this point, I am comfortable with FSB and FST matching trades with MA WTF as Open and OpenFilter. 2 cases out of 12-15 don't match. The mismatch could be due to slippage, the path of the price through the data bar, or some other factor beyond the indicator's control.

If anyone finds a large mismatch, or several mismatches, please post it. Thanks !!

Re: HTF fix thread: discussion, testing WTF beta series

MA WTF: Acceptance Verification: Match FST and FSB entries (3) - Exits

EU - MA WTF as Close slot (Exit the market at the Moving Average)
- no trades entered, have to redo

GU - MA WTF as Close Filter (The bar closes below the Moving Average)
- FSB and FST closes match

Re: HTF fix thread: discussion, testing WTF beta series

MA WTF: Acceptance Verification: Match FST and FSB entries (4) - Exits

EU - MA WTF as Close slot (Exit the market at the Moving Average)
- 5 out of 6 match
- 1 trade mismatch: FSB closes one bar earlier than FST
- FSB able to close position when high exactly equals exit price, FST does not
- exit prices do not match exactly, off by 0 < difference < 2.4 pips

Interpretation: missing exit by exact pip match and difference < 2.4 pips within range of slippage from broker. Acceptable.

At this point, I'm comfortable with MA WTF as a Close and CloseFilter.

If anyone finds issues that the indicator does not work consistently or reliably as a Close slot, please post and I'll look into it. Thanks !!

12 (edited by krog 2011-03-22 21:01:46)

Re: HTF fix thread: discussion, testing WTF beta series

Attached is a few more indicators to try out. WTF_beta1_pack includes:
WTF Accelerator Oscillator
WTF Detrended Oscillator
WTF Laguerre
WTF Linear Regression Slope
WTF On Balance Volume
WTF RegressionSquared

If you find unexpected behavior or mismatched trades, please post a note so I'll know to fix it. If anyone has a favorite indicator, let me know, I can make a WTF version for you.


> * 3/22 -- removed beta 1 -- please scroll to end to get latest beta pack * <

Re: HTF fix thread: discussion, testing WTF beta series

One issue:
For logic of Indicator Rises/Falls/Higher/Lower Than Level Line, the signal holds over the whole WTF period.

For logic like Crosses the Level Line Upward/Downward/Changes its Direction Upward/Downward, the signal only appears on the first lower time frame bar of the WTF period.

I tried a few things that did not work to make them similar. For now, I will keep them different as the above. If anyone feels strongly that they must be the same, please post and I'll try again to find a solution; if not, it is better to stick with the simpler copy-and-pasting which seems fairly consistent.

Re: HTF fix thread: discussion, testing WTF beta series

Great work, Krog! If it's not too much fuss, I'd love to use a WTF Stoch indi.

15 (edited by krog 2011-03-22 21:02:08)

Re: HTF fix thread: discussion, testing WTF beta series

No problem, it's just some copy and pasting. Attached is Stochastics WTF. Let me know if there are any problems, or something does not work as you would expect. It has the one issue noted in post "2011-03-05 17:59:09", let me know if that interferes with how you would expect or like the indicator to signal.


> * 3/22 -- removed beta 1 -- please scroll to end to get latest beta pack * <

Re: HTF fix thread: discussion, testing WTF beta series

krog wrote:

No problem, it's just some copy and pasting. Attached is Stochastics WTF. Let me know if there are any problems, or something does not work as you would expect. It has the one issue noted in post "2011-03-05 17:59:09", let me know if that interferes with how you would expect or like the indicator to signal.


Thank you very much! If I find something alarming, I'll go mental!  tongue

17 (edited by krog 2011-08-30 20:29:29)

Re: HTF fix thread: discussion, testing WTF beta series

Beta 2 pack is now ready.
- ADX                                         - Accelerator Oscillator
- Detrended Oscillator               - Laguerre
- Linear Regression Slope         - Moving Average Slope
- On Balance Volume                 -  Regression Squared
- Stochastics

Main thing changed is the for logic like "Crosses the Signal Line Upward" or "Changes Direction", all the LTF bars in the WTF period will give a signal (before it was only the first LTF bar).
Ex, LTF = 5 minutes, WTF = 1 hour -- now all 12 5-min bars for that hour will give a signal.

See attached screenshot for drawn out example.
http://s3.postimage.org/14dyjh7r8/Cross_Line_Upwards_Beta1vs_Beta2.jpg


If anybody has questions, comments, or requests, please feel free to post. Or if you find bugs/unexpected behavior, please advise.



EDIT >> removed outdated beta pack attachment, please see Sticky Thread for latest version, and don't use beta version anymore.

Re: HTF fix thread: discussion, testing WTF beta series

Oh no, one bug in Stochastics WTF beta 2 -- for the info display on the chart. Not significant, but I've caught it. If you don't want to wait for next batch and want to fix on your copy:
- go to line 507:  "WTF=" + IndParam.ListParam[1].Text + ")";   in the ToString() method
- change [1] to [4]:    "WTF=" + IndParam.ListParam[4].Text + ")";
- save file
- reload custom indicators

Re: HTF fix thread: discussion, testing WTF beta series

One bug for WTF ADX -- period = 1 results in Index Out of Bounds Error. I've fixed it.

Re: HTF fix thread: discussion, testing WTF beta series

yes, ADX indicator is not working properly

Re: HTF fix thread: discussion, testing WTF beta series

jaimegue wrote:

yes, ADX indicator is not working properly

Hi Jaimegue,
Do you have more information, or is it the "Index Out of Bounds Error" when period set to 1? If it's a different problem, please list instructions to get the error. Then, I can find it and fix it. Thanks a lot for noting issues, this helps a lot, I hope to make a series that works well for everyone.
thanks

Re: HTF fix thread: discussion, testing WTF beta series

Thanks for your work  big_smile
I am using the Accelerator Oscillator on a live test on a cent account for the week and the live trades and the trades in FSB are right on! Good Job. The strategy got hammered by the NFP release today but the trades match.

Re: HTF fix thread: discussion, testing WTF beta series

Hi Shr1k, thanks for taking the time to test it out and posting your findings. The confirmation is good news, as valuable as finding a bug. This helps me a lot, it gives me a better idea how close to "done" the fix is.

24 (edited by jaimegue 2011-04-04 15:12:05)

Re: HTF fix thread: discussion, testing WTF beta series

Hello Krog:

Error ADX (WTF beta2) is in the menu item "check the custom indicators" ERROR: indicator test failed for the ADX indicator. Error when calculating with a NumParams set to their minimal values. Index was outside the bounds of the array.

In the generator option ERROR: index was outside the bounds of the array
Slot type:Open filter.
Indicator: ADX(WTF beta 2)*(Weigted, Bar range, 1, 1Hour)

If the problems is fix, please upload the indicator.

Thanks, Jaime.

25 (edited by krog 2011-08-30 20:30:22)

Re: HTF fix thread: discussion, testing WTF beta series

Sorry about that -- I reposted the zip pack on the previous post. Please find ADX attached to this post. So far, with this one, I have not been able to reproduce the Index out of Bounds Error. Please advise if something is broken.

Thanks

EDIT >> removed beta version, please get latest pack from sticky thread.