There are errors in the last part of the initialization code (in bold)
'InitMyCustomIndicator' - the function must have a body
'InitClose' - function must have a body
//| включаемые файлы |//+------------------------------------------------------------------+
#property tester_indicator "Blau_Ergodic.ex5"
#include <Expert\ExpertSignal.mqh>
//+------------------------------------------------------------------+//| Класс CSampleSignal. |//| Назначение: Класс генератора торговых сигналов. |//| Является производным от класса CExpertSignal. |//+------------------------------------------------------------------+class CSampleSignal : public CExpertSignal
{
protected:
CiCustom m_TSI; // объект для доступа к значениям TSI
CiClose m_close; // объект для доступа к ценам закрытия баров//--- настраиваемые параметрыint q; // q - период, по которому вычисляется моментумint r; // r - период 1-й EMA, применительно к моментумуint s; // s - период 2-й EMA, применительно к результату первого сглаживанияint u; // u - период 3-й EMA, применительно к результату второго сглаживанияint ul; // ul - (сигнальная линия) период EMA, применительно к эргодикеdouble m_stop_loss; // уровень установки ордера "stop loss" относительно цены открытияdouble m_take_profit; // уровень установки ордера "take profit" относительно цены открытияpublic:
CSampleSignal();
//--- методы установки параметров настройкиvirtualint ShortCondition(); // проверка условия открытия селлаvirtualint LongCondition(); // проверка условия открытия баяvoid Q(intvalue) { q=value; }
void R(intvalue) { r=value; }
void S(intvalue) { s=value; }
void U(intvalue) { u=value; }
void UL(intvalue) { ul=value; }
void StopLoss(doublevalue) { m_stop_loss=value; }
void TakeProfit(doublevalue) { m_take_profit=value; }
//--- метод проверки параметров настройкиvirtualbool ValidationSettings();
virtualbool InitIndicators(CIndicators* indicators);
protected:
//--- метод инициализации объектовbool InitMyCustomIndicator(CIndicators* indicators);
bool InitClose(CIndicators* indicators);
//--- методы доступа к данным объектовdouble Main(int index) { return(m_TSI.GetData(0,index)); }
double Signal(int index) { return(m_TSI.GetData(1,index)); }
double Close(int index) { return(m_close.GetData(index)); }
};
//+------------------------------------------------------------------+//| Конструктор CSampleSignal. |//| INPUT: нет. |//| OUTPUT: нет. |//| REMARK: нет. |//+------------------------------------------------------------------+void CSampleSignal::CSampleSignal()
{
q=2;
r=7;
s=5;
u=3;
ul=5;
}
//+------------------------------------------------------------------+//| Проверка параметров настройки. |//| INPUT: нет. |//| OUTPUT: true-если настройки правильные, иначе false. |//| REMARK: нет. |//+------------------------------------------------------------------+bool CSampleSignal::ValidationSettings()
{
//--- проверка параметровif(q<=0||r<=0||s<=0||u<=0||ul<=0)
{
printf(__FUNCTION__+": период должен быть больше нуля");
return(false);
}
//--- успешное завершениеreturn(true);
}
//+------------------------------------------------------------------+//| Инициализация индикаторов и таймсерий. |//| INPUT: indicators - указатель на объект-коллекцию |//| индикаторов и таймсерий. |//| OUTPUT: true-в случае успешного завершения, иначе false. |//| REMARK: нет. |//+------------------------------------------------------------------+bool CSampleSignal::InitIndicators(CIndicators* indicators)
{
//--- проверка указателяif(indicators==NULL) return(false);
//--- инициализация скользящей среднейif(!InitMyCustomIndicator(indicators)) return(false);
//--- инициализация таймсерии цен закрытияif(!InitClose(indicators)) return(false);
//--- успешное завершениеreturn(true);
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
when will metatrader come out on windows phone 8
Continuing to write my trading signal generator.
There are errors in the last part of the initialization code (in bold)
'InitMyCustomIndicator' - the function must have a body
'InitClose' - function must have a body
Continuing to write my trading signal generator.
There are errors in the last part of the initialization code (in bold)
'InitMyCustomIndicator' - the function must have a body
'InitClose' - function must have a body
You are trying to use methods that are declared but not defined.
Classes are new to me and not really understood. Can you show me how to make a definition with an example.
Classes are new to me and not really understood. Can I use an example to show how to make a definition.
So I only change the last part of the code that I put in bold?
And I do this:
So, I only change the last part of the code that I highlighted in bold?
And I do the following:
If your class code has methods such as:
Then they must check something. Otherwise there is no point in their existence.
Hello!
How do I set up a for loop on bar close prices if I don't know in advance how many bars to check
I need to check a condition, e.g. that the closing prices of i bars backwards, are lower than each other.