This is the concept for which I took on learning MQL5. I waited, and neglected poor old MQL4 all the while.
I'm not compiling yet... will my version be done in time for the competion? Absolutely not. Hopefully I'll have a pet zombie in the race, at any rate.
I am thinking in selfish terms for my library. I am only making my class structure fit my particular functions of the things you want to do.
However when it comes down to it, there are a lot of very useful "bits" for putting in place - open source mentalities, rather than only compiling before distribution, is healthy.
Leadership on the MetaQuotes team into these areas would be the most simple answer. Start version tracking database for user projects. The best conceptual material on the site I have found are the Price Histogram indicator and the VOM library. Those projects are already prepared for a thorough communal enhancing - and have well documented concepts for the OO usage (at least in part)
- 2010.01.28
- Dmitry
- www.mql5.com
This is the concept for which I took on learning MQL5. I waited, and neglected poor old MQL4 all the while.
I'm not compiling yet... will my version be done in time for the competion? Absolutely not. Hopefully I'll have a pet zombie in the race, at any rate.
I am thinking in selfish terms for my library. I am only making my class structure fit my particular functions of the things you want to do.
However when it comes down to it, there are a lot of very useful "bits" for putting in place - open source mentalities, rather than only compiling before distribution, is healthy.
Leadership on the MetaQuotes team into these areas would be the most simple answer. Start version tracking database for user projects. The best conceptual material on the site I have found are the Price Histogram indicator and the VOM library. Those projects are already prepared for a thorough communal enhancing - and have well documented concepts for the OO usage (at least in part)
Well in fairness this idea was not practical in the past.
Since the platform and language itself both are not released maybe it is better to keep their heads down.
Our day will come. I will be happy to provide codes once they are proficient. I am in no position for charity at the moment, however.
- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
I just started out trying this, made a quick one for the MACD cross. My programming skills aint great, but it works.
//+------------------------------------------------------------------+ //| Indicator_Actions.mqh | //| //| //+------------------------------------------------------------------+ #property copyright "Copyright 2010, FJ Mocke" //+------------------------------------------------------------------+ class MACD { public: string Cross_Signal(const string symbol,ENUM_TIMEFRAMES tf,int fast_EMA, int slow_EMA, int SMA, double avg_slope); double Signal_Avg(const string symbol,ENUM_TIMEFRAMES tf,int fast_EMA, int slow_EMA, int SMA, int bars); }; //+------------------------------------------------------------------+ //| MACD Cross Signal | //+------------------------------------------------------------------+ string MACD::Cross_Signal(const string symbol,ENUM_TIMEFRAMES tf,int fast_EMA, int slow_EMA, int SMA, double avg_slope) { double Signal[]; string cross; //Calculate Cross int MACD_Handle = iMACD(symbol,tf,fast_EMA,slow_EMA,SMA,PRICE_CLOSE); ArraySetAsSeries(Signal,true); if(CopyBuffer(MACD_Handle,1,0,4,Signal)<=0) {return("Error");} if (Signal[1] > 0 && Signal[2] < 0 && Signal[0] > 0) {cross = "Up";} if (Signal[1] < 0 && Signal[2] > 0 && Signal[0] < 0) {cross = "Down";} //Calculate Slope double slope = Signal[1] - Signal[2]; //Return the value of the function if (cross == "Up" && slope > 0 && MathAbs(slope) > avg_slope ) {return("Up");} if (cross == "Down" && slope < 0 && MathAbs(slope) > avg_slope) {return("Down");} return("No Cross"); } //+------------------------------------------------------------------+ //| Calculate The Average Trend of MACD Signal Line Over Certain Period| //+------------------------------------------------------------------+ double MACD::Signal_Avg(const string symbol,ENUM_TIMEFRAMES tf,int fast_EMA, int slow_EMA, int SMA, int bars) { double Signal[]; double sum = 0; int count = 0; int MACD_Handle = iMACD(symbol,tf,fast_EMA,slow_EMA,SMA,PRICE_CLOSE); ArraySetAsSeries(Signal,true); if(CopyBuffer(MACD_Handle,1,0,bars,Signal)<=0) {return(0);} for (int i =0;i<bars-1;i++) { if ( Signal[i] != 0 && Signal[i+1] != 0 ) { sum = sum + MathAbs(Signal[i] - Signal[i+1]); count++; } } return(sum/count); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey everyone,
I was thinking today if it is possible to build an indicator action library using the object oriented programming in mql5 ? Let me give an example:
Let's say I'm programming an EA that enters the market shortwhen the EMA trend of period 34 is smallerthan zero, and the MACD Signal crosses the zero line downwards.
Normally I would have to write everything for scratch. Would it be possible to write a library to make the following possible:
Of course the above is just an example and not how it shoulkd exactly be structured.
If it is possible won't it be great if we all can make one big library for all the indis to make this possible ?
I know this article (https://www.mql5.com/en/articles/116) explains how to work if OO programming, but I think it would be awesome if metaquotes could write such a library for all to use. I don't have the time or knowledge to do this all by myself