Home › Forums › Trading Systems Discussion › A Flexible And Compact Currency Strength Indicator
Tagged: CIX
- This topic has 270 replies, 23 voices, and was last updated 5 years, 8 months ago by
upliftingmania.
-
AuthorPosts
-
Hi Guys!
As announced in the Forex Plumber Thread started by gg53 (see http://penguintraders.com/forums/topic/the-forex-plumber/page/2/#post-7864) I’ll post my modification of that FXcorrelator indicator published by NVP in the trade2win forum. See Forex Plumber thread for links to the origin.
As suggested by gg53, my first step was to replace NVP’s original arithmetics by a simple Rate of Change. Then I worked the whole code over in order to make it more flexible when it comes to switching to completely different arithmetics. I finished that barebone by implementing a final SuperSmoother averaging according to John Ehlers.
As a final step I included 3 more arithmetics to choose from – just as examples to get a discussion started. These are:
- Hans Hannula’s PFE (Polarized Fractal Efficiency)
- My personal PFE mod, transforming it from a Close-Close pricefield to High-Low
- A symmetric Money Flow Index
These were the first ones that came to my mind.
Oh yes – and I changed the line colours to my preferences, which work very nicely on a dark grey background. The lines of the current pair will be a bit wider than the rest.
The PFE concept was published in TASC, titled “Polarized Fractal Efficiency” – you’ll find it if you’re interested in some conceptual background! Looking at the indicator, I somehow sadly have say that the original PFE seems to be superior to my mod
Money Flow Index incorporates a volume component in its base algorithm, but I’m not so sure whether this is really suitable for our purpose. Check it out!
Now feel free to test, to modify, and to post your comments and suggestions!
If posting suggestions for additional arithmetics or for implementing a volume calculation – please be specific and provide some detail!
Cheers & have fun!
simplex
EDIT 2015-10-05: New, adaptive version in this post: http://penguintraders.com/forums/topic/a-flexible-and-compact-currency-strength-indicator/page/2/#post-8237
EDIT 2015-10-07: Version 1.1 in this post: http://penguintraders.com/forums/topic/a-flexible-and-compact-currency-strength-indicator/page/2/#post-8262
EDIT 2015-10-14: Version 2.0 and Session_Correlator in this post: http://penguintraders.com/forums/topic/a-flexible-and-compact-currency-strength-indicator/page/5/#post-8407
-
This topic was modified 7 years, 6 months ago by
simplex. Reason: spelling
-
This topic was modified 7 years, 5 months ago by
simplex. Reason: Link to new version. ENJOY!
-
This topic was modified 7 years, 5 months ago by
simplex. Reason: Link to latest version
Attachments:
You must be logged in to view attached files.A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
Thanks simplex that you share your work with us.
I would love to see an option to turn off/on the single currencies, if that is possible.
"A dream you dream alone is only a dream. A dream you dream together is a reality." (John Lennon)
I think there are guys around who have some experience with the original FXcorrelator. The following code sequence was taken from the original one (after some renaming, etc.) without questioning its logic:
vUSD = (- vEUR_USD - vGBP_USD - vAUD_USD + vUSD_CHF + vUSD_JPY - vNZD_USD + vUSD_CAD) / 7.0; vEUR = vEUR_USD + ( - vGBP_USD - vAUD_USD + vUSD_CHF + vUSD_JPY - vNZD_USD + vUSD_CAD) / 6.0; vGBP = vGBP_USD + ( - vEUR_USD - vAUD_USD + vUSD_CHF + vUSD_JPY - vNZD_USD + vUSD_CAD) / 6.0; vAUD = vAUD_USD + ( - vEUR_USD - vGBP_USD + vUSD_CHF + vUSD_JPY - vNZD_USD + vUSD_CAD) / 6.0; vNZD = vNZD_USD + ( - vEUR_USD - vGBP_USD - vAUD_USD + vUSD_CHF + vUSD_JPY + vUSD_CAD) / 6.0; vCHF = - vUSD_CHF + ( - vEUR_USD - vGBP_USD - vAUD_USD + vUSD_JPY - vNZD_USD + vUSD_CAD) / 6.0; vJPY = - vUSD_JPY + ( - vEUR_USD - vGBP_USD - vAUD_USD + vUSD_CHF - vNZD_USD + vUSD_CAD) / 6.0; vCAD = - vUSD_CAD + ( - vEUR_USD - vGBP_USD - vAUD_USD + vUSD_CHF + vUSD_JPY - vNZD_USD) / 6.0;
It’s my understanding, that a currency strength indicator should display relative strenght of the underlying currencies against each other, so all eight values should sum up to (nearly) zero at all times. Correct?
Unfortunately, this is not the case for this indicator, nor for the original FXcorrelator which I checked out.
Could anybody who has some experience with the original indicator clarify?
Cheers, simplex
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
Great thread bro, very interesting. Do you include market share of each currency to your indicator ?
Great thread bro, very interesting. Do you include market share of each currency to your indicator ?
Thanks! Maybe you could suggest a specific algorithm for including market share? I don’t think that this makes sense, but if you describe an algorithm in detail I’m willing to give it a try!
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
I think there are guys around who have some experience with the original FXcorrelator. The following code sequence was taken from the original one (after some renaming, etc.) without questioning its logic:
vUSD = (- vEUR_USD - vGBP_USD - vAUD_USD + vUSD_CHF + vUSD_JPY - vNZD_USD + vUSD_CAD) / 7.0; vEUR = vEUR_USD + ( - vGBP_USD - vAUD_USD + vUSD_CHF + vUSD_JPY - vNZD_USD + vUSD_CAD) / 6.0; vGBP = vGBP_USD + ( - vEUR_USD - vAUD_USD + vUSD_CHF + vUSD_JPY - vNZD_USD + vUSD_CAD) / 6.0; vAUD = vAUD_USD + ( - vEUR_USD - vGBP_USD + vUSD_CHF + vUSD_JPY - vNZD_USD + vUSD_CAD) / 6.0; vNZD = vNZD_USD + ( - vEUR_USD - vGBP_USD - vAUD_USD + vUSD_CHF + vUSD_JPY + vUSD_CAD) / 6.0; vCHF = - vUSD_CHF + ( - vEUR_USD - vGBP_USD - vAUD_USD + vUSD_JPY - vNZD_USD + vUSD_CAD) / 6.0; vJPY = - vUSD_JPY + ( - vEUR_USD - vGBP_USD - vAUD_USD + vUSD_CHF - vNZD_USD + vUSD_CAD) / 6.0; vCAD = - vUSD_CAD + ( - vEUR_USD - vGBP_USD - vAUD_USD + vUSD_CHF + vUSD_JPY - vNZD_USD) / 6.0;
It’s my understanding, that a currency strength indicator should display relative strenght of the underlying currencies against each other, so all eight values should sum up to (nearly) zero at all times. Correct? Unfortunately, this is not the case for this indicator, nor for the original FXcorrelator which I checked out. Could anybody who has some experience with the original indicator clarify? Cheers, simplex
I had some experience with FXCorrelator since I assisted in its developmented at some point in the past.
Since this indicator has no specific “anchor” (either certain date/time or external fixed value) it will not sum up to “0” or “1” – because everything is floating and relates to one another – instead of relating to some “fixed” mutual value.
Even the USD when compared to itself, in the real world, should increase/decrease in value based on combined inflation and interest rate.
Today’s $1.00 USD was probably worth $0.1 USD 50 years ago… So even the USD, compared to itself, is fluctuating.
So a chart showing just the $USD should reflect that and not be a straight horizontal line.
As to the “market share” of each currency – you can ignore it and dismiss its relevance if you think that a small increase/decrease in the NZD have the same effect on the market as similiar increase/decrease in the all mighty $USD…
G.
Watch the USDJPY (green/yellow at the yellow vertical line) behaviour according to your indicator (default params):
It’s going against your indie… someting is wrong…
G.
Attachments:
You must be logged in to view attached files.Thank you for your replies, gg53!
Since this indicator has no specific “anchor” (either certain date/time or external fixed value) it will not sum up to “0” or “1” – because everything is floating and relates to one another – instead of relating to some “fixed” mutual value.
Great – got that! So the slope of each line should be more important than its current value, right?
As to the “market share” of each currency – you can ignore it and dismiss its relevance if you think that a small increase/decrease in the NZD have the same effect on the market as similiar increase/decrease in the all mighty $USD…
No, certainly not! But what are we doing here? Watching prices in the recent past and trying to find an edge for our trading while calculating where prices might move in the near future. How does ‘market share’ fit into any such algorithm? We can assess volume of each instrument traded, and market share will certainly be reflected in absolute volume, in some way. So, what’s the algorithmic connection to CS?
On the other hand: let’s consider EURUSD moves up by 0.1 %, and so does EURNZD. Acknowledging the fact that both movements were done at different volumes / market shares, it’s still the same 0.1 % movement on both instruments, resulting in roughly the same win or loss potential.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
Watch the USDJPY (green/yellow at the yellow vertical line) behaviour according to your indicator (default params): It’s going against your indie… someting is wrong…
Thanks again!
Since I don’t know which time zone is shown in your pic, I failed to find the exact point in order to display the situation on chart.
Furthermore, I don’t think that every movement of any two lines of a CS indicator must be reflected as a correlating move of their combined instrument. Obviously, in CS values and gradients of all lines always are the outcome of the combined movements of all related instruments. I wouldn’t dare to conclude that if USD moves up and JPY moves down in CS then USDJPY has to move up on chart. I would expect some positive correlation for such a behaviour, yet would always seek the confirmation of a single instrument indicator of any kind.
Lastly, I don’t consider my default parameters a good choice for such a short timeframe. I had something in mind when coding those variables as input parameters!
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
I would love to see an option to turn off/on the single currencies, if that is possible.
Yep, ok! I will implement that in some future release!
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
Watch the USDJPY (green/yellow at the yellow vertical line) behaviour according to your indicator (default params): It’s going against your indie… someting is wrong…
Thanks again! Since I don’t know which time zone is shown in your pic, I failed to find the exact point in order to display the situation on chart. Furthermore, I don’t think that every movement of any two lines of a CS indicator must be reflected as a correlating move of their combined instrument. Obviously, in CS values and gradients of all lines always are the outcome of the combined movements of all related instruments. I wouldn’t dare to conclude that if USD moves up and JPY moves down in CS then USDJPY has to move up on chart. I would expect some positive correlation for such a behaviour, yet would always seek the confirmation of a single instrument indicator of any kind. Lastly, I don’t consider my default parameters a good choice for such a short timeframe. I had something in mind when coding those variables as input parameters!
The whole purpose of the CS indie is to provide a certain degree of predictive view of a pair movement and an overall view of the market.
BTW: the USDJPY posted screenshot has a filename “USDJPY.M5″…
G.
Thank you for your replies, gg53!
Since this indicator has no specific “anchor” (either certain date/time or external fixed value) it will not sum up to “0” or “1” – because everything is floating and relates to one another – instead of relating to some “fixed” mutual value.
Great – got that! So the slope of each line should be more important than its current value, right?
As to the “market share” of each currency – you can ignore it and dismiss its relevance if you think that a small increase/decrease in the NZD have the same effect on the market as similiar increase/decrease in the all mighty $USD…
No, certainly not! But what are we doing here? Watching prices in the recent past and trying to find an edge for our trading while calculating where prices might move in the near future. How does ‘market share’ fit into any such algorithm? We can assess volume of each instrument traded, and market share will certainly be reflected in absolute volume, in some way. So, what’s the algorithmic connection to CS? On the other hand: let’s consider EURUSD moves up by 0.1 %, and so does EURNZD. Acknowledging the fact that both movements were done at different volumes / market shares, it’s still the same 0.1 % movement on both instruments, resulting in roughly the same win or loss potential.
Market share: you’re talking about percent change, but I think the algo is calculating pips change…
G.
Market share: you’re talking about percent change, but I think the algo is calculating pips change
There are 4 different algos implemented to choose from:
ROC -> percent change
2 versions of PFE -> normalized efficiency of move
MFI -> volume dependent strength indexNone of them uses a simple pip counter, imo.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
BTW: the USDJPY posted screenshot has a filename “USDJPY.M5″…
Ahhh – now I got it: as I stated, I was missing time zone information to find the exact point, not the time frame!
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
Market share: you’re talking about percent change, but I think the algo is calculating pips change
There are 4 different algos implemented to choose from: ROC -> percent change 2 versions of PFE -> normalized efficiency of move MFI -> volume dependent strength index None of them uses a simple pip counter, imo.
My way of trading:
1. Decide on currency pair based on currency-strength indie.
2. when having multiple choices based on above – I trade the best ROC among them.
So, in conclusion, I suggest you build plain Currency-Strength and add a ROC as an extra feature alongside it or as separate companion indie.
If you base your plain Currency-Strength indie on FXCorrelator – replace the iMA with some Adaptive MA (Ehlers or similiar).
To test, your resulting indie should have some short-term predictive nature on at least the 7 majors – otherwise what’s the point?
G.
So, in conclusion, I suggest you build plain Currency-Strength and add a ROC as an extra feature alongside it or as separate companion indie. If you base your plain Currency-Strength indie on FXCorrelator – replace the iMA with some Adaptive MA (Ehlers or similiar).
G, thank you again for your input! That sounds reasonable, and I’ll certainly give it a try. Today I haven’t had enough time to finish it, and probably won’t have during the weekend. As I understand your proposal, you’re putting some emphasis on the term “plain” Currency Strength. I think there could be different definitions fulfilling this term “plain”. I could think of price deviation from a long term average (in percent), or maybe relative price movement in some kind of channel. What is your definition of this “plain” CS?
Since this indicator has no specific “anchor” (either certain date/time or external fixed value) it will not sum up to “0” or “1” – because everything is floating and relates to one another – instead of relating to some “fixed” mutual value.
I thought about this zero balance again. If we based the indicator on all 28 crosses of our 8 currencies, we would achieve a zero balance automatically, if the algorithm is correct. So I would say, the way you’re doing it in FXcorrelator is an approximation that can achieve a nearly zero balance. I think it was Alexander Elder who stated that TA is a craft, not an exact science. I think this approximation is precise enough. I have built a version of the indicator that displays the balance line, and it’s usually inside a narrow channel around zero, maybe a maximum of 5 to 10 % of the full range of the currency lines. So this should be fine.
I’ll check back on Sunday.
Have a nice weekend everybody!
simplex
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
Market share: you’re talking about percent change, but I think the algo is calculating pips change
There are 4 different algos implemented to choose from: ROC -> percent change 2 versions of PFE -> normalized efficiency of move MFI -> volume dependent strength index None of them uses a simple pip counter, imo.
1. I was refering to original FXCorrelator – it is calculating PIPS difference between current and previous.
2. Also, it is calculating MA pips difference – which introduce double lagging. The proper way, if this method is used, is to calculate actual diff and then “smooth” the result with some kind of MA.
3. Also, not all pips are created equal…. a 10 pips move on a currency pair that moves 50 pips a day is not equal to same 10 pips move on a currency pair that moves 150 pips daily.
G.
1. I was refering to original FXCorrelator – it is calculating PIPS difference between current and previous. 2. Also, it is calculating MA pips difference – which introduce double lagging. The proper way, if this method is used, is to calculate actual diff and then “smooth” the result with some kind of MA. 3. Also, not all pips are created equal…. a 10 pips move on a currency pair that moves 50 pips a day is not equal to same 10 pips move on a currency pair that moves 150 pips daily.
I see – thanks for clarifying! Actually I always try to avoid any simple pips calculation in my indicators. As you stated, a pip is not a comparable unit when different pairs are in question. I think that the relation of ROC and ATR is what really matters, at least when heading for swings or shorttime trends.
I’m trying to follow your hint to go for an adaptive MA and ROC calculation, but was stopped out by other activities. Anyway – I’m close … Chose Ehlers’ 2-pole Supersmoother as an averaging base and manipulate its length by a standard deviation calculation. Looks pretty nice so far, maybe a little more reactiveness might be achieved.
J.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
Great thread bro, very interesting. Do you include market share of each currency to your indicator ?
Thanks! Maybe you could suggest a specific algorithm for including market share? I don’t think that this makes sense, but if you describe an algorithm in detail I’m willing to give it a try!
Hi simplex,
Sorry for late reply, i was busy with my EA …
I do not know whether this is right or wrong (need guide from GG) :
USD = msUSD * USD;
EUR = msEUR * EUR;
JPY = msJPY * JPY;
etc …The market share value (msUSD, msEUR, msJPY, etc) can be get from :https://en.wikipedia.org/wiki/Foreign_exchange_market , just scroll down, look at part : Trading Characteristic, and on the right of it, we can see the market share table. The total there is 200%, so we must divide each value with 2.
ex: msUSD = 87% / 2 = 43.5 %. (attach market share image is found @FF).
The “anchor” , ADR, ATR, ROC and smoothing the line is interesting.
How to make the line smoother using Ehler’s 2 pole super smoother filter … ??
Thanks
Attachments:
You must be logged in to view attached files.Thank you for your replies, gg53!
Since this indicator has no specific “anchor” (either certain date/time or external fixed value) it will not sum up to “0” or “1” – because everything is floating and relates to one another – instead of relating to some “fixed” mutual value.
Great – got that! So the slope of each line should be more important than its current value, right?
As to the “market share” of each currency – you can ignore it and dismiss its relevance if you think that a small increase/decrease in the NZD have the same effect on the market as similiar increase/decrease in the all mighty $USD…
No, certainly not! But what are we doing here? Watching prices in the recent past and trying to find an edge for our trading while calculating where prices might move in the near future. How does ‘market share’ fit into any such algorithm? We can assess volume of each instrument traded, and market share will certainly be reflected in absolute volume, in some way. So, what’s the algorithmic connection to CS? On the other hand: let’s consider EURUSD moves up by 0.1 %, and so does EURNZD. Acknowledging the fact that both movements were done at different volumes / market shares, it’s still the same 0.1 % movement on both instruments, resulting in roughly the same win or loss potential.
Market share: you’re talking about percent change, but I think the algo is calculating pips change… G.
Hi G,
Below is the Fxcorrelator comparison: with & without market share. It looks “strange” may be because of using Percentage, not Pips ….
How to calculate pips change in relation to Market Share ….thanks in advance.
Attachments:
You must be logged in to view attached files.Thank you for your replies, gg53!
Since this indicator has no specific “anchor” (either certain date/time or external fixed value) it will not sum up to “0” or “1” – because everything is floating and relates to one another – instead of relating to some “fixed” mutual value.
Great – got that! So the slope of each line should be more important than its current value, right?
As to the “market share” of each currency – you can ignore it and dismiss its relevance if you think that a small increase/decrease in the NZD have the same effect on the market as similiar increase/decrease in the all mighty $USD…
No, certainly not! But what are we doing here? Watching prices in the recent past and trying to find an edge for our trading while calculating where prices might move in the near future. How does ‘market share’ fit into any such algorithm? We can assess volume of each instrument traded, and market share will certainly be reflected in absolute volume, in some way. So, what’s the algorithmic connection to CS? On the other hand: let’s consider EURUSD moves up by 0.1 %, and so does EURNZD. Acknowledging the fact that both movements were done at different volumes / market shares, it’s still the same 0.1 % movement on both instruments, resulting in roughly the same win or loss potential.
Market share: you’re talking about percent change, but I think the algo is calculating pips change… G.
Hi G, Below is the Fxcorrelator comparison: with & without market share. It looks “strange” may be because of using Percentage, not Pips …. How to calculate pips change in relation to Market Share …. thanks in advance.
I think that you are “scaling” the end result.
You need to “factor” or “scale” individual moves.
The USD exist in all major currency pairs – so your result shouldn’t look like this.
G.
-
This reply was modified 7 years, 5 months ago by
gg53.
Below is the Fxcorrelator comparison: with & without market share. It looks “strange”
Hi smallcat,
I don’t think this is strange. It’s what can be expected when introducing market share to our CS formula in the way you proposed.
Think about it: basically we’re calculating a rate of change in percent or a similar indicator – you mentioned ATR, etc. We’ll do this for every pair involved, and then calculate individual values for CS. Ok so far.
When we simply multiply the USD CS value with 40 %, NZD with 1 %, etc., our ROC arithmetics is forced completely out of balance. If introducing market share makes sense, then some more sophisticated arithmetics are required.
It might be interesting to find some more info about that. At the moment I have no further idea.
On the other hand: we’re trading individual pairs. When fat EURUSD moves by 0.01 % and when little AUDNZD also moves by 0.01 %, we basically can generate identical profits from both moves, ignoring volatility, SL, trading cost, etc. So why should I introduce market share in a formula to calculate CS for individual entries?
When looking at the FX market as a whole, market share makes sense. An unusually strong move of USD will have a much stronger impact on the other currencies than a similar move of NZD, looking at the market as a system of forces that at any time will tend to stay in balance.
So market share is certainly interesting when calculating synthetic currency crosses and trading them. But when our strategy does not incorporate that kind of arithmetics, market share does not matter, IMO.
Maybe I’m on the wrong track … but until now I did not read a single post or article anywhere that could teach me better. And I would be willing to learn …
sx.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
How to make the line smoother using Ehler’s 2 pole super smoother filter … ??
Hi again smallcat,
That’s easy. In the 1st post I introduced an FXcorrelator version that uses Ehler’s 2 pole super smoother for finally smoothing the lines. To do that, you’ll calculate a coefficients array at first, and then use the array in the smoothing formula.
Because I’m a lazy old dog, I placed everything in a set of functions for easy repeated use.
Calculate coefficients: function
int pSuperSmoother(double &_coeff[], const double smooPeriod = 10)
Smoothen an array based on those coefficients: function
double ipSuperSmootherOnArray(double &inArray[], double &outArray[], double &_coeff[], const int sh)
Now, if you don’t have a precalculated array, but want to smoothen prices directly, you would simply replace function ipSuperSmootherOnArray by the following one:
/* ---------------------------------------------------- ipSuperSmoother John Ehlers' Supersmoother Coded by simplex, 2014-02 ---------------------------------------------------- */ double ipSuperSmoother(const string _sym, const int _tf, double &outArray[], double &_coeff[], const int pri, const int sh) { double out = 0.0; out = _coeff[0] * (stdPrice(_sym, _tf, pri, sh) + stdPrice(_sym, _tf, pri, sh+1)) / 2.0 + _coeff[1] * outArray[sh+1] + _coeff[2] * outArray[sh+2]; return(out); } /* ----------------------------------------------------------- stdPrice Coded by simplex, 2014-02 ----------------------------------------------------------- */ double stdPrice(string _sym, int _tf, int pri, int sh, int _smooth = 1) { double out; if (StringLen(_sym) < 1) out = iMA(NULL, _tf, _smooth, 0, MODE_SMA, pri, sh); else out = iMA(_sym, _tf, _smooth, 0, MODE_SMA, pri, sh); return(out); }
Any questions? Happy coding!
sx.
Hmmm – I really hope my code formatting will be shown correctly!
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
How to make the line smoother using Ehler’s 2 pole super smoother filter … ??
Hi again smallcat, That’s easy. In the 1st post I introduced an FXcorrelator version that uses Ehler’s 2 pole super smoother for finally smoothing the lines. To do that, you’ll calculate a coefficients array at first, and then use the array in the smoothing formula. Because I’m a lazy old dog, I placed everything in a set of functions for easy repeated use.
Calculate coefficients: function
int pSuperSmoother(double &_coeff[], const double smooPeriod = 10)
Smoothen an array based on those coefficients: functiondouble ipSuperSmootherOnArray(double &inArray[], double &outArray[], double &_coeff[], const int sh)
Now, if you don’t have a precalculated array, but want to smoothen prices directly, you would simply replace function ipSuperSmootherOnArray by the following one:/* ---------------------------------------------------- ipSuperSmoother John Ehlers' Supersmoother Coded by simplex, 2014-02 ---------------------------------------------------- */ double ipSuperSmoother(const string _sym, const int _tf, double &outArray[], double &_coeff[], const int pri, const int sh) { double out = 0.0; out = _coeff[0] * (stdPrice(_sym, _tf, pri, sh) + stdPrice(_sym, _tf, pri, sh+1)) / 2.0 + _coeff[1] * outArray[sh+1] + _coeff[2] * outArray[sh+2]; return(out); } /* ----------------------------------------------------------- stdPrice Coded by simplex, 2014-02 ----------------------------------------------------------- */ double stdPrice(string _sym, int _tf, int pri, int sh, int _smooth = 1) { double out; if (StringLen(_sym) < 1) out = iMA(NULL, _tf, _smooth, 0, MODE_SMA, pri, sh); else out = iMA(_sym, _tf, _smooth, 0, MODE_SMA, pri, sh); return(out); }
Any questions? Happy coding! sx.
Hmmm – I really hope my code formatting will be shown correctly!
Thanks a lot Simplex. Will try it soon
Below is the Fxcorrelator comparison: with & without market share. It looks “strange”
Hi smallcat, I don’t think this is strange. It’s what can be expected when introducing market share to our CS formula in the way you proposed. Think about it: basically we’re calculating a rate of change in percent or a similar indicator – you mentioned ATR, etc. We’ll do this for every pair involved, and then calculate individual values for CS. Ok so far. When we simply multiply the USD CS value with 40 %, NZD with 1 %, etc., our ROC arithmetics is forced completely out of balance. If introducing market share makes sense, then some more sophisticated arithmetics are required. It might be interesting to find some more info about that. At the moment I have no further idea. On the other hand: we’re trading individual pairs. When fat EURUSD moves by 0.01 % and when little AUDNZD also moves by 0.01 %, we basically can generate identical profits from both moves, ignoring volatility, SL, trading cost, etc. So why should I introduce market share in a formula to calculate CS for individual entries? When looking at the FX market as a whole, market share makes sense. An unusually strong move of USD will have a much stronger impact on the other currencies than a similar move of NZD, looking at the market as a system of forces that at any time will tend to stay in balance. So market share is certainly interesting when calculating synthetic currency crosses and trading them. But when our strategy does not incorporate that kind of arithmetics, market share does not matter, IMO. Maybe I’m on the wrong track … but until now I did not read a single post or article anywhere that could teach me better. And I would be willing to learn …
sx.
1. …”we basically can generate identical profits from both moves”… : Not quite… 0.01%x1.2 (EURUSD) doesn’t equal 0.01%x0.70 (AUDUSD).
2. We currently accept the fact that the USD is generally stronger than the EUR. So why is 1EUR=1.2USD? If and how it’s reflected on the indie?
3. The purpose of the indicator is to show you the market as a whole. The more accurate it will be it will give you earlier signals – beeing a predictive indicator.
4. The reason you didn’t see discussions about it means nothing. People just copying basic ideas from one another without further major enhancement.
The overall purpose is to create a better and more accurate indie – all means are “Kosher”…
G.
-
AuthorPosts
- You must be logged in to reply to this topic.