Topic: Wider Time Frame (WTF) Indicators

Hello, please find Wider Time Frame (WTF) indicators zip pack attached. This series fixes bugs found in the Higher Time Frame (HTF) indicators. For more info, check this thread:
http://forexsb.com/forum/topic/2145/htf … ta-series/

Most of these are the same as the Beta 2 set, just with a new name. If you have the Beta 2 set, feel free to replace with this set.

This pack includes:
WTF Moving Average
WTF Parabolic SAR

WTF Accelerator Oscillator
WTF ADX
WTF Aroon Histogram
WTF Detrended Oscillator
WTF Laguerre
WTF Linear Regression Slope
WTF Moving Average Slope
WTF Moving Averages Crossover
WTF On Balance Volume
WTF Regression Squared
WTF Stochastics

Please advise if you find bugs, I'll try to fix them. If you have a request, please post, I'll see if I can modify the indicator to the WTF for you.

Thanks

>>EDIT (23 Aug 2011) -- updated attachment to v2: fix bug that "Draw Only, No Entry or Exit Signals" blocks all exits for indicators drawn on price chart.

>> EDIT (9 Nov 2011) -- include WTF alt ichi, WTF tripleemashasgnl; fixed a bug in WTF Moving Average

>> EDIT (27 Dec 2011) -- removing v3 pack because has a bug. Will fix and post v4 when forum attachments working again.

>> EDIT (2 Feb 2012) -- adding v4 pack, fixes performance bug and Stochastics bug of one line higher than another

Post's attachments

WTF v4 pack.zip 90.45 kb, 554 downloads since 2012-02-12 

You don't have the permssions to download the attachments of this post.

Re: Wider Time Frame (WTF) Indicators

I have found a strange occurrence using the WTF Moving Averages Crossover. I generated a strategy which had this indicator included but the indicator was set to "Draw only, no entry or exit signals" It produces a nice smooth equity curve with ending equity of $61,814. See below:-

http://img718.imageshack.us/img718/320/snap20110823130317002.png

However, if I just delete the WTF indicator because it doesn't do anything except draw, then the result is less, only $49,838. :-

http://img40.imageshack.us/img40/9818/snap20110823130226001.png

Why should it be different if it doesn't do anything?

Re: Wider Time Frame (WTF) Indicators

When you add or remove an indicator, FSB calculates how many bars this indicator needs in order to give its first value. This param is called FirstBar for the indicator.
After that, FSB takes the maximal one and set it as FirstBar for the strategy.

The backtester starts calculating from that FirstBar forward.

In your case, when you removed "WTF Moving Averages Crossover", you changed FirstBar for the strategy.

You can see what is the FirstBar from the chart or from journal. Probably WTF Moving Averages Crossover needed more bars and when you removed it, FSB calculated more bars for the second strategy. You can see this on Account Stats - Tested Bars vs Number of Bars from the market strategy.

Compare balances of both strategies starting from the higher FirstBar.

Re: Wider Time Frame (WTF) Indicators

The number of tested bars is the same in both cases. I spent a little more time looking at it and I think the problem is that when the WTF is added FSB doesn't close the position at the end of the week, even though it doesn't do anything. You can see this in the journal. If you add any WTF indicator and set it to "Draw only, no entry or exit signals" it does the same thing. The result is also contrary to the way I thought it might work as in my experience holding the position over the weekend nearly always results in me losing. (If you right click on the image and left click view image you can see a full screen picture)

Re: Wider Time Frame (WTF) Indicators

You are write. When "WTF Moving Averages Crossover" is in a Closing Logic slot with logic rule "Draw only, no entry or exit signals", it doesn't allow FSB to close position since there is no component that allows the closing.

When there is an indicator in a Closing Logic slot, FSB search for permission to close.  But this indicator doesn't give one:

This

case "Draw only, no entry or exit signals":
    Component[2].CompName = "Visual Only";
    Component[2].DataType = IndComponentType.NotDefined;
    Component[3].CompName = "Visual Only";
    Component[3].DataType = IndComponentType.NotDefined;
    break;

must be changed to something like:

