Questions from a "dummy" - page 6

 
pusheax:

Some DCs in real accounts assign all sorts of prefixes like "." or "FXF" to symbol names.

How can I use these prefixes?

I did so:

#define DEF_SPEC "FXF"

string SymbolsTrade[] = {"AUDCAD "DEF_SPEC ... -does not work

string SymbolsTrade[] = {"AUDCAD "+DEF_SPEC ... -it doesn't work like that either

all I get is FXF instead of the required AUDCADFXF.

Could you tell me how to implement this?


First, filling of an array with enumeration is only possible in the global scope, so no + will work there, only string constants.

Secondly, you have a static array that is not distributed, while a dynamic array cannot be filled with an enum.

The easiest way is to write a function that distributes and fills a dynamic array, it can do everything, add definitions to constants, etc.

 
Urain:

First, filling an array with an enumeration is only possible in the global scope, so no + will work there, only string constants.

Secondly, you have not distributed static array, and dynamic array cannot be filled by enumeration.

The easiest way is to write a function that distributes and fills the dynamic array, it can do everything, add definitions with constants, etc.

You can also try to search all currency pairs existing in BC/BROKER and analyze composite currencies in them.

After that you can create a dynamic array of currency pairs taking into account adding any prefixes.

As far as I remember it is one of the universal options for MT5.

 
Urain:

First, filling an array with an enumeration is only possible in the global scope, so no + will work there, only string constants.

Secondly, you have not distributed static array, and dynamic array cannot be filled by enumeration.

The easiest way is to write a function that will distribute and fill the dynamic array, it can do everything, add definitions to constants, etc.

In short, if I understood you correctly, you can't create a static string array of compound constants in the global scope, right?

 
uncleVic:

You can see the code in the source code. Two methods are used to find the divergence:

1. The bool CSignalMACD::ExtState(int ind) method prepares data for searching;

2. The bool CSignalMACD::CompareMaps(int map,int count,bool minimax,int start) method looks for a market model with the specified parameters.

If it helps, here are comments to the methods in Russian:

For the bool CSignalMACD::ExtState(int ind) method

For the method bool CSignalMACD::CompareMaps(int map,int count,bool minimax,int start)

I also have a question - how to specify the divergence variant when creating an Expert Advisor using the MACD signal? There are several versions of the signal in the reference book.
 
strelec:
I also have a question, how to specify the divergence variant when creating an Expert Advisor using MACD signal? There are several variants of signals in the manual.

As everyone has already noticed, any signal can detect multiple market patterns. To control usage of patterns , call PatternsUsage(int value) method, where value is bit map of pattern usage (bit number and pattern number are the same). Bit is 1 - model is used, bit is 0 - model is not used (by default all bits are 1). The numbering of models as well as bits starts at 0.

Thus, if you want to use only divergence, you should use PatternsUsage(16);. Why 16? 16 is binary 10000b (i.e. bit 4 is 1, all other bits are 0). And just model 4 "divergence of the oscillator and price".

The only "but", you will have to do it "manually".

After completion of the Wizard, the source code will be opened in the editor. Find a place like this in the editor:

//--- Creating filter CSignalMACD
   CSignalMACD *filter0=new CSignalMACD;
   if(filter0==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating filter0");
      ExtExpert.Deinit();
      return(-3);
     }
   signal.AddFilter(filter0);
//--- Set filter parameters
   filter0.PeriodFast(Signal_MACD_PeriodFast);
   filter0.PeriodSlow(Signal_MACD_PeriodSlow);
   filter0.PeriodSignal(Signal_MACD_PeriodSignal);
   filter0.Applied(Signal_MACD_Applied);
   filter0.Weight(Signal_MACD_Weight);

and add one line

filter0.PatternsUsage(16);

you'll get it:

//--- Creating filter CSignalMACD
   CSignalMACD *filter0=new CSignalMACD;
   if(filter0==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating filter0");
      ExtExpert.Deinit();
      return(-3);
     }
   signal.AddFilter(filter0);
//--- Set filter parameters
   filter0.PatternsUsage(16);
   filter0.PeriodFast(Signal_MACD_PeriodFast);
   filter0.PeriodSlow(Signal_MACD_PeriodSlow);
   filter0.PeriodSignal(Signal_MACD_PeriodSignal);
   filter0.Applied(Signal_MACD_Applied);
   filter0.Weight(Signal_MACD_Weight);

That's all for now. If you have any questions, feel free to contact me.

 
uncleVic:

As everyone has already noticed, any signal can detect multiple market patterns. To control the use of patterns , call the PatternsUsage(int value) method, where value is the bit map of pattern usage (bit number and pattern number are the same). Bit is 1 - model is used, bit is 0 - model is not used (by default all bits are 1). Model numbering as well as bits start from 0.

So if you only want to use divergence you need to use PatternsUsage(16);. Why 16? 16 is 10000b in binary (i.e. bit 4 is 1, the other bits are 0). And just model 4 "divergence of the oscillator and price".

The only "but", you will have to do it "manually".

After completion of the Wizard, the source code will be opened in the editor. Find a place like this in the editor:

and add one line

filter0.PatternsUsage(16);

you get:

That's all for now. If you have any questions, feel free to contact me.

Thank you. Got it. And there are more questions right away. In this variant of divergence, what time interval between neighbouring peaks (troughs) is taken into account?
 
strelec:
Thank you. It worked. And there are more questions right away. In this variant of divergence, what time interval between neighboring tops (troughs) is taken into account?
The interval is not analyzed.
 

I have an expert with which I try to deal with events.

string event[10]=
{
"CHARTEVENT_KEYDOWN - событие нажатия клавиатуры, когда окно графика находится в фокусе",
"CHARTEVENT_OBJECT_CREATE — событие создания графического объекта",
"CHARTEVENT_OBJECT_CHANGE — событие изменения свойств объекта через диалог свойств",
"CHARTEVENT_OBJECT_DELETE — событие удаления графического объекта",
"CHARTEVENT_CLICK — cобытие щелчка мыши графике",
"CHARTEVENT_OBJECT_CLICK — событие щелчка мыши на графическом объекте, принадлежащего графику",
"CHARTEVENT_OBJECT_DRAG — событие перемещения графического объекта при помощи мыши",
"CHARTEVENT_OBJECT_ENDEDIT — событие окончания редактирования текста в поле ввода графического объекта LabelEdit",
"CHARTEVENT_CHART_CHANGE  — событие изменения графика",
"CHARTEVENT_CUSTOM+n — идентификатор пользовательского события, где n находится в диапазоне от 0 до 65535"
};
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   Print("id=(",id,") -- ",event[id],"  lparam=",lparam,"   dparam=",dparam,"   sparam=", sparam);
  }
//+------------------------------------------------------------------+

I get events that do not correspond to actions.

Exactly corresponding to a click on the chart and a click of a button

A controversial event id=9(CHARTEVENT_CUSTOM), that is generated when e.g. the chart is shifted and there are about 10 similar events.

TheCHARTEVENT_OBJECT_ENDEDIT event was not checked.

Everything is not clear with all the rest. Either the description does not match the event number or the event of creating an object is generated incorrectly when creating the object manually.

In general, please help.

 
kPVT:

I have an expert with which I try to deal with events.

I get events that do not correspond to actions.

Exactly matches a click on the chart and a click of a button

A controversial event id=9(CHARTEVENT_CUSTOM), that is generated when e.g. the chart is shifted and there are about 10 similar events.

TheCHARTEVENT_OBJECT_ENDEDIT event was not checked.

All the rest are not clear. Either the description does not match the event number or the event of creating an object is generated incorrectly when creating the object manually.

All in all, please help.

You initially assign numeric correspondences to already assigned numeric constants CHARTEVENT_XXXXXXXX...

the problem is this:

event[id]

you need to:

//--- нажатие мышкой на графическом объекте
   if(id==CHARTEVENT_OBJECT_CLICK)
     {
      Print("Нажатие кнопки мышки на объекте с именем '"+sparam+"'");
     }
//--- нажатие кнопки на клавиатуре
   if(id==CHARTEVENT_KEYDOWN)
     {
 
kPVT:

The others are not clear. Either the description doesn't match the event number, or the event of e.g. object creation is not generated correctly when the object is created manually.

Unfortunately, your question is not clear. What exactly is going wrong?

Reason: