당사 팬 페이지에 가입하십시오
- 조회수:
- 24
- 평가:
- 게시됨:
- 2025.05.21 11:38
-
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
이 인디케이터는 종가를 기준으로 상승 또는 하락을 계산하고, OOP를 사용하여 작성되며, 모든 Expert Advisor 또는 다른 인디케이터에 쉽게 통합할 수 있습니다.
- 이 인디케이터는 전일 종가 대비 변동률인 CH%를 계산합니다.
- 차트에 개체를 생성합니다. 지표는 OOP 스타일로 작성됩니다.
- EA 또는 다른 지표에 통합하기가 매우 쉬우므로 클래스를 설명하고 호출하는 것으로 충분합니다.
다른 인디케이터 또는 EA에 내장된 코드의 크기를 추정할 수 있습니다.
두 줄입니다.
CChmcYZ chmc;
chmc.RCHsay("EURUSD",TimeCurrent()-86400*5,TimeCurrent(),5,16); // CH% 일 계산
OOP는 넓은 가능성을 제공하고 필요한 클래스를 작성한 다음 구성합니다.

//+------------------------------------------------------------------+ //|yuraz_mcch.mq5 | //| 저작권 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 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 클래스 계산 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; // 메인 창에서 작업 void CChmcYZ() { indicatorWindow=0; lColorSym=DarkBlue; // 다크터콰이즈 lColorCH=DarkGreen; // 흰색; lColorChPlus = Green; // LimeGreen; lColorChMinus = FireBrick ; // 빨간색; } // 생성자 void RCH(string sSym,datetime db,datetime de); // 매핑 없이 한 쌍만 전체 계산 void RCHsay(string sSym,datetime db,datetime de,int X,int Y); // 한 쌍의 계산을 완료하고 표시합니다. private: color lColor; double dClose[7000]; // 최대 가격 복사용 배열 }; //+------------------------------------------------------------------+ //|| //+------------------------------------------------------------------+ 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; } } } //+------------------------------------------------------------------+ //|| 출력으로 계산 //+------------------------------------------------------------------+ void CChmcYZ::RCHsay(string sSym,datetime db,datetime de,int XD,int YD) // 한 쌍만 전체 계산 { 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); } // // 수업 종료 // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // 클래스가 사용된 코드 // CChmcYZ chmc; //+------------------------------------------------------------------+ //|| //+------------------------------------------------------------------+ int OnInit() { //--- 표시기 버퍼 매핑 chmc.RCHsay("EURUSD",TimeCurrent()-86400*5,TimeCurrent(),5,16); // 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); // 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); // 개체 삭제 while( i > 0 ) { if(StringSubstr(ObjectName(0,i ),0,3)=="oYZ") { ObjectDelete(0,ObjectName(0,i )); } i--; } }
MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/11347

새 플랫폼용 인디케이터 에디션.

The Auto SL TP by Risk Reward Ratio script is a simple yet powerful tool designed for MetaTrader 5 traders who want to streamline their risk management process. This script automates the process of setting Stop Loss (SL) and Take Profit (TP) levels for open positions based on a user-defined Risk:Reward ratio and Stop Loss in pips. Whether you're a beginner or an experienced trader, this script saves time and ensures consistent risk management.

스크립트는 루돌프 악셀 레벨을 그립니다.

이 지표는 RSI 다이버전스를 가져와 버퍼에 플롯하여 EA를 자동화합니다.