Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1449

 

Vitaly Muzichenko:

Need an example of how to work withthe SmoothedMAOnBuffer( ) function

In general, it goes like this:

//+------------------------------------------------------------------+
//|                                                       VMTest.mqh |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                             https://mql5.com/ru/users/artmedia70 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://mql5.com/ru/users/artmedia70"
#property version   "2.00"
#property strict
#property indicator_separate_window
#ifdef __MQL5__
  #property indicator_buffers 2
  #property indicator_plots   2
#else
  #property indicator_buffers 2
#endif
#property indicator_color1 clrLime
#property indicator_type1 DRAW_LINE
#property indicator_width1 2
#property indicator_color2 clrRed
#property indicator_type2 DRAW_LINE
#property indicator_width2 2

double BufferHL[];
double BufferSMMA[];

sinput int InpPeriod = 5;  // Smoothing period
int    period_smma;

#include <MovingAverages.mqh>
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   #ifdef __MQL4__ IndicatorBuffers(2); #endif
   SetIndexBuffer(0,BufferHL,INDICATOR_DATA);
   SetIndexBuffer(1,BufferSMMA,INDICATOR_DATA);
   ArraySetAsSeries(BufferHL,true);
   ArraySetAsSeries(BufferSMMA,true);
   period_smma=(InpPeriod<2 ? 2 : InpPeriod);
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int limit=rates_total-prev_calculated;
   if(limit>1)
     {
      limit=rates_total-1;
      ArrayInitialize(BufferHL,EMPTY_VALUE);
      ArrayInitialize(BufferSMMA,EMPTY_VALUE);
     }
   for(int i=limit;i>WRONG_VALUE;i--)
     {
      BufferHL[i]=high[i]-low[i];
     }
   if(SmoothedMAOnBuffer(rates_total,prev_calculated,0,period_smma,BufferHL,BufferSMMA)==0)
      return 0;
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
Good afternoon. How can I increase the amount of text on the graphic. At the moment displays 24 texts, that is for the day
   void Vr(){
   double h = TimeHour(TimeCurrent()); 
           ObjectCreate(0,"Vr"+h,OBJ_TEXT,1,TimeCurrent(),0);    
           double Vr0=ObjectDescription("Vr"+h);   
           ObjectSetText("Vr"+h,MathMin(balance[0],Vr0),20,"Arial",clrWhite);
           ObjectSetInteger(0,"Vr"+h,OBJPROP_ANCHOR,ANCHOR_RIGHT);
       Comment(Vr0);    }  
I use the indicator on the minute chart. Text displays once an hour
 

When I clicked MQL5 cloud protector an error pops up

sending request to protector server error (3-3, #0)             0       0

The file compiles itself without any problems. What could be the error?

 
Sergey Likho:

When I clicked MQL5 cloud protector an error pops up

The file compiles itself without any problems. What could be the error?

Google suggested:error sending request to protector server

 
Artyom Trishkin:

All in all, that's how it is:

Thank you!

 
Vitaly Muzichenko:

Thank you!

You're welcome ;)

I can show you how to redo it for a five - you're not all ace there...

 
Artyom Trishkin:

You're welcome ;)

I can show you how to redo it for 5 - you don't have all the ace in there...

I never got it up and running...

That would be great if it was in its original form.

It's the only indicator to date that's had a hitch.

Files:
max.mq5  12 kb
 
Vitaly Muzichenko:

I never got it up and running ...

That would be great if it were in its original form.

It's the only indicator to date that's had a hitch.

Give me the original, fully working code for this indicator on four. I'll make it for five.

 
Artyom Trishkin:

Give me the original, fully working code of this indicator on four. I'll make it for five.

Here's a tweaked one, the original one is just plain rubbish.

P.S. Dot.mq4 - full original

Files:
test.mq4  17 kb
Dot.mq4  8 kb
 
Vitaly Muzichenko:

Here's the tweaked one, the original one is just plain gloomy.

P.S. Dot.mq4 - full original

A very good. But I can only look at it in my spare time - work, home, family, cat and children/grandchildren... Mother-in-law also, yes...