The Matrix

The title says it all
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

The Matrix

Post by renexxxx »

simplex » Mon Oct 06, 2014 9:17 pm wrote: I would love to code this variation by myself, but I'm afraid I just do not have the time by now. So just take my lines as a proposal.
Good idea ... this will make it a full matrix. I will change the code accordingly and upload the new version as soon as I have time.

Cheers!
User avatar
simplex
Trader
Posts: 127
Joined: Thu Feb 07, 2013 5:21 pm
Location: An insignificant small town close to an insignificant former capital at the Rhine River.

The Matrix

Post by simplex »

renexxxx » 06 Oct 2014, 14:06 wrote: Good idea ... this will make it a full matrix. I will change the code accordingly and upload the new version as soon as I have time.
One more thought: maybe you could add a new input variable when modifying your code:

Code: Select all

input int method = 0;
where:
method == 0: original display as you have it now
method == 1: modified display for full matrix

Thus the way of interpretation Spider suggested would also be possible in future.

Jürgen
If you can't explain it simply, you don't understand it well enough. (Albert Einstein)
It appears that the Weighted Moving Average was invented by a trader who did not have a firm grasp of filter theory in hopes of reducing lag. (John F. Ehlers)
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

The Matrix

Post by renexxxx »

I have made the change as suggested. Thanks for your input!
TheMatrix.png
TheMatrix.mq4
You do not have the required permissions to view the files attached to this post.
User avatar
simplex
Trader
Posts: 127
Joined: Thu Feb 07, 2013 5:21 pm
Location: An insignificant small town close to an insignificant former capital at the Rhine River.

The Matrix

Post by simplex »

René,
Excellent coding - thanks a lot! :good:

When browsing your code, the normalization algorithm in function calcSymbols() caught my attention.

Code: Select all

if ( max > min ) {
   for (int iSymbol = 0; iSymbol < ArraySize(symbols); iSymbol++) {
      symbols[iSymbol].value = 2 * ((symbols[iSymbol].value - min) / (max-min)) - 1.0;
   }
}
You seem to set the symbol with highest CSS slope at value +1 and the symbol with the lowest slope at -1. Then all other symbols get their values between those extremes, much like a stoch calculation.

I see the necessity for some kind of normalization for method CSS in order to map its readings to a limited colour scale. The implication of doing so is that we loose one of the best features of CSS: a measure for the weighted strength of a certain currency. We can only identify by colour intensity whether a currency is strong or weak as compared to the others, but IMO we don't have any chance to judge whether this colour mapping is caused by significant moves or just by random fluctuations.

The other methods you've implemented at the moment (ADX, Stochastic, and MFI) are defined on limited scales per se. So when it comes to mapping their original values to your -1 ... +1 scale a simple linear transformation applied to their scalar values would be sufficient. These are normalized per se, and a second normalization is being applied by your algorithm.

I do not state that it would be better to replace the second normalization by a simple linear transformation, but I do believe that the choice of appropriate normalization algorithms is crucial for any cluster indicator like this one - if and only IF normalization is necessary for a specific purpose.

I'd love to read about your thoughts that led to the specific algorithm you implemented here.

Cheers,

Jürgen
If you can't explain it simply, you don't understand it well enough. (Albert Einstein)
It appears that the Weighted Moving Average was invented by a trader who did not have a firm grasp of filter theory in hopes of reducing lag. (John F. Ehlers)
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

The Matrix

Post by renexxxx »

simplex » Tue Oct 07, 2014 9:22 pm wrote: I'd love to read about your thoughts that led to the specific algorithm you implemented here.

Jürgen
Hi Jürgen,

The 'problem' is this: Map the set of symbol values to a color (RGB) range from 255:0:0 - 0:255:0. Obviously, we must be able to 'see' the differences in values, so, my solution was to map the highest symbol value to GREEN (0:255:0) and the lowest one to RED (255:0:0) and every other symbol value was linearly mapped to a color in between.

I agree that this can have problems. If for instance the highest value = +10 and the lowest value is -200 (for whatever performance indicator), but most values are within +10 and -10, the impact of the -200 value is huge and it means that most negative values have roughly the same color (red-brownish).

So, I am open to suggestions to improve this mapping from values to colors.

Rene.
piter44
Trader
Posts: 37
Joined: Wed Oct 08, 2014 1:09 pm

The Matrix

Post by piter44 »

Preview: The Matrix
Hi,
I've been redirected to this topic from forexfactory forum and I found that this indicator is very similiar to my daily manual calculations.
Basically I calculate strength of a currency by comparing current price to SMA. i.e.

I check current price of a pair and compare it with SMA (usually 89 but sometimes I change it) and then score currency. i.e.

I have eigth currencies: USD, EUR, GBP, JPY, AUD, NZD, CHF, CAD
and every day I check each cross and its position to SMA. (my basic timeframe is 4h)

And I put my observations into excel sheet:
SMA on EURUSD = 1.40 and current price is 1.32 so i give 1 point to USD and -1 point to EUR
SMA on GBPUSD = 1.60 and current price is 1.52 so i give 1 point to USD and -1 point to GBP
SMA on EURGBP = 0.90 and current price is 0.95 so i give 1 point to EUR and -1 point to GBP
So far I have:
EUR: 0
USD: 2
GBP: -2
etc.

Is it possible to modify your indicator and add comparision to SMA?

You can see how my excel looks in attached file.

Kind regards,
Piter
You do not have the required permissions to view the files attached to this post.
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

The Matrix

Post by renexxxx »

piter44 » Wed Oct 08, 2014 11:29 pm wrote:Preview: The Matrix
Hi,
I've been redirected to this topic from forexfactory forum and I found that this indicator is very similiar to my daily manual calculations.
Basically I calculate strength of a currency by comparing current price to SMA. i.e.

I check current price of a pair and compare it with SMA (usually 89 but sometimes I change it) and then score currency. i.e.

I have eigth currencies: USD, EUR, GBP, JPY, AUD, NZD, CHF, CAD
and every day I check each cross and its position to SMA. (my basic timeframe is 4h)

And I put my observations into excel sheet:
SMA on EURUSD = 1.40 and current price is 1.32 so i give 1 point to USD and -1 point to EUR
SMA on GBPUSD = 1.60 and current price is 1.52 so i give 1 point to USD and -1 point to GBP
SMA on EURGBP = 0.90 and current price is 0.95 so i give 1 point to EUR and -1 point to GBP
So far I have:
EUR: 0
USD: 2
GBP: -2
etc.

Is it possible to modify your indicator and add comparision to SMA?

You can see how my excel looks in attached file.

Kind regards,
Piter
Hi piter44,

This sort of thing can be easily done, by changing a few lines in the calcSymbols function. Apart from the column and row totals this is pretty much what you want, right? For instance, on H4, the JPY row is GREEN. This is a visual clue that JPY must be strong (on H4) -- however, there is no row total - you will have to add that yourself, if this is absolutely necessary.
TheMatrixSMA.png
I have attached the updated code. (Select the appropriate CalcMethod) The idea is and has been to use this 'Matrix' as a visualisation tool to display a certain indicator value. Obviously, the number of indicators is infinite and I can not add code for each of them. So, hopefully, people would use this code to create their own 'Matrix'.

Cheers ... Rene.
You do not have the required permissions to view the files attached to this post.
piter44
Trader
Posts: 37
Joined: Wed Oct 08, 2014 1:09 pm

The Matrix

Post by piter44 »

Brilliant!

Thank You very much :)
User avatar
simplex
Trader
Posts: 127
Joined: Thu Feb 07, 2013 5:21 pm
Location: An insignificant small town close to an insignificant former capital at the Rhine River.

The Matrix

Post by simplex »

renexxxx » 07 Oct 2014, 22:03 wrote: I agree that this can have problems. If for instance the highest value = +10 and the lowest value is -200 (for whatever performance indicator), but most values are within +10 and -10, the impact of the -200 value is huge and it means that most negative values have roughly the same color (red-brownish).

So, I am open to suggestions to improve this mapping from values to colors.
Well, my basic question at this point is: why should a calculation, that is normalized per se (e.g. Stochastic) be normalized a second time before being mapped to a colour code?

If you want your visualization to be as close as possible to the original Stochastic values, a simple scalar rescaling would do to fit into your -1 ... +1 scale:

Code: Select all

stoch_rescaled = (stoch_raw - 50.0) / 50.0;
If you want to expand stoch_raw in order to utilize the full spectrum of a chosen range of colours, your second normalization is a good choice and the result is the visualization of a 'dual-normalized' Stochastic.

Maybe it is a question of a specific trading strategy that would make one of those two methods more preferrable.

Have a nice weekend!

Jürgen
If you can't explain it simply, you don't understand it well enough. (Albert Einstein)
It appears that the Weighted Moving Average was invented by a trader who did not have a firm grasp of filter theory in hopes of reducing lag. (John F. Ehlers)
obob
Posts: 1
Joined: Sat Oct 12, 2013 1:06 pm

The Matrix

Post by obob »

thank you for the fantastic indicator.
It literally transformed my trading (especially the addition of above/below MA option).

I have a question...
I keep an eye on several currency pairs on the TheMatrix indi.
I would like to manually mark them with either a shape or an arrow (whatever even vertical and horiz. lines would work), but after I put marks on the chart, they disappear (go into background) after few seconds.
Is there a way of marking certain squares?

thank you
Post Reply

Return to “Indicators and matrixes”