UTE/Strategy/Series.mqh

156 lines
11 KiB
MQL5
Raw Permalink Normal View History

2025-05-30 16:34:43 +02:00
<EFBFBD><EFBFBD>//+------------------------------------------------------------------+
//| Series.mqh |
//| Copyright 2016, Vasiliy Sokolov, St-Petersburg, Russia |
//| https://www.mql5.com/ru/users/c-4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, Vasiliy Sokolov."
#property link "https://www.mql5.com/ru/users/c-4"
//+------------------------------------------------------------------+
//| >ABC? : :>B8@>2:0< =5>1E>48<><>3> 8=AB@C<5=B0 8 B09<D@59<0. |
//+------------------------------------------------------------------+
class CBaseRates
{
protected:
string m_symbol;
ENUM_TIMEFRAMES m_timeframe;
CBaseRates(void);
public:
string Symbol(void);
ENUM_TIMEFRAMES Timeframe(void);
void Symbol(string symbol);
void Timeframe(ENUM_TIMEFRAMES tf);
int Total(void);
};
//+------------------------------------------------------------------+
//| >=AB@C:B>@ ?> C<>;G0=8N. |
//+------------------------------------------------------------------+
CBaseRates::CBaseRates(void)
{
}
//+------------------------------------------------------------------+
//| >72@0I05B A8<2>; A5@88. |
//+------------------------------------------------------------------+
string CBaseRates::Symbol(void)
{
return m_symbol;
}
//+------------------------------------------------------------------+
//| #AB0=02;8205B A8<2>; A5@88. |
//+------------------------------------------------------------------+
void CBaseRates::Symbol(string symbol)
{
m_symbol=symbol;
}
//+------------------------------------------------------------------+
//| >72@0I05B B09<D@59< 8=AB@C<5=B0. |
//+------------------------------------------------------------------+
ENUM_TIMEFRAMES CBaseRates::Timeframe(void)
{
return m_timeframe;
}
//+------------------------------------------------------------------+
//| #AB0=02;8205B B09<D@59< 8=AB@C<5=B0. |
//+------------------------------------------------------------------+
void CBaseRates::Timeframe(ENUM_TIMEFRAMES tf)
{
m_timeframe=tf;
}
//+------------------------------------------------------------------+
//| >72@0I05B 4>ABC?=>5 :>;8G5AB2> 10@>2. |
//+------------------------------------------------------------------+
int CBaseRates::Total(void)
{
return Bars(m_symbol, m_timeframe);
}
//+------------------------------------------------------------------+
//| >ABC? : F5=0< >B:@KB8O =5>1E>48<><>3> 8=AB@C<5=B0 8 B09<D@59<0. |
//+------------------------------------------------------------------+
class COpen : public CBaseRates
{
public:
double operator[](int index)
{
double value[];
if(CopyOpen(m_symbol, m_timeframe, index, 1, value) == 0)return 0.0;
return value[0];
}
};
//+------------------------------------------------------------------+
//| >ABC? : <0:A8<0;L=K< F5=0< 10@0 8=AB@C<5=B0. |
//+------------------------------------------------------------------+
class CHigh : public CBaseRates
{
public:
double operator[](int index)
{
double value[];
if(CopyHigh(m_symbol, m_timeframe, index, 1, value) == 0)return 0.0;
return value[0];
}
};
//+------------------------------------------------------------------+
//| >ABC? : <8=8<0;L=K< F5=0< 10@0 8=AB@C<5=B0. |
//+------------------------------------------------------------------+
class CLow : public CBaseRates
{
public:
double operator[](int index)
{
double value[];
if(CopyLow(m_symbol, m_timeframe, index, 1, value) == 0)return 0.0;
return value[0];
}
};
//+------------------------------------------------------------------+
//| >ABC? : F5=0< 70:@KB8O 10@0 8=AB@C<5=B0. |
//+------------------------------------------------------------------+
class CClose : public CBaseRates
{
public:
double operator[](int index)
{
double value[];
if(CopyClose(m_symbol, m_timeframe, index, 1, value) == 0)return 0.0;
return value[0];
}
};
//+------------------------------------------------------------------+
//| >ABC? : @50;L=K< >1J5<0< 10@0 8=AB@C<5=B0. |
//+------------------------------------------------------------------+
class CVolume : public CBaseRates
{
public:
long operator[](int index)
{
long value[];
if(CopyRealVolume(m_symbol, m_timeframe, index, 1, value) == 0)return 0;
return value[0];
}
};
//+------------------------------------------------------------------+
//| >ABC? : B8:>2K< >1J5<0< 10@0 8=AB@C<5=B0. |
//+------------------------------------------------------------------+
class CTickVolume : public CBaseRates
{
public:
long operator[](int index)
{
long value[];
if(CopyTickVolume(m_symbol, m_timeframe, index, 1, value) == 0)return 0;
return value[0];
}
};
//+------------------------------------------------------------------+
//| >ABC? : 2@5<5=8 >B:@KB8O 10@>2. |
//+------------------------------------------------------------------+
class CTime : public CBaseRates
{
public:
datetime operator[](int index)
{
datetime value[];
if(CopyTime(m_symbol, m_timeframe, index, 1, value) == 0)return 0;
return value[0];
}
};