version 3.14

This commit is contained in:
Artur
2021-04-28 17:27:12 +02:00
parent a73e2c0713
commit 380071b195
131 changed files with 5283 additions and 235 deletions
+52
View File
@@ -0,0 +1,52 @@
//#define DEVELOPER_VERSION
//#define DISPLAY_DEBUG_MSG
#define MQL5_MARKET_VERSION
//#define P_RENKO_BR_PRO
//#define ULTIMATE_RENKO_LICENSE
#define RANGEBAR_LICENSE
//#define SECONDSCHART_LICENSE
//#define TICKCHART_LICENSE (obsolete)
//#define VOLUMECHART_LICENSE
//#define LINEBREAKCHART_LICENSE
#ifdef P_RENKO_BR_PRO
#include <AZ-INVEST/SDK/MedianRenkoIndicator.mqh>
#define AZINVEST_CCI MedianRenkoIndicator
#endif
#ifdef TICKCHART_LICENSE
#include <AZ-INVEST/SDK/TickChartIndicator.mqh>
#define AZINVEST_CCI TickChartIndicator
#endif
#ifdef RANGEBAR_LICENSE
#include <AZ-INVEST/SDK/RangeBarIndicator.mqh>
#define AZINVEST_CCI RangeBarIndicator
#endif
#ifdef ULTIMATE_RENKO_LICENSE
#include <AZ-INVEST/SDK/MedianRenkoIndicator.mqh>
#define AZINVEST_CCI MedianRenkoIndicator
#endif
#ifdef SECONDSCHART_LICENSE
#include <AZ-INVEST/SDK/SecondsChartIndicator.mqh>
#define AZINVEST_CCI SecondsChartIndicator
#endif
#ifdef VOLUMECHART_LICENSE
#include <AZ-INVEST/SDK/VolumeChartIndicator.mqh>
#define AZINVEST_CCI VolumeChartIndicator
#endif
#ifdef LINEBREAKCHART_LICENSE
#include <AZ-INVEST/SDK/LineBreakChartIndicator.mqh>
#define AZINVEST_CCI LineBreakChartIndicator
#endif
#ifdef AZINVEST_CCI
AZINVEST_CCI customChartIndicator;
#endif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+83
View File
@@ -0,0 +1,83 @@
// RSI on Buffer
int RsiOnBuffer(const int rates_total,const int prev_calculated,const int begin,
const int period,const double& price[],double& rsiBuffer[], double &posBuffer[], double &negBuffer[])
{
int i, pos;
double diff;
//--- check for data
if(period<=1 || rates_total-begin<period) return(0);
//--- save as_series flags
bool as_series_price=ArrayGetAsSeries(price);
bool as_series_rsibuffer=ArrayGetAsSeries(rsiBuffer);
bool as_series_posbuffer=ArrayGetAsSeries(posBuffer);
bool as_series_negbuffer=ArrayGetAsSeries(negBuffer);
if(as_series_price) ArraySetAsSeries(price,false);
if(as_series_rsibuffer) ArraySetAsSeries(rsiBuffer,false);
if(as_series_posbuffer) ArraySetAsSeries(posBuffer,false);
if(as_series_negbuffer) ArraySetAsSeries(negBuffer,false);
//--- preliminary calculations
pos=prev_calculated-1;
if(pos<=period)
{
//--- first RSIPeriod values of the indicator are not calculated
rsiBuffer[0]=0.0;
posBuffer[0]=0.0;
negBuffer[0]=0.0;
double sump=0.0;
double sumn=0.0;
for(i=1; i<=period; i++)
{
rsiBuffer[i]=0.0;
posBuffer[i]=0.0;
negBuffer[i]=0.0;
diff=price[i]-price[i-1];
if(diff>0)
sump+=diff;
else
sumn-=diff;
}
//--- calculate first visible value
posBuffer[period]=sump/period;
negBuffer[period]=sumn/period;
if(negBuffer[period]!=0.0)
rsiBuffer[period]=100.0-(100.0/(1.0+posBuffer[period]/negBuffer[period]));
else
{
if(posBuffer[period]!=0.0)
rsiBuffer[period]=100.0;
else
rsiBuffer[period]=50.0;
}
//--- prepare the position value for main calculation
pos=period+1;
}
//--- the main loop of calculations
for(i=pos; i<rates_total && !IsStopped(); i++)
{
diff=price[i]-price[i-1];
posBuffer[i]=(posBuffer[i-1]*(period-1)+(diff>0.0?diff:0.0))/period;
negBuffer[i]=(negBuffer[i-1]*(period-1)+(diff<0.0?-diff:0.0))/period;
if(negBuffer[i]!=0.0)
rsiBuffer[i]=100.0-100.0/(1+posBuffer[i]/negBuffer[i]);
else
{
if(posBuffer[i]!=0.0)
rsiBuffer[i]=100.0;
else
rsiBuffer[i]=50.0;
}
}
//--- restore as_series flags
if(as_series_price) ArraySetAsSeries(price,true);
if(as_series_rsibuffer) ArraySetAsSeries(rsiBuffer,true);
if(as_series_posbuffer) ArraySetAsSeries(posBuffer,true);
if(as_series_negbuffer) ArraySetAsSeries(negBuffer,true);
//---
return(rates_total);
}
//+------------------------------------------------------------------+
@@ -23,13 +23,16 @@
#else // user defined settings
input int barSizeInTicks = 100; // Range bar size (in ticks)
input int barSizeInTicks = 100; // Range bar size (in ticks)
input int showNumberOfDays = 5; // Show history for number of days
input group "### ATR based bar size calculation"
input ENUM_BOOL atrEnabled = false; // Enable ATR based bar size calculation
ENUM_TIMEFRAMES atrTimeFrame = PERIOD_D1; // Use ATR period
input ENUM_TIMEFRAMES atrTimeFrame = PERIOD_D1; // Use ATR period
input int atrPeriod = 14; // ATR period
input int atrPercentage = 10; // Use percentage of ATR
input int showNumberOfDays = 5; // Show history for number of days
input group "### Chart synchronization"
input ENUM_BOOL resetOpenOnNewTradingDay = true; // Synchronize first bar's open on new day
#endif
+19 -14
View File
@@ -4,7 +4,15 @@
#ifdef DEVELOPER_VERSION
#define RANGEBAR_INDICATOR_NAME "RangeBars\\RangeBarsOverlay300"
#else
#define RANGEBAR_INDICATOR_NAME "Market\\Range Bars Charting"
#ifdef RANGEBAR_LICENSE
#ifdef MQL5_MARKET_VERSION
#define RANGEBAR_INDICATOR_NAME "Market\\Range Bars Charting"
#else
#define RANGEBAR_INDICATOR_NAME "RangeBars"
#endif
#else
#define RANGEBAR_INDICATOR_NAME "Market\\Range Bars Charting"
#endif
#endif
#define RANGEBAR_OPEN 00
@@ -188,50 +196,46 @@ int RangeBars::Init()
rangeBarsHandle = iCustom(this.rangeBarsSymbol, _Period, RANGEBAR_INDICATOR_NAME,
s.barSizeInTicks,
s.showNumberOfDays,
"=",
s.atrEnabled,
//s.atrTimeFrame,
s.atrTimeFrame,
s.atrPeriod,
s.atrPercentage,
s.showNumberOfDays, s.resetOpenOnNewTradingDay,
TradingSessionTime,
"=",
s.resetOpenOnNewTradingDay,
"=",
showPivots,
pivotPointCalculationType,
RColor,
PColor,
SColor,
PDHColor,
PDLColor,
PDCColor,
"=",
AlertMeWhen,
AlertNotificationType,
cis.MA1on,
"=",
cis.MA1lineType,
cis.MA1period,
cis.MA1method,
cis.MA1applyTo,
cis.MA1shift,
cis.MA1priceLabel,
cis.MA2on,
cis.MA2lineType,
cis.MA2period,
cis.MA2method,
cis.MA2applyTo,
cis.MA2shift,
cis.MA2priceLabel,
cis.MA3on,
cis.MA3lineType,
cis.MA3period,
cis.MA3method,
cis.MA3applyTo,
cis.MA3shift,
cis.MA3priceLabel,
cis.MA4on,
cis.MA4lineType,
cis.MA4period,
cis.MA4method,
cis.MA4applyTo,
cis.MA4shift,
cis.MA4priceLabel,
"=",
cis.ShowChannel,
cis.ChannelPeriod,
cis.ChannelAtrPeriod,
@@ -240,6 +244,7 @@ int RangeBars::Init()
cis.ChannelBandsDeviations,
cis.ChannelPriceLabel,
cis.ChannelMidPriceLabel,
"=",
true); // used in EA
// TopBottomPaddingPercentage,
// showCurrentBarOpenTime,
+76
View File
@@ -0,0 +1,76 @@
//
// Copyright 2018-19, Artur Zas
// https://www.az-invest.eu
// https://www.mql5.com/en/users/arturz
//
class CTimeControl
{
private:
int startHH;
int startMM;
string start;
int endHH;
int endMM;
string end;
bool scheduleEnabled;
public:
void SetValidTraingHours(string _from = "0:00", string _to = "0:00");
bool IsTradingTimeValid();
bool IsScheduleEnabled() { return scheduleEnabled; };
void StringToHHMM(string value, int &HH, int &MM);
};
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);
if(this.startHH == 0 && this.startMM == 0 && this.endHH == 0 && this.endMM == 0)
{
scheduleEnabled = false;
}
else
{
scheduleEnabled = true;
}
}
bool CTimeControl::IsTradingTimeValid()
{
if(scheduleEnabled == false)
return true;
datetime now = TimeCurrent();
MqlDateTime temp;
TimeToStruct(now,temp);
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))
return true;
else
return false;
}
void CTimeControl::StringToHHMM(string value, int &HH, int &MM)
{
MqlDateTime temp;
TimeToStruct(TimeCurrent(),temp);
datetime fullDateTime = StringToTime((string)temp.year+"."+(string)temp.mon+"."+(string)temp.day+" "+value);
TimeToStruct(fullDateTime,temp);
HH = temp.hour;
MM = temp.min;
}