Skip to content

Commit

Permalink
Updated for ver. 3.21
Browse files Browse the repository at this point in the history
  • Loading branch information
9nix6 committed Jul 7, 2021
1 parent 702d6fd commit 94059ea
Show file tree
Hide file tree
Showing 70 changed files with 176 additions and 31 deletions.
Binary file modified Experts/2MA_Cross.ex5
Binary file not shown.
Binary file modified Experts/PriceMA_Cross.ex5
Binary file not shown.
Binary file modified Experts/TickChart_ExampleEA.ex5
Binary file not shown.
Binary file modified Include/AZ-INVEST/SDK/CommonSettings.mqh
Binary file not shown.
Binary file modified Include/AZ-INVEST/SDK/CustomChartInputs.mqh
Binary file not shown.
Binary file modified Include/AZ-INVEST/SDK/CustomChartInputsBR.mqh
Binary file not shown.
Binary file modified Include/AZ-INVEST/SDK/CustomChartSettingsBase.mqh
Binary file not shown.
133 changes: 125 additions & 8 deletions Include/AZ-INVEST/SDK/TimeControl.mqh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright 2018-19, Artur Zas
// Copyright 2018-2021, Artur Zas
// GNU General Public License v3.0 -> https://github.com/9nix6/Median-and-Turbo-Renko-indicator-bundle/blob/master/LICENSE
// https://www.az-invest.eu
// https://www.mql5.com/en/users/arturz
//
Expand All @@ -8,46 +9,100 @@ class CTimeControl
{
private:

int scheduleID;

int startHH;
int startMM;
string start;
datetime startOfSession;

int endHH;
int endMM;
string end;
datetime endOfSession;

bool scheduleEnabled;

public:

CTimeControl(int id = 0) { scheduleID = id; };

void SetValidTraingHours(string _from = "0:00", string _to = "0:00");
void SetValidTraingHours(bool _unused, string _timeSpan = "0:00-0:00");
bool IsTradingTimeValid();
bool IsScheduleEnabled() { return scheduleEnabled; };
void UpdateSessionDateTime(int addSecods = 0);
datetime GetSessionStartTime() { return startOfSession; };
datetime GetSessionEndTime() { return endOfSession; };
void MoveSessionStartToNow();
string ToString();

private:

void StringToHHMM(string value, int &HH, int &MM);
bool StringToHHMMRange(string value, int &startHH, int &startMM, string& _start, int &endHH, int &endMM, string& _end);
void SetScheduleState();
};

void CTimeControl::SetValidTraingHours(string _from,string _to)
void CTimeControl::SetValidTraingHours(string _from, string _to)
{
this.start = _from;
this.end = _to;

StringToHHMM(this.start, this.startHH, this.startMM);
StringToHHMM(this.end, this.endHH, this.endMM);
UpdateSessionDateTime();

if(this.startHH == 0 && this.startMM == 0 && this.endHH == 0 && this.endMM == 0)
SetScheduleState();
}

void CTimeControl::MoveSessionStartToNow()
{
datetime now = TimeCurrent();

MqlDateTime temp;
TimeToStruct(now,temp);

startHH = temp.hour;
startMM = temp.min;
start = StringFormat("%02d:%02d", startHH, startMM);

UpdateSessionDateTime(temp.sec + 1);
}

void CTimeControl::UpdateSessionDateTime(int addSecods = 0)
{
datetime now = TimeCurrent();

MqlDateTime temp;
TimeToStruct(now,temp);

if(addSecods > 0)
{
scheduleEnabled = false;
string startTimeTemp = StringFormat("%s:%02d", this.start, addSecods);
startOfSession = StringToTime((string)temp.year+"."+(string)temp.mon+"."+(string)temp.day+" "+startTimeTemp);
}
else
{
scheduleEnabled = true;
startOfSession = StringToTime((string)temp.year+"."+(string)temp.mon+"."+(string)temp.day+" "+this.start);
}

endOfSession = StringToTime((string)temp.year+"."+(string)temp.mon+"."+(string)temp.day+" "+this.end);
}

void CTimeControl::SetValidTraingHours(bool _unused, string _timeSpan = "0:00-0:00")
{
if(!StringToHHMMRange(_timeSpan, this.startHH, this.startMM, this.start, this.endHH, this.endMM, this.end))
return;

UpdateSessionDateTime();
SetScheduleState();
}

