Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dev
Browse files Browse the repository at this point in the history
* origin/master:
  Refs #8. ATR_MA_Trend now uses IndicatorLegacy.h file to allow using MQL5 versions of iNAME() indicators like iMA(), iRSI() in MQL4. We use it to run MQL5 indicator in MQL4.
  Refs #11. Fixed warnings. "Compile" GitHub action will now use EA31337-classes v3.000-dev.
  Refs #11. MQL5 compatible version of SuperSlope oscillator. Unsure if it works correctly.
  • Loading branch information
kenorb committed Aug 20, 2024
2 parents c86369a + 43b5a2e commit 87b50d3
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 1 deletion.
36 changes: 36 additions & 0 deletions Misc/ATR_MA_Trend.mq4.todo
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,41 @@
* Implements strategy's indicator.
*/

#include <EA31337-classes/IndicatorLegacy.h>

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots 4
//+----------------------------------------------+
//| Bullish indicator rendering options |
//+----------------------------------------------+
#property indicator_type1 DRAW_LINE
#property indicator_color1 Blue
#property indicator_style1 STYLE_DASHDOTDOT
#property indicator_width1 2
#property indicator_label1 "Upper TrendValue"
//+----------------------------------------------+
//| Bearish indicator rendering options |
//+----------------------------------------------+
#property indicator_type2 DRAW_LINE
#property indicator_color2 MediumVioletRed
#property indicator_style2 STYLE_DASHDOTDOT
#property indicator_width2 2
#property indicator_label2 "Lower TrendValue"
//+----------------------------------------------+
//| Bullish indicator rendering options |
//+----------------------------------------------+
#property indicator_type3 DRAW_ARROW
#property indicator_color3 DeepSkyBlue
#property indicator_width3 4
#property indicator_label3 "Buy TrendValue"
//+----------------------------------------------+
//| Bearish indicator rendering options |
//+----------------------------------------------+
#property indicator_type4 DRAW_ARROW
#property indicator_color4 Red
#property indicator_width4 4
#property indicator_label4 "Sell TrendValue"

// Includes the main file.
#include "ATR_MA_Trend.mq5"
68 changes: 67 additions & 1 deletion Oscillators/Multi/SuperSlope.mq5.fixme
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,46 @@
#define extern input
#define Bars (ChartStatic::iBars(_Symbol, _Period))
#define Bid (SymbolInfoStatic::GetBid(_Symbol))
#define TimeDayOfWeek (DateTime::DateOfWeek())
#define TimeDayOfWeek DateTimeStatic::DayOfWeek

int WindowFirstVisibleBar(const long chart_ID = 0) {
long result = -1;

ResetLastError();

if (!ChartGetInteger(chart_ID, CHART_FIRST_VISIBLE_BAR, 0, result)) {
Print(__FUNCTION__ + ", Error Code = ", GetLastError());
}

return (int)result;
}

int WindowBarsPerChart() {
return (int)ChartGetInteger(0, CHART_VISIBLE_BARS, 0);
}

int ObjectFind(string name) { return ObjectFind(0, name); }

bool ObjectSetText(string name, string text, int font_size, string font = "",
color text_color = CLR_NONE) {
int tmpObjType = (int)ObjectGetInteger(0, name, OBJPROP_TYPE);
if (tmpObjType != OBJ_LABEL && tmpObjType != OBJ_TEXT)
return (false);
if (StringLen(text) > 0 && font_size > 0) {
if (ObjectSetString(0, name, OBJPROP_TEXT, text) == true &&
ObjectSetInteger(0, name, OBJPROP_FONTSIZE, font_size) == true) {
if ((StringLen(font) > 0) &&
ObjectSetString(0, name, OBJPROP_FONT, font) == false)
return (false);
if (text_color != CLR_NONE &&
ObjectSetInteger(0, name, OBJPROP_COLOR, text_color) == false)
return (false);
return (true);
}
return (false);
}
return (false);
}

// Define global functions.
#undef DoubleToStr
Expand All @@ -57,6 +96,33 @@ int WindowsTotal(const long _cid = 0) {
}
return (int)result;
}
int WindowOnDropped() { return ChartWindowOnDropped(); }
int WindowFind(string name) {
int window = -1;
if ((ENUM_PROGRAM_TYPE)MQLInfoInteger(MQL_PROGRAM_TYPE) ==
PROGRAM_INDICATOR) {
window = ChartWindowFind();
} else {
window = ChartWindowFind(0, name);
if (window == -1)
Print(__FUNCTION__ + "(): Error = ", GetLastError());
}
return (window);
}

// Following methods are only valid when used in MQL4 code.
string StringTrimLeftMQL4(string text) {
StringTrimLeft(text);
return text;
}

string StringTrimRightMQL4(string text) {
StringTrimRight(text);
return text;
}

#define StringTrimLeft StringTrimLeftMQL4
#define StringTrimRight StringTrimRightMQL4

// Includes the main file.
#include "SuperSlope.mq4"
Expand Down

0 comments on commit 87b50d3

Please sign in to comment.