Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refs #11. MQL5 compatible version of SuperSlope oscillator #16

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@v3
with:
path: Include/EA31337-classes
ref: v3.000.1
ref: v3.000-dev
repository: EA31337/EA31337-classes
- name: Compile (build 2361)
uses: fx31337/mql-compile-action@master
Expand Down
68 changes: 67 additions & 1 deletion Oscillators/SuperSlope.mq5.fixme → Oscillators/SuperSlope.mq5
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
Loading