bool CTimeControl::IsTradingTimeValid()
{
if(scheduleEnabled == false)
return true;
return true;

datetime now = TimeCurrent();

Expand All @@ -57,12 +112,32 @@ bool CTimeControl::IsTradingTimeValid()
datetime _start = StringToTime((string)temp.year+"."+(string)temp.mon+"."+(string)temp.day+" "+this.start);
datetime _end = StringToTime((string)temp.year+"."+(string)temp.mon+"."+(string)temp.day+" "+this.end);

if((now >= _start) && (now <= _end))
if(_start <= now && now <= _end)
return true;
else
return false;
}

string CTimeControl::ToString()
{
string tradingScheduleName = "Trading schedule ";

tradingScheduleName += (scheduleID != 0)
? (string)scheduleID+" "
: "";

if(IsScheduleEnabled())
{
return tradingScheduleName+"ON ("+this.start+" to "+this.end+") | trading "+(IsTradingTimeValid()
? "enabled"
: "disabled");
}
else
{
return tradingScheduleName+"NOT USED";
}
}

void CTimeControl::StringToHHMM(string value, int &HH, int &MM)
{
MqlDateTime temp;
Expand All @@ -73,4 +148,46 @@ void CTimeControl::StringToHHMM(string value, int &HH, int &MM)

HH = temp.hour;
MM = temp.min;
}
}

bool CTimeControl::StringToHHMMRange(string value, int &_startHH, int &_startMM, string& _start, int &_endHH, int &_endMM, string& _end)
{
string result[];
int count = StringSplit(value, '-', result);
if(count != 2)
return false;

MqlDateTime temp;
TimeToStruct(TimeCurrent(),temp);

// Start time
_start = result[0];
datetime fullDateTime = StringToTime((string)temp.year+"."+(string)temp.mon+"."+(string)temp.day+" "+_start);
TimeToStruct(fullDateTime,temp);

startHH = temp.hour;
startMM = temp.min;

// End time
TimeToStruct(TimeCurrent(),temp);
_end = result[1];
fullDateTime = StringToTime((string)temp.year+"."+(string)temp.mon+"."+(string)temp.day+" "+_end);
TimeToStruct(fullDateTime,temp);

endHH = temp.hour;
endMM = temp.min;

return true;
}

void CTimeControl::SetScheduleState()
{
if(this.startHH == 0 && this.startMM == 0 && this.endHH == 0 && this.endMM == 0)
{
scheduleEnabled = false;
}
else
{
scheduleEnabled = true;
}
}
1 change: 1 addition & 0 deletions Include/AZ-INVEST/SDK/TradeFunctions.mqh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright 2017-2021, Artur Zas
// GNU General Public License v3.0 -> https://github.com/9nix6/Median-and-Turbo-Renko-indicator-bundle/blob/master/LICENSE
// https://www.az-invest.eu
// https://www.mql5.com/en/users/arturz
//
Expand Down
1 change: 1 addition & 0 deletions Include/AZ-INVEST/SDK/TradeManager.mqh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright 2018-2021, Artur Zas
// GNU General Public License v3.0 -> https://github.com/9nix6/Median-and-Turbo-Renko-indicator-bundle/blob/master/LICENSE
// https://www.az-invest.eu
// https://www.mql5.com/en/users/arturz
//
Expand Down
4 changes: 2 additions & 2 deletions Include/AZ-INVEST/SDK/VolumeBarChart.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ int TickChart::Init()
s.barSizeInVolume,
s.algorithm,
s.showNumberOfDays,
s.showFromDate,
s.resetOpenOnNewTradingDay,
"=",
als.showPivots,
Expand Down Expand Up @@ -264,8 +265,7 @@ int TickChart::Init()
cis.ChannelAppliedPrice,
cis.ChannelMultiplier,
cis.ChannelBandsDeviations,
cis.ChannelPriceLabel,
cis.ChannelMidPriceLabel,
cis.ChannelPriceLabels,
"=",
true); // used in EA
// TopBottomPaddingPercentage,
Expand Down
4 changes: 4 additions & 0 deletions Include/AZ-INVEST/SDK/VolumeCustomChartSettings.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@
input int InpBarSizeInVolume = 1000; // Bar size
input ENUM_VOLUME_CHART_CALCULATION InpAlgorithm = VOLUME_CHART_USE_TICKS; // Operating mode
input int InpShowNumberOfDays = 5; // Show history for number of days
input datetime InpShowFromDate = 0; // Show history starting from
input ENUM_BOOL InpResetOpenOnNewTradingDay = true; // Synchronize first bar's open on new day

