An easy one - location of mq5 source code

 

Hi all,

I would like to access the source code (mq5) of the indicator iBands (to see its details including the structure of the generated handle) or the source code of any other built-in indicator (to use them properly in a EA).

How could I do it?


Nb: In the local folder "C:\Users\<user_name>\AppData\Roaming\MetaQuotes\Terminal\<ID>\MQL5\Indicators" I can only find a subfolder Examples, whose indicators do not produce handles.

Documentation on MQL5: Technical Indicators / iBands
Documentation on MQL5: Technical Indicators / iBands
  • www.mql5.com
iBands - Technical Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
They do produce handles when initialised with iCustom.
 
Tobias Johannes Zimmer #:
They do produce handles when initialised with iCustom.

Sure, I'm certain the indicators in the Examples folder can be adjusted to produce handles, I'll also have a look at it.

Aside this, I still don't know how to have a view on the source code of the iBands indicator (or any other), even in read only, to know how each indicator has been computed.

 
Thomas110 #: Sure, I'm certain the indicators in the Examples folder can be adjusted to produce handles, I'll also have a look at it.

Indicators do not produce handles. They are indicators. iCustom produces a handle of an indicator.

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
          MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
          How to call indicators in MQL5 - MQL5 Articles (2010)

 
William Roeder #:

Indicators do not produce handles. They are indicators. iCustom produces a handle of an indicator.

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
          MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
          How to call indicators in MQL5 - MQL5 Articles (2010)

Thanks William for the suggestions; I'll then read this carefully.
 
Thomas110 #:
Thanks William for the suggestions; I'll then read this carefully.
And to come back to my question, how could I know how/where the iBands() has been calculated?
 
Thomas110 #:
And to come back to my question, how could I know how/where the iBands() has been calculated?

For the built-in indicators you can't, because that code is not public.

Best you can get are formulas from the technical indicators documentation.

For example: iBands - Bollinger bands

Technical Indicators - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
  • www.metatrader5.com
An indicator is the most important tool for technical analysis. Decisions about how and when to trade can be made on the basis of technical...
 
Drazen Penic #:

For the built-in indicators you can't, because that code is not public.

Best you can get are formulas from the technical indicators documentation.

For example: iBands - Bollinger bands

Ok I see. It's also rather likely that Metaquotes has just applied iCustom to the function BB.mq5 provided in the Examples folder, or something close.

I'll try to familiarize myself with several good indicators templates.

Thanks for the suggestions/views

Reason: