Errors, bugs, questions - page 635

 
piero:

tell me what's wrong, I can't figure out what the problem is with the stymie?

It would be desirable to give full logs from the time the scrip is added to the chart until its completion.

There is no clear indication from the above log:

  1. the time when the script was run
  2. is it the same script, not another script with extra logic inside?
  3. is it not in the tester?
 
how to find out how many lines there are in a file... in each line with values separated by ";"
 

I just started to learn Metatrader and MQL5. I am trying to create my own indicator.

I decided to make resistance and support levels based on standard fractal indicator.

I have redesigned some of them and removed or commented many other things. The result is the following code:

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrDeepPink
#property indicator_label1 "Level"
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//---- indicator buffers
double ExtBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialisation function |
//+------------------------------------------------------------------+
void OnInit()
{
//---- indicator buffers mapping
SetIndexBuffer(0,ExtBuffer,INDICATOR_DATA);
IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
// indicator accuracy equal to chart accuracy?
//---- sets first bar from what index will be drawn
// PlotIndexSetInteger(0,PLOT_ARROW,217);
// PlotIndexSetInteger(1,PLOT_ARROW,218);
//---- arrow shifts when drawing
// PlotIndexSetInteger(0,PLOT_ARROW_SHIFT,ExtArrowShift);
// PlotIndexSetInteger(1,PLOT_ARROW_SHIFT,-ExtArrowShift);
//---- sets drawing line empty value--
// PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE);
// PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,EMPTY_VALUE);
//---- initialization done
}
//+------------------------------------------------------------------+
//| Accelerator/Decelerator Oscillator|
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total, // number of input bars
const int prev_calculated, // number of bars processed at previous call
const datetime &Time[],
const double &Open[],
const double &High[],
const double &Low[],
const double &Close[],
const long &TickVolume[],
const long &Volume[],
const int &Spread[])
{
int i,limit;
//---
if(rates_total<5)
return(0);
//---
if(prev_calculated<7)
{
limit=2;
//--- clean up arrays
ArrayInitialize(ExtBuffer,EMPTY_VALUE);
}
else limit=rates_total-5;

for(i=limit;i<rates_total-3 && !IsStopped();i++)
{
//---- Upper Fractal
if(High[i]>High[i+1] && High[i]>High[i+2] && High[i]>=High[i-1] && High[i]>=High[i-2])
ExtBuffer[i]=High[i];
else ExtBuffer[i]=EMPTY_VALUE;

//---- Lower Fractal
if(Low[i]<Low[i+1] && Low[i]<Low[i+2] && Low[i]<=Low[i-1] && Low[i]<=Low[i-2])
ExtBuffer[i]=Low[i];
else ExtBuffer[i]=EMPTY_VALUE;
}
//--- OnCalculate done. Return new prev_calculated.
return(rates_total);
}

//+------------------------------------------------------------------+

No errors when compiling. However, lines (levels) are not drawn.

May you advise what may be the problem?

Документация по MQL5: Основы языка / Препроцессор / Свойства программ (#property)
Документация по MQL5: Основы языка / Препроцессор / Свойства программ (#property)
  • www.mql5.com
Основы языка / Препроцессор / Свойства программ (#property) - Документация по MQL5
 
Raven:

Can you tell me what the problem could be?

at least two points must be on adjacent bars for the line to be visible.

Try

else ExtBuffer[i]=EMPTY_VALUE;//заменить на

else ExtBuffer[i]=ExtBuffer[i-1];

   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
// точность индикатора равна точности графика??

Yes.


Rz: for the code on the forum is a great button SRC, use it)

 

an error occurs when sending an order... What may be the reason?

2012.02.08 19:15:22 pattern (EURUSD,M10) CTrade::PositionOpen: request buy 0.10 (null) at 1.32710 sl: 1.32530 tp: 1.33021 [invalid request]

 

Updated to build 581.

For some reason the AD and OBV volume indicators are solid line on EURUSD. The picture is attached.

For this reason the testing and optimisation of the Expert Advisor has come to naught.

 

I can't set a slanted inscription ("Description") on a TREND object.

Then I found out that I couldn't put the inscription on the line manually either, maybe I'm doing something wrong...

void Trend(string name,double price)
{
      ObjectCreate(0,name,OBJ_TREND,0,TimeCurrent(),price,TimeCurrent()+10000,price);
      ObjectSetInteger(0,name,OBJPROP_RAY_RIGHT,true);
      ObjectSetString(0,name,OBJPROP_TEXT,DoubleToString(price,_Digits));
      ObjectSetInteger(0,name,OBJPROP_COLOR,clrLimeGreen);
      ObjectSetInteger(0,name,OBJPROP_SELECTABLE,false);
      ObjectSetString(0,name,OBJPROP_FONT,"Arial");
      ObjectSetInteger(0,name,OBJPROP_FONTSIZE,10);
}

IN MT4 :

 

To the code:

class Test1
{
    public:
        void Test1(int i) {}
};

class Test2: public Test1
{
    public:
        void Test2(int i) {}
};


I get an error:

'Test1' - wrong parameters count test.mqh 10 8

The issue has been discussed here somewhere, but I haven't found a solution.

The "solution" goes like this:

class Test1
{
    protected:
        void Test1() {}
    public:
        void Test1(int i) {}
};

class Test2: public Test1
{
    public:
        void Test2(int i) {}
};

, but somehow it's not right.

What am I doing wrong?

 
Karlson:

I can't set a slanted inscription ("Description") on a TREND object.

Then I found out that I couldn't put the inscription on the line manually either, maybe I'm doing something wrong...

Right-click on the graph. Click => Properties in the context menu. The Properties window will open. In the "Show" tab, check the "Show object descriptions" box. The Properties window can also be accessed by pressing the F8 key.
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Свойства объектов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Свойства объектов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы объектов / Свойства объектов - Документация по MQL5
 

After becoming a server from MIGBank-Demo, there have been persistent connection problems, currently unable to connect.



Reason: