Download MetaTrader 5

How does one learn to make indicators?

To add comments, please log in or register
Brian Lillard
597
Brian Lillard  

I've easilly seen guides on how to make expert advisors on the web and in forums,...

How hard is it to make indicators and use it to do a statistical or seudo backtest?

Just wondering about the theory behind making indicators and I can't seem to find anything to deliver that.

Simon Gniadkowski
Moderator
18023
Simon Gniadkowski  
Subgenius:


I've easilly seen guides on how to make expert advisors on the web and in forums,...

How hard is it to make indicators and use it to do a statistical or seudo backtest?

Just wondering about the theory behind making indicators and I can't seem to find anything to deliver that.

Not sure if you are talking about designing Indicators or coding them in mql4 ?


If you are talking about coding then the Book has some material: Book - Indicators

also you should look through sample code in the Code Base and figure out how a few work.

Brian Lillard
597
Brian Lillard  
RaptorUK:

Not sure if you are talking about designing Indicators or coding them in mql4 ?


If you are talking about coding then the Book has some material: Book - Indicators

also you should look through sample code in the Code Base and figure out how a few work.


My confusing in writing mt4 indicators is how the count is done and how it relates to ranges of bars


its easy to see how the indicator counts all bars and places a buffer value of an object to a bar, but what if you wanted to write a little bit of expert code saying if bar 0 till bar is this then do that

as the indicator progressed through all the bars..


Would it be as easy as using current bar variable and counting backwards ??

Simon Gniadkowski
Moderator
18023
Simon Gniadkowski  
Subgenius:

My confusing in writing mt4 indicators is how the count is done and how it relates to ranges of bars

OK, Indicators aren't really my thing but lets see if I can explain some things . . .

Usually when an Indicator is first run it calculates all it's values (buffers) for all the bars on the chart, this can take a little time dependant on the number of br on the chart and the complexity of the calculations . . . after this only the bars that have changed ( new bars ) have their Indicator buffer values calculated, this is where IndicatorCounted() is used.

Subgenius:


its easy to see how the indicator counts all bars and places a buffer value of an object to a bar, but what if you wanted to write a little bit of expert code saying if bar 0 till bar is this then do that

as the indicator progressed through all the bars..

You get Indicator buffer values into your EA using iCustom(), the iCustom() call runs your Indicator on a specified Bar on a specified Symbol and timeframe and returns the specified buffer value . . . so what is returned is the buffer value for a particular bar number. if you want values for a series of bar you need to call iCustom() once for each of the bars . . .

Subgenius:


Would it be as easy as using current bar variable and counting backwards ??

Just use a loop counting from the first bar you want Indicator buffer information on to the last bar, use the loop to call iCustom() for each of the bar numbers.
Ian Venner
2584
Ian Venner  

Subgenius:

I've easilly seen guides on how to make expert advisors on the web and in forums,...

How hard is it to make indicators and use it to do a statistical or seudo backtest?

Just wondering about the theory behind making indicators and I can't seem to find anything to deliver that.


I found indicator coding more difficult than EA's, I had to work hard at coding them it took me longer than it did to learn to code EA's there are confusing technical technical issues but I would totaly recommend you put the time in to learn them it is very rewarding and yes you can write complete trade simulators in a self testing indicator with on screen information etc I have coded several of them. (they are more useful for live testing than backtesting because the lack of historical tick support but it is possible to backtest too if you make creative use of what is available and possible to calculate)

The main thing about indicators is understanding IndicatorCounted(). It is confusing at first. There is a section from the book creation of custom indicators, it is a good reference with examples and the source code for standard indicators is always a good way to learn, I remember reading a tutorial by coders guru that was helpful too, if you google his name you will find it.

To add comments, please log in or register