case "Draw only, no entry or exit signals":
    for (int bar = iFirstBar; bar < Bars; bar++) {
        Component[2].Value[bar] = 1;
        Component[3].Value[bar] = 1;
    }
    break;

But this will not work properly if there is another closing logic indicator.

Re: Wider Time Frame (WTF) Indicators

It might be easier to remove "Draw only, no entry or exit signals" from the WTF indicators rather than trying to modify FSB to cover all eventualities.

Re: Wider Time Frame (WTF) Indicators

It's not a bad feature after all, maybe we can meet in the middle and leave it as a condition only in OpenFilter and CloseFilter, then it won't do no harm.

Re: Wider Time Frame (WTF) Indicators

Popov wrote:

You are write. When "WTF Moving Averages Crossover" is in a Closing Logic slot with logic rule "Draw only, no entry or exit signals", it doesn't allow FSB to close position since there is no component that allows the closing.

When there is an indicator in a Closing Logic slot, FSB search for permission to close.  But this indicator doesn't give one:

This

case "Draw only, no entry or exit signals":
    Component[2].CompName = "Visual Only";
    Component[2].DataType = IndComponentType.NotDefined;
    Component[3].CompName = "Visual Only";
    Component[3].DataType = IndComponentType.NotDefined;
    break;

must be changed to something like:

case "Draw only, no entry or exit signals":
    for (int bar = iFirstBar; bar < Bars; bar++) {
        Component[2].Value[bar] = 1;
        Component[3].Value[bar] = 1;
    }
    break;

But this will not work properly if there is another closing logic indicator.


Oh no, I didn't know that.   yikes
The point of of "Draw Only": sometimes I want to toggle the indicator to see it's effect. This is a short cut from removing the indicator to check, because if not I have to remember what parameters I had before removing it, and click a few more times on the mouse to re-enter them.

But apparently, this is not the case; when set to "Draw only" they still affect the exit. I'll try to find a way to make the indicator neutral when that is selected. Also, I'll reduce some of the line color options. That was in case people had screenshots, they could choose a different color from other indicators so I could see what was going on. However, I think the extra options may impact performance in the Generator.

If you want to remove the "Draw only" option and don't want to wait for next version, you can modify your copy. At the top, remove "Draw only, no entry or exit signals", or replace this:

            // The ComboBox parameters
            IndParam.ListParam[0].Caption  = "Logic";
            IndParam.ListParam[0].ItemList = new string[]
            {
                "The Fast MA crosses the Slow MA upward",
                "The Fast MA crosses the Slow MA downward",
                "The Fast MA is higher than the Slow MA",
                "The Fast MA is lower than the Slow MA",
        "Draw only, no entry or exit signals"
            };

with this:

            // The ComboBox parameters
            IndParam.ListParam[0].Caption  = "Logic";
            IndParam.ListParam[0].ItemList = new string[]
            {
                "The Fast MA crosses the Slow MA upward",
                "The Fast MA crosses the Slow MA downward",
                "The Fast MA is higher than the Slow MA",
                "The Fast MA is lower than the Slow MA"
            };

Note the last comma is removed too. This can be done in Notepad or any text editor, and recommend making a copy of the original in case it does not go smoothly.

Thanks for pointing out this issue, I missed it in my testing.   big_smile

Re: Wider Time Frame (WTF) Indicators

Now I see it in FSB Backtester.AnalyseExit, it just won't work.

Ok, maybe this will work -- "Draw Only" only available for OpenFilter (Open with Bar Closing). It does not affect entry. And only on the indicators drawn over the price chart (Moving Avg, MA Crossover, and Parabolic SAR).

Thank you SpiderMan for the bug report; I've replaced the attachment on the first post with the v2 pack, they should not have this problem.

Re: Wider Time Frame (WTF) Indicators

Hi. At first big thanks for WTF indicators.
I believe there is a bug in "WTF Moving Average (beta2)", try to set 1 day, period 1.
Shouldn`t it start to draw later, when it aquires enough of data to actually draw it self (I used 15 min bars) ? Currently it seems to me, that it`s "redrawing".

Re: Wider Time Frame (WTF) Indicators

Hi acerguest,
Please use the latest WTF MA in the v2 pack, I think it's the same, but this way we can be sure we are all using the same version, you will see the "(v2)" in the list of indicators to add to the strategy.

I think you mean at the right side of the chart, at the last bar. You are correct, that last WTF indicator value over the most recent bars will go up and down, based on the last bar. It is impossible for the WTF indicator to know what the last bar will be.

But, to make the WTFs consistent, the last indicator value that repaints is not used for any signals. All WTFs have "Force Previous Value" checked. It will use the previous WTF indicator value that has finished; once the WTF period is finished, they should not redraw, and the indicator only uses finished WTF values for signals.

Ex: data = 15 minute, WTF = 1 day, MA period = 1, you are looking at your chart on Aug 10, 10:30 am:
you should see the last WTF MA value = bar closing at Aug 10, 10:30 am. But the value used for signals is the value that is drawn from Aug 9, 00:00 am to Aug 9, 23:45 pm.

This thread has more info on expected behavior and screenshots:
http://forexsb.com/forum/topic/2145/htf … ta-series/

But if you find this is not the case, if it uses the value from the latest, unfinished WTF period, that would be a bug, and please advise, that would be important to take a look at and fix.

thanks
krog

12 (edited by acerguest 2011-09-09 09:53:08)

Re: Wider Time Frame (WTF) Indicators

Hi Krog, thanks for answering.
You say that`s the lastBar is not used to any decisions, I guess it`s not true.
Just made a perfect strategy with it, that is predicting future smile
Of course, when put on FST, it clears your account in no time.
Maybe it just need`s to be shifted to be correct.

Loot at strategy:

Forex Strategy Builder v2.60.0.0
Strategy name: simple_ma_WTF
Exported on: 2011-09-09 08:26:32

Description
   None.

Market: EURUSD 1 Minute
Spread in pips: 20
Swap Long in pips: 2
Swap Short in pips: -2
Commission per lot at opening and closing in pips: 0
Slippage in pips: 3

Use account % for margin round to whole lots
Maximum open lots: 1
Entry lots: 5% of the account for margin
Adding lots: 1% of the account for margin
Reducing lots: 1% of the account for margin

Intrabar scanning: Not accomplished
Interpolation method: Pessimistic scenario
Ambiguous bars: 0
Tested bars: 19910
Balance: 7413 pips (10413,32 USD)
Minimum account: 0 pips (3000,00 USD)
Maximum drawdown: 51 pips (50,96 USD)
Time in position: 100 %

A same direction signal - Does nothing
An opposite direction signal - Reverses the position
Permanent Stop Loss - None
Permanent Take Profit - None

[Opening Point of the Position]
Previous Bar Closing
     Enter the market at the previous Bar Closing
     Base price  -  Previous Bar Closing

[Opening Logic Condition]
Moving Average (WTF v2)
     [ A ]   The position opens below the Moving Average
     Smoothing method  -  Simple
     Base price  -  Close
     Line Color  -  Blue
     Wider Time Frame Reference  -  30 Minutes
     Period  -  1
     Shift  -  0

[Opening Logic Condition]
Moving Average
     [ A ]   The Moving Average rises
     Smoothing method  -  Simple
     Base price  -  Close
     Period  -  14
     Shift  -  0
     Use previous bar value  -  Yes

[Closing Point of the Position]
Close and Reverse
     Close all positions and open a new one in the opposite direction

Re: Wider Time Frame (WTF) Indicators

Wow, look at that equity curve go !!

But, if it looks too good to be true, it probably is.

Thank you acerguest for pointing this out, it looks like a bug. Very good catch, this is awesome. I'll try to fix it.

Re: Wider Time Frame (WTF) Indicators

Hi acerguest,
Good news -- I think I fixed it
Bad news -- the equity curve goes straight down instead of up
problem was in "The position opens above the Moving Average" and "The position opens below the Moving Average". Good idea on the suggestion to shift the MA over by one, seems to fix the problem. Unfortunately, different from every other indicator because the MA values are actually shifted to the right by one, but is only way to fix.

Please try it out, advise if it works as expected or if more unusual behavior is found.

thanks
krog

Post's attachments

WTF Moving Average_v3bugfix.cs 29.56 kb, 135 downloads since 2011-09-10 

You don't have the permssions to download the attachments of this post.

15 (edited by krog 2011-09-12 23:19:26)

Re: Wider Time Frame (WTF) Indicators

Hi Zenoni,
please find Parabolic WTF attached with CloseFilter option, so you should be able to use it with other Closing filters.

I've only tested it for sanity checks. Please advise if it behaves well or not, if it's ok I'll update to version 3.

thanks
krog

EDIT > removing attachment, don't want beta version to spread too far, may not work properly.

Re: Wider Time Frame (WTF) Indicators

Hi krog, sorry but I`ve been busy lately. I will check it. Thanks for your work!

