| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Currency strength (like Hanover) https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=503 |
Page 5 of 11 |
| Author: | mobthehop [ Sun May 06, 2012 2:50 am ] |
| Post subject: | Re: Currency strength (like Hanover) |
Hi Gary, frankly this discussion is way over my head but maybe are able to glean some insight if you look at the internals of the XMeter EA which is, to my (limited) knowledge, the only existing and semi-functioning EA with a currency strength implementation. Here: http://www.stevehopwoodforex.com/phpBB3 ... ?f=20&t=48 or original: http://www.forex-tsd.com/suggestions-tr ... meter.html I am following this thread with great interest as I am looking forward to have such a component as plug-in to a number of EAs along lines of Hannover module by Steve.... Actually I did ask Steve around end of last year whether he would be interested to lift the XMeter code and implement it in the EA shell but other projects took priority - am not complaining..... Keep up the good work! |
|
| Author: | squalou [ Sun May 06, 2012 5:11 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
weird Empty4 behaviour, i agree ...!?! -16777216 translates to 0xFFFFFFFFFF000000, which is NOT -1(decimal) encoded on a 64-bits value... Perhaps because the "color" type is truncated or shifted somehow internally (possibly encoded on only 40 bits, then stored into 64-bits data storage...) Let's keep it simple, who would display a Pink line anyway ? correct
absolutely; you have to "manually" shift ANY non-buffer array that needs to keep up with the buffers.
actually you CAN test it: load any EA in the visual backtester, Pause it, load the indi on the chart, then Run; it will display ALL the currencies, although an EA only has access to the selected symbol, because the indicator runs independently from the history data feed provided to the EA -- one more strange and misleading Empty4 behaviour...
Well, an EA does not even have the "buffers" available. So an EA would have to calc everything manually by itself, thru the same arrays as in the indi. However, you can save several arrays by implementing your own EMA "incremental" function, because EMA only needs to know the "previous bar" EMA and the current data value to calc the current EMA. You only need "push" the current EMA into the "previous_EMA" value at each new bar-opening, without the need to handle of whole lot of arrays. init() would make the first EMA calculations. Something like this: Code: Select all It would be a bunch of lines of code... Sq |
|
| Author: | squalou [ Sun May 06, 2012 5:17 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
The problem with xMeter is that it calculates the "strength" based on the daily high/low levels; which makes it "rince" at the 00:00 bell every night, giving over-sensitive results during the first hours of the day. (it is something like a "distorted" stochastic, but with a "fixed anchor" at 00:00) What we want is a sliding constant-time window. There is no escape from complex coding... sq |
|
| Author: | garyfritz [ Sun May 06, 2012 5:53 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
That's exactly what I have in mind. I'm guessing it will be about 12-15 lines per currency, so something like 100-120 lines total, but it will be quick and efficient. I should be able to do it with no arrays at all. I'll just have two functions, one to initialize it (specify EMA lengths, etc), and one to return the 8 current index values. That second function will detect whether the bar has just closed, and if so, it will save the previous EMA value to use in the next bar. Then it will return the "value so far in this bar" as of that tick. I would have had it written by now, but Steve dangled a "prove Martingales don't work" challenge in front of my nose, and that ate up my morning. |
|
| Author: | SteveHopwood [ Sun May 06, 2012 8:27 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
Yep. Sorry. Mea culpa. Look on the bright side. Gary and I are working on saving the next bunch of M loonies from themselves. Just imagine the amount of money Gary is going to save M punters from losing, assuming they have the brains to take on board what he is writing. Big assumption, but.... That is another story and no need to comment further. Just confirming the cause of G's temporary distraction. |
|
| Author: | squalou [ Sun May 06, 2012 9:09 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
no need to justify anything, i am here to help when i can, and it can also take quite a while before i post myself... |
|
| Author: | mobthehop [ Tue May 08, 2012 4:23 am ] |
| Post subject: | Re: Currency strength (like Hanover) |
SQ, thanks for your clarification, I did not know that.... The xmeter indy is a vital part of trading Pitbull on H1 for me and works well as trade duration is normally measured in hours rather than days for me. However it is quite useless in the H4 strategy I use.... Question: Would you expect the xmeter to give better results for higher tf's (eg H4) if it were based on previous week high / low? Just curious. Cheers Mop |
|
| Author: | squalou [ Tue May 08, 2012 2:33 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
I had a look at the !xMeter_v2.1.2.mq4 EA code, and it differs from the !xMeter v 1.3.mq4 INDICATOR that i have. The Indicator (1.3) is using the 00:00 bell anchor, and is subject to the over-sensitivity issue i mensionned. However, the EA uses a constant-time period to calculate a stochastic-like value. It is controlled by the xMeterLookBackPer EA input, which is set to 84 hours as default (last 3.5 days). This would give better results i guess, at least more stable/less time-sensitive. I don't know if there is an Indicator version that uses the same algo as the EA, though. The one posted by tex in the Pitbul thread uses a similar algo as the one i have(1.3), so it is different from the xMeter EA. SQ |
|
| Author: | lonelytrader [ Fri May 11, 2012 3:46 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
I have been using the !xmeter_v2_2_7 and its pretty good, in last 30 days it has generated about 1500 pips... with only 8% open DD i dont know why this robot was dropped from further development, but it has legs. If anyone is willing to improve the code, i will be more then happy to give all my personal experience with this robot both good and weaknesses. |
|
| Author: | garyfritz [ Sat May 12, 2012 9:05 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
OK, I'm finally getting back to this indicator. Sorry for the long delay. Sq, thanks for the tip of using the visual backtester!! That's very helpful for debugging the indicator. I've cleaned up a number of things, and I added the bar-shift code you recommended. When Time[0] != LastTime, I shift all the non-buffer arrays one bar into the past, e.g. AUDUSD[i+1] = AUDUSD. Unfortunately I have an error in here somewhere and I can't find it. If you step through the chart in the visual backtester, the indicator lines go fairly flat, and there is a "bend" in the newest 2 bars. Then if you redisplay the indicator, the lines replot in their proper shapes: So the lines that have the highest values bend up, and the lines that have the lowest values bend down. Obviously the bar-0 value is not being shifted out properly into history but I'm not sure why. Sq, can you spot my goof? You know the indicator behavior a lot better than I do, so maybe you can see what I'm doing wrong. Some hints / behaviors: First there's the "not shifting values into history properly" problem. I'm not sure where that's coming from. I'm shifting the non-buffer arrays when Time[0] != LastTime, which I think is the right thing to do. The "bend" in the last 2 bars indicates the bar 0 value is getting changed when it gets shifted !? Maybe the MA is doing that? And even the bar 0 value doesn't match the value that gets plotted if you replot the history. I think the history is right -- it's the realtime behavior that's killing me. As usual. Then there's a less-serious but annoying initialization problem connected to the iMAOnArray() calls. The resulting values start out at a bogus level, and converge to the proper level as the MA includes more of my calculated index values. * If the MA lengths (SmoothLen, SpeedLen, AccelLen) are all 0, the raw index values display fine, all the way back to the first bar. * If I turn on smoothing e.g. SmoothLen = 50, the smoothed values start out at 0 and gradually work their way up to the proper levels. * If I turn on speed e.g. SpeedLen = 50, the relative values start out at 24.5 (!?!?) and gradually work their way down to the proper levels. * That's with MAmethod = MODE_EMA. If I set it to SMA, the relative values start out at 49.0 -- double the EMA starting value. Hm. So the raw index values are OK, but the values from iMAOnArray() are starting out at a bogus value. Am I calling iMAOnArray() wrong? I tried not filling the buffers until the values had settled. That works OK for MODE_SMA but not as well for MODE_EMA, which takes longer to settle. But I'd like to understand what's *causing* it. Do I need to start filling the XXXindex array, and then don't try to do iMAOnArray() on it until I've got N values for the MA to work on? And then maybe limit the iMAOnArray() to only those cells, with the "total" argument? I tried that, and it didn't work at all... maybe I don't understand what the "total" argument does. Thanks sq!! 5/19/12 EDIT: uploaded slightly improved version of the indicator |
|
| All times are UTC | Page 5 of 11 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|