| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Currency strength (like Hanover) https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=503 |
Page 8 of 11 |
| Author: | astral77 [ Fri May 18, 2012 11:44 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
Hi Gary Fantastic work, we are very fortunate to have people like you helping us. I hope you know how much we appreciate all your hard work in all areas in this forum. I was following David`s thread (HANOVER) from the early days and his train of thought was in line with yours during the development stage. I hope the attached pdf which contains extracts of David`s emails gives you a better insight in the application of your currency strength indicator. As David says a graphical indicator such as recent strength and yours tells a ongoing story and is much more useful than just a simple strength meter. I hope you find this brief document of some use. Kind Regards |
|
| Author: | garyfritz [ Sat May 19, 2012 10:49 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
OK. After muttering several unkind things about the parentage of the Empty4 designers, I finally have the currency strength FUNCTION working. This function must be called from EAs, NOT from indicators. It very efficiently calculates the 8 currency values -- it should cause VERY little load to the computer. There are two functions: Code: Select all Call the Init function to specify the EMA lengths for the Smooth, Speed, and Accel EMAs. These are the same as the Smooth/Speed/Accel EMAs in the indicator I've previously posted. Then call the CurrencyStrength function to calculate the current strength index values. Specify the Time[] of the bar you're calling it on and whether this is the first tick of a new bar. Then pass in 8 doubles. The function returns the 8 index values in these parameters. There's a tiny EA in the file to show an example of calling it. You can call the function once per bar e.g. on the Close, or multiple times per bar e.g. on each tick. It should work properly and produce the same final-bar value either way. I haven't verified the multiple-calls-per-bar functionality yet. I think, though, that it really only makes sense to pay attention to the values once per bar. It's not that jittery of an indicator. The results of this function are really close to the values from my indicator. There is one gotcha, which I don't think is a problem: when I checked it, the function results lagged the indicator by one bar. (And my TS indicator says the Empty4 indicator is right.) I think it's lagging because I ran my tiny EA in System Tester to test it, and I ran the System Tester in Open Only mode. So the function was working with the Open of the new bar which was about the same as the Close of the previous bar. But when I checked it I tagged the results with the Date/Time of the bar. So my test basically used yesterday's Close and today's Date, whereas the indicator used today's Close and today's Date. If you call it properly I think it will work properly, and it should match the indicator almost exactly. I'll look at this more when I get a chance. I haven't written EAs, so Steve or anyone else, let me know how this works for you. I'm still learning how to use the results of this thing. In my testing so far, I set the Smooth/Speed/Accel to values that "look nice," then design signals around it. That is, I set it to produce lines that move about as rapidly as I want. I don't want the signals to change every bar or two, so I set the EMA lengths long enough to produce nice smooth curves on my chart. 50/50/20 seems like a decent starting point. Have at it, gentlemen! |
|
| Author: | SteveHopwood [ Sat May 19, 2012 11:51 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
Fantastic Gary. You are a star. The attached is not a trader, nor will it ever be. All it does is display the strength values on the chart, so I can check that I am making the call correctly. I had to make some changes immediately:
|
|
| Author: | SteveHopwood [ Sun May 20, 2012 12:04 am ] |
| Post subject: | Re: Currency strength (like Hanover) |
Incidentally, I agree that it is unnecessary to call the function more than once per bar - we can have an input that specifies the time-frame. I find that calling thingies at the open of an M1 candle cuts down of processor use enormously. Also, you are right about the strategy tester bar thingy; Open prices only causes it to lag behind by 1 bar. |
|
| Author: | garyfritz [ Sun May 20, 2012 12:30 am ] |
| Post subject: | Re: Currency strength (like Hanover) |
Hm, no. In start() you printed the values of AUDIndex, etc. Those are the raw index values, basically what you would get if you set the Smooth, Speed, and Accel lengths to 1.0. I changed the code to display oAUD, etc -- but that just returned zeroes, and I'm not quite sure why. You declared them globally on line 126 so start() should have been able to access the values stored in lines 1795-1802. (...dig dig dig...) Looks like it's only being called once. It needs to run on some historic bars to spin up the values of the EMAs. If you only run it on one bar, you have no history to smooth the noisy raw index values or determine what the "normal" value is so you can determine if you're above or below it. How does that work with Empty4? I'm used to Tradestation, which always runs a system on the chart history before switching to processing realtime ticks -- similar to how Empty4 handles indicators. That means you have the chart history to get everything running. Empty4 doesn't do that, does it? Does that mean this thing can't work on Empty4 because you'd have to let it run for XXX bars before it stabilized!? If so, I'm gonna be really severely pissed... |
|
| Author: | garyfritz [ Sun May 20, 2012 1:37 am ] |
| Post subject: | Re: Currency strength (like Hanover) |
Thinking some more... you pass a "bar time" into the main function so it can grab Close values for 7 pairs that are all from the same time. It may be possible to modify things so the Init function sets things up, then it calls the main function for the last N bars. It would discard the resulting values, but that would initialize and stabilize the EMA values. Then when you called CurrencyStrength() from start(), it would be spun up and producing valid values. So it may be possible to work around this. |
|
| Author: | garyfritz [ Sun May 20, 2012 4:18 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
Well that was easier than I expected! Just add this to the end of the CurrencyStrengthInit() function: Code: Select all Code: Select all Why do you have to move oAUD/etc out to the global externs area? I wouldn't have used globals for all those values except they have to retain their values between calls. Good Programming Practice says you should hide as much of the internals as possible so people don't try to do things you didn't intend. Like accessing AUDIndex instead of the oAUD value. If you want to use the global values, I should probably rename them from oAUD to something more sensible, like AUDIndex, and change the raw values to AUDIndexRaw. Coming in the next release. |
|
| Author: | SteveHopwood [ Sun May 20, 2012 5:35 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
So I can find them where I expect to look, in 3 months time when I have no idea how all this works and have to try to find out. Yep. Exactly why I did this. Not my problem if people want to bugger things up. I need stuff where I can find it and where it means something to me People find it difficult sometimes to reconcile what I do my my assertion that I am merely a mechanic. Mostly, all I do is bolt stuff together. Sometimes I understand how it works. Sometimes I once understood how it works, but have forgotten. I would not even begin to re-code Hanover, for example; not a clue how it works. I have no idea what your code does or how it works. If we end up with a module I can add to my shell etc, then I shall use it. So will others. Just don't expect me to understand it. Does the attached look any more accurate? |
|
| Author: | garyfritz [ Sun May 20, 2012 6:10 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
Yes, that looks good. Meanwhile I'm working on a slightly improved version that will hopefully spin up faster, so the init function doesn't need so many bars to initialize the EMAs. I'll change the "result" vars to something sensible instead of oAUD, and I might add a sorted list. I.e. I might return an array CurrencyStrengthOrder[] that holds the currency# of the currencies in sorted order. So AUD=1, CAD=2, CHF=3, EUR=4, GBP=5, JPY=6, NZD=7, USD=8. For the example in http://www.stevehopwoodforex.com/phpBB3 ... 160#p13160, CurrencyStrengthOrder[] would hold 6 (JPY), 8 (USD), 5 (GBP), 2 (CAD), 4 (EUR), 3 (CHF), 1 (AUD), 7 (NZD) -- because that's the top-to-bottom order of the final index values. So for the example strategy I mentioned (pick the strongest and weakest currencies, and go long or short the resulting pair), CurrencyStrengthOrder[0] and CurrencyStrengthOrder[7] would give you the strongest and weakest currencies. Would that be useful? And once I do that, it would probably make sense to return the index values in CurrencyStrengthIndexes[] instead of in AUDIndex, CADIndex, etc. Then CurrencyStrengthIndexes[CurrencyStrengthOrder[0]] would give you the highest index value. Sound good? |
|
| Author: | SteveHopwood [ Sun May 20, 2012 6:25 pm ] |
| Post subject: | Re: Currency strength (like Hanover) |
Nope. Sounds fantastic. |
|
| All times are UTC | Page 8 of 11 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|