Re: Wider Time Frame (WTF) Indicators

corrado wrote:

Can this be converted to WTF?

Hi corrado,
I've got it and am working on it now. I should have something ready for testing within a couple of days.
thanks
krog

Re: Wider Time Frame (WTF) Indicators

corrado wrote:

Can this be converted to WTF?

Hi corrado,
try this version, it's got the WTF conversion in it. Please advise if there are any mismatches, crashes, or unexpected behavior. I've only tested very basic smoke, its values seem to match going from 5 min to 1 hour data.
thanks
krog

Post's attachments

WTF alt ichi.cs 42.83 kb, 96 downloads since 2011-10-17 

You don't have the permssions to download the attachments of this post.

Re: Wider Time Frame (WTF) Indicators

Hah, you guys are just all geniuses.  I was never much for computer-code language.

Re: Wider Time Frame (WTF) Indicators

Source for triple emasha. Thanks!

Re: Wider Time Frame (WTF) Indicators

Try this version attached. It seems to match up (smoke on 5 min - 1 hour). I think it matches better if WTF used with Bar Opening instead of Bar Closing, but not sure if this will work with FST. It would be like, The bar opens, gets a signal, then FST has to figure out how to enter at the opening of the bar -- won't work, can't back in time. Have not tested if this causes errors or not.

Second issue: this indicator gives a signal. Should that signal exist for the entire WTF period (eg, over 12 bars for WTF 1 Hour on 5 minute) or should it exist only on the first lower time frame bar? The case I found, in the screenshot:
1 hour data (top) -- trade only entered once in the hour
WTF 1 hour on 5 minute (bottom) -- trade entered twice - at top of hour, and at 12:30 because of WTF expansion.

http://s2.postimage.org/2abaro5pg/WTFsignal_Over_Several_Bars.jpg

How does MT4 handle this? Ideas, comments welcome, thanks.

Post's attachments

WTF tripleemashasgnl.cs 22.87 kb, 108 downloads since 2011-10-19 

You don't have the permssions to download the attachments of this post.

Re: Wider Time Frame (WTF) Indicators

Thanks Krog!

At the moment I think signal should exist for the entire WTF period, but testing will obviously sort this out. If something comes up, I'll let you know. Thank you again!

Re: Wider Time Frame (WTF) Indicators

An error occurred with Moving Average (WTF v2) while I was running strategy generator. The error report was:-

---------------------------------------------------------------
Indicator Calculation Error
---------------------------------------------------------------

Error: Index was outside the bounds of the array.

Slot type: Close
Indicator: Moving Average (WTF v2)*(Simple, Weighted,2,0)

Please report this error to the author of the indicator!
You may remove this indicator from the Custom Indicators folder.

-----------------------------------------------------------------

Re: Wider Time Frame (WTF) Indicators

hi krog,

got a nice mq4 already translated by footon, but still looking for the mtf , i mean WTF:
http://forexsb.com/forum/topic/2664/rep … -request/
http://forexsb.com/forum/misc.php?actio … ownload=1 (repulse.cs)
http://forexsb.com/forum/misc.php?actio … download=1 (repulse1.1.mq4)
http://forexsb.com/forum/misc.php?actio … ownload=1 (mtf-repulse1.1.mq4)

this mtf indicator is a pearl, hopes you can make it a WTF.
Thanks in advance.

Re: Wider Time Frame (WTF) Indicators

Please write MTF RSI indi as i can comprise two different value of 6 in h1 and 2 in h1 cross and higher and lower of each other!