Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Telegram !
Rejoignez notre page de fans
Rejoignez notre page de fans
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
- Vues:
- 179
- Note:
- Publié:
-
Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance
L'indicateur calcule le % de hausse ou de baisse par rapport à CLOSE, est écrit en OOP, et peut être facilement intégré dans un Expert Advisor ou un autre indicateur.
- L'indicateur calcule le CH%, le pourcentage de changement par rapport au CLOSE du jour précédent.
- Il crée des objets sur le graphique. L'indicateur est écrit en style OOP.
- Très facile à intégrer dans n'importe quel EA ou autre indicateur, il suffit de décrire la classe et de faire son appel.
Vous pouvez estimer la taille du code intégré dans un autre indicateur ou EA.
Il s'agit de 2 lignes
CChmcYZ chmc;
chmc.RCHsay("EURUSD",TimeCurrent()-86400*5,TimeCurrent(),5,16); // calculer le jour CH%
La POO offre de larges possibilités, vous écrivez les classes nécessaires, puis vous construisez ...

//+------------------------------------------------------------------+ //|yuraz_mcch.mq5 | //| Copyright 2009, MetaQuotes Software Corp. //|http ://www.mql5.com //+------------------------------------------------------------------+ #property copyright "2009, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" #property indicator_chart_window ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // calcul de la classe CH% // struct SymbolStruct { bool work; string sSymbol; int y; int x; double CH; }; //+------------------------------------------------------------------+ //|| //+------------------------------------------------------------------+ class CChmcYZ { public: SymbolStruct sSymb; color lColorSym; color lColorChPlus; color lColorChMinus; color lColorCH; int indicatorWindow; // travailler dans la fenêtre principale void CChmcYZ() { indicatorWindow=0; lColorSym=DarkBlue; // DarkTurquoise lColorCH=DarkGreen; // Blanc ; lColorChPlus = Green; // LimeGreen ; lColorChMinus = FireBrick ; // Rouge ; } // constructeur void RCH(string sSym,datetime db,datetime de); // Calcul complet d'une seule paire sans cartographie void RCHsay(string sSym,datetime db,datetime de,int X,int Y); // Compléter le calcul d'une paire et l'afficher private: color lColor; double dClose[7000]; // tableau pour la copie des prix maximums }; //+------------------------------------------------------------------+ //|| //+------------------------------------------------------------------+ void CChmcYZ::RCH(string sSymbol,datetime DATEBEG,datetime DATEEND) { sSymb.CH = 0; int CountBar; DATEBEG = StringToTime( TimeToString(DATEBEG,TIME_DATE)); DATEEND = StringToTime( TimeToString(DATEEND,TIME_DATE)); CountBar= CopyClose(sSymbol,PERIOD_D1,DATEEND,2,dClose); if(CountBar>=0) { if(NormalizeDouble(dClose[1],5)!=0.0 && NormalizeDouble(dClose[0],5)!=0.0) { sSymb.CH=(dClose[1]*100)/dClose[0]-100; } } } //+------------------------------------------------------------------+ //|| Calcul avec sortie //+------------------------------------------------------------------+ void CChmcYZ::RCHsay(string sSym,datetime db,datetime de,int XD,int YD) // Calcul complet d'une seule paire { RCH(sSym,db,de); if(ObjectFind(indicatorWindow,"oYZ"+sSym)==-1) { ObjectCreate(indicatorWindow,"oYZ"+sSym,OBJ_LABEL,indicatorWindow,0,0); ObjectSetInteger(indicatorWindow,"oYZ"+sSym,OBJPROP_XDISTANCE,XD); ObjectSetInteger(indicatorWindow,"oYZ"+sSym,OBJPROP_YDISTANCE,YD); ObjectSetInteger(indicatorWindow,"oYZ"+sSym,OBJPROP_CORNER,CORNER_LEFT_UPPER); ObjectSetString(indicatorWindow,"oYZ"+sSym,OBJPROP_TEXT,sSym); ObjectSetString(indicatorWindow,"oYZ"+sSym,OBJPROP_FONT,"Arial"); ObjectSetInteger(indicatorWindow,"oYZ"+sSym,OBJPROP_FONTSIZE,7); ObjectSetInteger(indicatorWindow,"oYZ"+sSym,OBJPROP_COLOR,lColorSym); ObjectSetInteger(indicatorWindow,"oYZ"+sSym,OBJPROP_SELECTABLE,true); } if(ObjectFind(indicatorWindow,"oYZ_"+sSym)==-1) { ObjectCreate(indicatorWindow,"oYZ_"+sSym,OBJ_LABEL,indicatorWindow,0,0); ObjectSetInteger(indicatorWindow,"oYZ_"+sSym,OBJPROP_XDISTANCE,XD+45); ObjectSetInteger(indicatorWindow,"oYZ_"+sSym,OBJPROP_YDISTANCE,YD); ObjectSetInteger(indicatorWindow,"oYZ_"+sSym,OBJPROP_CORNER,CORNER_LEFT_UPPER); ObjectSetString(indicatorWindow,"oYZ_"+sSym,OBJPROP_TEXT,sSym); ObjectSetString(indicatorWindow,"oYZ_"+sSym,OBJPROP_FONT,"Arial"); ObjectSetInteger(indicatorWindow,"oYZ_"+sSym,OBJPROP_FONTSIZE,7); ObjectSetInteger(indicatorWindow,"oYZ_"+sSym,OBJPROP_COLOR,lColorCH); ObjectSetInteger(indicatorWindow,"oYZ_"+sSym,OBJPROP_SELECTABLE,true); } YD=YD+11; lColor=lColorCH; if(sSymb.CH>0) { lColor=lColorChPlus; ObjectSetString(indicatorWindow,"oYZ_"+sSym,OBJPROP_TEXT," "+DoubleToString(sSymb.CH,5)); ObjectSetInteger(indicatorWindow,"oYZ_"+sSym,OBJPROP_XDISTANCE,XD+45); } if(sSymb.CH<0) { lColor=lColorChMinus; ObjectSetString(indicatorWindow,"oYZ_"+sSym,OBJPROP_TEXT,DoubleToString(sSymb.CH,5)); ObjectSetInteger(indicatorWindow,"oYZ_"+sSym,OBJPROP_XDISTANCE,XD+46); } ObjectSetInteger(indicatorWindow,"oYZ_"+sSym,OBJPROP_COLOR,lColor); } // // fin de la classe // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Le code dans lequel la classe est utilisée // CChmcYZ chmc; //+------------------------------------------------------------------+ //|| //+------------------------------------------------------------------+ int OnInit() { //--- cartographie des tampons d'indicateurs chmc.RCHsay("EURUSD",TimeCurrent()-86400*5,TimeCurrent(),5,16); // calculer le jour CH% chmc.RCHsay("AUDUSD",TimeCurrent()-86400*5,TimeCurrent(),5,16+12 ); chmc.RCHsay("GBPUSD",TimeCurrent()-86400*5,TimeCurrent(),5,16+12*2 ); chmc.RCHsay("USDCHF",TimeCurrent()-86400*5,TimeCurrent(),5,16+12*3 ); chmc.RCHsay("USDCAD",TimeCurrent()-86400*5,TimeCurrent(),5,16+12*4 ); return(0); } //+------------------------------------------------------------------+ //|| //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { chmc.RCHsay("EURUSD",TimeCurrent()-86400*5,TimeCurrent(),5,16); // calculer le jour CH% chmc.RCHsay("AUDUSD",TimeCurrent()-86400*5,TimeCurrent(),5,16+12 ); chmc.RCHsay("GBPUSD",TimeCurrent()-86400*5,TimeCurrent(),5,16+12*2 ); chmc.RCHsay("USDCHF",TimeCurrent()-86400*5,TimeCurrent(),5,16+12*3 ); chmc.RCHsay("USDCAD",TimeCurrent()-86400*5,TimeCurrent(),5,16+12*4 ); return(rates_total); } void OnDeinit() { int i=ObjectsTotal(0); // supprimer nos objets while( i > 0 ) { if(StringSubstr(ObjectName(0,i ),0,3)=="oYZ") { ObjectDelete(0,ObjectName(0,i )); } i--; } }
Traduit du russe par MetaQuotes Ltd.
Code original : https://www.mql5.com/ru/code/11347
MACD Signals
Edition de l'indicateur pour la nouvelle plateforme.
CTsLogger est un système d'enregistrement simple et flexible.
Logger avec la possibilité d'enregistrer des modules individuels ou des sections de code
YURAZ_RSAXEL Le script dessine les niveaux de Rudolf Axel
Le scénario dessine les niveaux de Rudolph Axel
Divergence RSI
Cet indicateur prend les divergences RSI et les trace dans des tampons pour automatiser les EA.