#endif
#else // don't SHOW_INDICATOR_INPUTS
int InpBarSizeInVolume = 1000; // Bar size
ENUM_VOLUME_CHART_CALCULATION InpAlgorithm = VOLUME_CHART_USE_TICKS; // Operating mode
int InpShowNumberOfDays = 5; // Show history for number of days
datetime InpShowFromDate = 0; // Show history starting from
ENUM_BOOL InpResetOpenOnNewTradingDay = true; // Synchronize first bar's open on new day
#endif

Expand All @@ -56,6 +58,7 @@ struct VOLUMECHART_SETTINGS
int barSizeInVolume;
ENUM_VOLUME_CHART_CALCULATION algorithm;
int showNumberOfDays;
datetime showFromDate;
ENUM_BOOL resetOpenOnNewTradingDay;
};

Expand Down Expand Up @@ -107,5 +110,6 @@ void CVolumeCustomChartSettigns::SetCustomChartSettings()
settings.barSizeInVolume = InpBarSizeInVolume;
settings.algorithm = InpAlgorithm;
settings.showNumberOfDays = InpShowNumberOfDays;
settings.showFromDate = InpShowFromDate;
settings.resetOpenOnNewTradingDay = InpResetOpenOnNewTradingDay;
}
Binary file modified Indicators/TickChart/ADX Cross Alerts.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/ADX.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/ATP.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/ATR.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/AroonOscillator.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/AwesomeOscillator.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/BB_MACD.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/BollingerBandsMacd.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/CCI(alternative).ex5
Binary file not shown.
Binary file modified Indicators/TickChart/CCI.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/ChaikinVolatility.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/ColorHMA.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/DT_Oscillator.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/DidiIndex.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/DonchianChannel.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Envelopes.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Fractals.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/GMMA.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Gann_Hi_Lo_Activator.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Gann_Hi_Lo_Activator_SSL.ex5
Binary file not shown.
64 changes: 43 additions & 21 deletions Indicators/TickChart/Gann_Hi_Lo_Activator_SSL.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
#property indicator_color1 clrDodgerBlue, clrOrangeRed
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2
#property indicator_label1 "GHL (13, SMMA)"
#property indicator_label1 "GHL_SSL"
//--- input parameters
input uint InpPeriod=13; // Period
input ENUM_MA_METHOD InpMethod=MODE_SMMA;// Method
input uint InpPeriod=10; // Period
input ENUM_MA_METHOD InpMethod=MODE_SMA;// Method
//--- buffers
double GannBuffer[];
double ColorBuffer[];
double MaHighBuffer[];
double MaLowBuffer[];
double TrendBuffer[];
//--- global vars
int ma_high_handle;
int ma_low_handle;
int period;
//int ma_high_handle;
//int ma_low_handle;
int _period;

//

#include <MovingAverages.mqh>
#include <AZ-INVEST/CustomBarConfig.mqh>

