stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

The Matrix
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3787
Page 1 of 3
Author:  renexxxx [ Tue Aug 12, 2014 9:35 am ]
Post subject:  The Matrix

Here is a little indicator that can be used to quickly visualize trends, slopes, etc across all currency pairs. It looks like a matrix:
Selection_074.png
I have attached the mq4 file. The code is really simple. Obviously, the file goes in the MQL4\Indicators folder. For the coders amongst us, we have to define/change two functions:

Code: Select all

void calcSymbols()

that is used to calculate an indicator value of some sort for each symbol

Code: Select all

color valueToColor( double value )
to map that value to a color

The code contains some example implementations of these functions. I hope this will be useful.
Author:  milanese [ Tue Aug 12, 2014 9:46 am ]
Post subject:  The Matrix

Thank you Rene :good: Looks like a very infomative and helpfull tool and very clear coding :good:

Cheers :)

Tommaso
Author:  McNish [ Tue Aug 12, 2014 12:14 pm ]
Post subject:  The Matrix

WOW, ...

... Great Stuff man!

Cheers, :D
Author:  mobthehop [ Tue Aug 12, 2014 10:20 pm ]
Post subject:  The Matrix

Rene,

just what I was looking for - thanks a lot....

Trying to change it to my needs but am a bit puzzled about these:

- lines 193 and 194 - both Slope and RSI are being calculated without assigning different variables for each. Obviously the indicator generates a grid but for which of the two values?

- if I understand the coding correctly, a gradient color is assigned to the normalized value of the signal (eg line 304) - would I need to change the block lines 295ff valuetocolor for absolute thresholds - eg for iRSI color1 if above 70, color2 if below 30?

Cheers & thanks again for sharing this nice piece of code!
Author:  renexxxx [ Wed Aug 13, 2014 1:08 am ]
Post subject:  The Matrix

mobthehop » Wed Aug 13, 2014 8:20 am wrote: - lines 193 and 194 - both Slope and RSI are being calculated without assigning different variables for each. Obviously the indicator generates a grid but for which of the two values?
Sorry about that, that this is not clear. The idea is to generate a value to

Code: Select all

symbols[iSymbol].value
In line 193 we have:

Code: Select all

symbols[iSymbol].value = getSlope( symbols[iSymbol].symbol, timeFrame, 1 );
and in line 194 we have:

Code: Select all

symbols[iSymbol].value = iRSI( symbols[iSymbol].symbol, timeFrame, 14, PRICE_CLOSE, 1 );
Obviously, line 194 overwrites the value of symbols[iSymbol].value that was set in line 193. In fact, I should have outcommented line 193 ... but I wanted to leave it as an example.

Ideally, the value set for symbols[iSymbol].value should be between -1.0 and +1.0. I believe that slope values are in that range?. The iRSI is in the range from [0, 100], that's why we have the code in lines 198-203 to map these values to the range [-1.0, +1.0]. The reason why these values should be between -1.0 and +1.0 is because the code in valueToColor() expects them to be. However, nothing stops you from changing the code in valueToColor() to accommodate any value you provide it.

I hope I have made myself understandable.
Author:  SpiderX [ Wed Aug 13, 2014 9:33 am ]
Post subject:  Using The Matrix

Hi all,

Maybe this is fairly obvious, but would like to point out a small possible way to use the Matrix to scout out trading opportunities.
Look for rows and columns which is all/mostly green or red.
If both row and column are green, it should indicate good buying opportunity on the pair.
If both row and column are red, good selling.

For example, in the picture...AUDCHF presents a good buying opportunity.
While EURCAD, EURUSD GBPCAD, GBPUSD are good selling opportunities.

For my example, the filters are based on Hourly, Daily, Weekly open only.

Cheers
Author:  renexxxx [ Wed Aug 13, 2014 12:04 pm ]
Post subject:  The Matrix

It might be useful to have multiple "Matrices" on the screen, each displaying a different signal, or the same signal on a different timeframe. We could eg. have 4 matrices, one with CSS, another one with OB/OS condition, yet another with some volume indi, and maybe one with some trend information. I am sure there are people here with much better suggestions than me. We would need to add the code for these calculations to the Matrix -- but that should be fairly easy to do. We can offset the x and y of each matrix to tile them on the screen -- this would create quite a useful 'dashboard'.
Author:  SpiderX [ Wed Aug 13, 2014 12:28 pm ]
Post subject:  The Matrix

Hi Rene

I was thinking of having matrix on 4 charts
But 4 matrix on one chart sounds great ! :smile:

Cheer
Author:  renexxxx [ Thu Aug 14, 2014 12:53 am ]
Post subject:  The Matrix

SpiderX » Wed Aug 13, 2014 10:28 pm wrote:Hi Rene

I was thinking of having matrix on 4 charts
But 4 matrix on one chart sounds great ! :smile:

Cheer
This is an example:
Selection_076.png
For this I changed a few lines in the mq4 file (attached)

Cheers ...
Author:  simplex [ Mon Oct 06, 2014 11:17 am ]
Post subject:  The Matrix

René,

Wonderful peace of work - thanks for sharing it!

What I particularly like is:
  • from the indicator point of view the simplicity of reading for currency strength
  • from the coding point of view the clarity and most of all the meaningful utilization of modern concepts (build 600+) like structures and enumerations
Especially the latter is still deficient in my own coding, so I might consider to take your indicator as a blueprint to enhance my coding!

When it comes to readability, I would like to share my thoughts of enhancing it a bit: obviously, The Matrix shows base currencies as lines and quote currencies as columns. When I like to explore the state, i.e. strength of a particular currency, I have to look at the colours it shows as lines AND the INVERTED colours it shows as columns. Right?
UsingTheMatrix.jpg
To analyze the current state of CHF, I would look at the CHF line, which shows RED (weakness) against JPY, and I would look at CHF column, which shows GREEN mainly. Because this columns represents all pairs where CHF is the quote currency I have to invert those readings to RED to come to the conclusion: CHF is weak at the moment, so sell it, or wait for reversal, or whatever!

My idea:
TheMatrixEnhancement.jpg
Draw a rectangle of inverted colour code in the opposite matrix cell. A red CHFJPY will lead to a green JPYCHF. A green AUDNZD will lead to a red NZDAUD (see arrows in second image).

After doing so for all 28 pairs, the only empty cells remaining will be the main diagonal, and analyzing the current state of a specific currency would simply be done by looking at the colours of its corresponding line - without the inverting stuff of column readings we had to do before.

Writing this, I'm not quite sure whether this indicator was meant to be read in the sense of currency strength instead of presenting an overview of 28 single pairs - but it would be a great tool for doing just that at a glance.

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.

Thanks again & cheers,

Jürgen
All times are UTC Page 1 of 3