Simple Multicurrency Indicator in MQL5?

 

Hi Everyone,

I'd like to make a simple custom indicator that appears in a separate window, as an exercise to help me understand Mql5 a little better!

The indicator will use the data from the chart it is attached to, and have an input to select a second symbol.

For example:

Attach the indicator to the EURUSD chart and in the indicator inputs, add the GBPCHF as a second symbol.

----

Inputs:

MA period: 10 

Price: Close (can be o,h,l,c, or median).

Second symbol: GBPCHF

Line Colour: Green

----

Indicator calculation:

Use the MA(close) of the current chart symbol and add it to the MA(close) of the second symbol. Divide this number by 2. 

Print this to the chart window as a single line.

Sounds easy, right!

Hopefully I'll learn the right way to use buffers and handles etc... using multicurrency, but I'm struggling a bit, with this...

If anyone out there can help me get started with some tips, advice, or have a code sample of a similar thing, that would be very appreciated!

Thank you all, in advance!

Lynette.

 
Lynette HeitSounds easy, right! Hopefully I'll learn the right way to use buffers and handles etc... using multicurrency, but I'm struggling a bit, with this...

If anyone out there can help me get started with some tips, advice, or have a code sample of a similar thing, that would be very appreciated!

No, it will not be easy! Its only easy for those that have done it countless times before.

Before you start making up your own indicator, start by first understanding existing code for an indicator, in order to know how it works and how to modify it.

Search the CodeBase for something similar or that just draws a moving average. Study it! Modify it. Make it your own. Rewrite it from scratch.

Only then will you be ready to make something new based on your requirements!

MQL5 Code Base
MQL5 Code Base
  • www.mql5.com
MQL5 Source Code Library for MetaTrader 5
 
Lynette Heit: Sounds easy, right!

You don't know how to code, but the changes are easy? That's like saying "I don't know how to build engines but adding another cylinder should be easy; it's just one more."
          Is it easy (or difficult) to …? - General - MQL5 programming forum #2 2017.08.31

 
William Roeder:

You don't know how to code, but the changes are easy? That's like saying "I don't know how to build engines but adding another cylinder should be easy; it's just one more."
          Is it easy (or difficult) to …? - General - MQL5 programming forum #2 2017.08.31

Thanks William.

Re: "Sounds easy, right"...Ok, it seems should have put a question mark at the end of that little statement, instead of an exclamation... I'm sorry if that was taken out of context.

I can write some simple applications in C and have a basic understanding of other languages too, but I'm only a novice. My question was with regards to MQL5 buffers and handles and I was hoping someone from this community, could kindly help me 'shortcut' my MQL5 learning, by offering a good example of how it all works together, using the example that I chose?

Sadly, this appears not to be the case. I'll back out of here quietly and close the door on the way out...

 
Fernando Carreiro:

No, it will not be easy! Its only easy for those that have done it countless times before.

Before you start making up your own indicator, start by first understanding existing code for an indicator, in order to know how it works and how to modify it.

Search the CodeBase for something similar or that just draws a moving average. Study it! Modify it. Make it your own. Rewrite it from scratch.

Only then will you be ready to make something new based on your requirements!

Thanks Fernando, I'll have a dig around in the codebase and continue with the documentation. It is actually very good, I'm just struggling to manipulate arrays with buffers and handles. Very interesting and it will certainly improve my understanding of MQL5.

Lyn.

 

I found something similar in the codebase...

https://www.mql5.com/en/code/1055

This could be a useful example, so thanks to the author for sharing this.

MultiCurrency
MultiCurrency
  • www.mql5.com
The MultiCurrency indicator allows you to concurrently analyze up to eight currency charts.