//
Expand All @@ -43,7 +43,7 @@ int period;
int OnInit()
{
//--- check period
period=(int)fmax(InpPeriod,2);
_period=(int)fmax(InpPeriod,2);
//--- set buffers
SetIndexBuffer(0,GannBuffer);
SetIndexBuffer(1,ColorBuffer,INDICATOR_COLOR_INDEX);
Expand All @@ -57,19 +57,19 @@ int OnInit()
ArraySetAsSeries(MaLowBuffer,true);
ArraySetAsSeries(TrendBuffer,true);
//--- get handles
ma_high_handle=iMA(NULL,0,period,0,InpMethod,PRICE_HIGH);
ma_low_handle =iMA(NULL,0,period,0,InpMethod,PRICE_LOW);
if(ma_high_handle==INVALID_HANDLE || ma_low_handle==INVALID_HANDLE)
{
Print("Unable to create handle for iMA");
return(INIT_FAILED);
}
//ma_high_handle=iMA(NULL,0,_period,0,InpMethod,PRICE_HIGH);
//ma_low_handle =iMA(NULL,0,_period,0,InpMethod,PRICE_LOW);
//if(ma_high_handle==INVALID_HANDLE || ma_low_handle==INVALID_HANDLE)
// {
// Print("Unable to create handle for iMA");
// return(INIT_FAILED);
// }
//--- set indicator properties
string short_name=StringFormat("Gann High-Low Activator SSL (%u, %s)",period,StringSubstr(EnumToString(InpMethod),5));
string short_name=StringFormat("Gann High-Low Activator SSL (%u, %s)",_period,StringSubstr(EnumToString(InpMethod),5));
IndicatorSetString(INDICATOR_SHORTNAME,short_name);
IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//--- set label
short_name=StringFormat("GHL (%u, %s)",period,StringSubstr(EnumToString(InpMethod),5));
short_name=StringFormat("GHL (%u, %s)",_period,StringSubstr(EnumToString(InpMethod),5));
PlotIndexSetString(0,PLOT_LABEL,short_name);
//--- done
return(INIT_SUCCEEDED);
Expand All @@ -89,7 +89,7 @@ int OnCalculate(const int rates_total,
const int &spread[])
{

if(rates_total<period+1)return(0);
//if(rates_total<_period+1)return(0);

//
// Process data through MedianRenko indicator
Expand Down Expand Up @@ -135,7 +135,7 @@ int OnCalculate(const int rates_total,
int limit;
if(rates_total<_prev_calculated || _prev_calculated<=0)
{
limit=rates_total-period-1;
limit=rates_total-_period-1;
ArrayInitialize(GannBuffer,EMPTY_VALUE);
ArrayInitialize(ColorBuffer,0);
ArrayInitialize(MaHighBuffer,0);
Expand All @@ -145,8 +145,30 @@ int OnCalculate(const int rates_total,
else
limit=rates_total-_prev_calculated;
//--- get MA
if(CopyBuffer(ma_high_handle,0,0,limit+1,MaHighBuffer)!=limit+1)return(0);
if(CopyBuffer(ma_low_handle,0,0,limit+1,MaLowBuffer)!=limit+1)return(0);
//if(CopyBuffer(ma_high_handle,0,0,limit+1,MaHighBuffer)!=limit+1)return(0);
//if(CopyBuffer(ma_low_handle,0,0,limit+1,MaLowBuffer)!=limit+1)return(0);

switch(InpMethod)
{
case MODE_SMA:
SimpleMAOnBuffer(rates_total, _prev_calculated, 0, _period, customChartIndicator.High, MaHighBuffer);
SimpleMAOnBuffer(rates_total, _prev_calculated, 0, _period, customChartIndicator.Low, MaLowBuffer);
break;
case MODE_EMA:
ExponentialMAOnBuffer(rates_total, _prev_calculated, 0, _period, customChartIndicator.High, MaHighBuffer);
ExponentialMAOnBuffer(rates_total, _prev_calculated, 0, _period, customChartIndicator.Low, MaLowBuffer);
break;
case MODE_SMMA:
SmoothedMAOnBuffer(rates_total, _prev_calculated, 0, _period, customChartIndicator.High, MaHighBuffer);
SmoothedMAOnBuffer(rates_total, _prev_calculated, 0, _period, customChartIndicator.Low, MaLowBuffer);
break;
case MODE_LWMA:
LinearWeightedMAOnBuffer(rates_total, _prev_calculated, 0, _period, customChartIndicator.High, MaHighBuffer);
LinearWeightedMAOnBuffer(rates_total, _prev_calculated, 0, _period, customChartIndicator.Low, MaLowBuffer);
break;
}


//--- main cycle
for(int i=limit; i>=0 && !_StopFlag; i--)
{
Expand Down
Binary file modified Indicators/TickChart/HA_Smoothed.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/HalfTrend.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Heiken_Ashi.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Ichimoku.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/KeltnerChannel.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/LRMA.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/LinearRegression.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/MA.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/MACD.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/MACD_Line.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Momentum.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/NRTR.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/OBV.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/OscillatorCandles.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/ParabolicSAR.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/ProVolume.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/QQE.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/ROC.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/RSI.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/RVI.ex5
Binary file not shown.
Binary file added Indicators/TickChart/SchaffTrendCycle.ex5
Binary file not shown.
Binary file added Indicators/TickChart/SchaffTrendCycle.mq5
Binary file not shown.
Binary file modified Indicators/TickChart/StdDev.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Stochastic.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/T3.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/TDI.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/TMA_CenteredBands.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/TRIX.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/TimeLine.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/VEMA_Wilders_DMI.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/VWAP_lite.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Volatility.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Volume_Average_percent.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/Volumes.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/WPR.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/WeisWaves.ex5
Binary file not shown.
Binary file modified Indicators/TickChart/ZigZag.ex5
Binary file not shown.

0 comments on commit 94059ea

Please sign in to comment.