Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1232

 
User_mt5:

Can you tell me how to correctly reflect the 8th buffer in my last example? Without being amateurish?
Can you tell me the rules?

Can you tell me how to correctly reflect the 8th buffer in my last example? With all due care?
And give reasons?
Build 2530.

--
I'm still just learning, so I'd be extremely grateful if you gentlemen could point out where to read about all of this in the documentation.

Step One: Create an indicator dummy using MQL5 Wizard.

 
Vladimir Karputov:

Step one: create an indicator dummy using MQL5 Wizard.

Please do not use expressions like "for your own good":)

I want to clarify a question. I am not asking what to do. I would like to understand the rules, patterns, requirements.

So if you know how and why, then please tell me. I would be very grateful.

 
User_mt5:

Please do not use phrases such as "for your own sake":)

Clarifying the question. I am not asking what to do. I would like to understand the rules, the patterns, the requirements.

So if you know how and why, then please tell me. I would be very grateful.

Well, no, then no.

 
User_mt5:

Can you tell me how to correctly reflect the 8th buffer in my last example? Without being amateurish?
Can you tell me the rules?

Can you tell me how to correctly reflect the 8th buffer in my last example? With all due care?
And give reasons?
Build 2530.

--
I'm still just learning, so I'd be extremely grateful if you gentlemen could point out where to read about all of this in the documentation.

My apologies. Unfortunately I don't have time to look through someone else's code.

Everything is well described in the Help. Maybe Vladimir can tell you something, if he has the time.

The current build of the terminal is 2539. Beta.

 

Thank you, gentlemen.

As a result, we are still where we started:)

 
User_mt5:

Thank you, gentlemen.

As a result, we are still where we started:)

You.
 
Artyom Trishkin:
You.

That's so easy to say.
But you didn't get very far.

In two days of bickering, there's nothing...

 
User_mt5:

That's so easy to say.
But you didn't get very far.

Two days of bickering and nothing.

I'm far away.

I just don't have time to do your job for you and spell it out for you when you have so much reference material in front of you.

And you're the only one bickering. We're trying to advise you as best we can.

 

Work with MQL5 Wizard - everything is automatic and clear:

//+------------------------------------------------------------------+
//|                                                            3.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_plots   6
//--- plot Line_High_Up
#property indicator_label1  "Line_High_Up"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrSalmon
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- plot Hist_High
#property indicator_label2  "Hist_High"
#property indicator_type2   DRAW_HISTOGRAM2
#property indicator_color2  clrRed
#property indicator_style2  STYLE_SOLID
#property indicator_width2  3
//--- plot Line_High_Down
#property indicator_label3  "Line_High_Down"
#property indicator_type3   DRAW_LINE
#property indicator_color3  clrSalmon
#property indicator_style3  STYLE_SOLID
#property indicator_width3  1
//--- plot Line_Low_Up
#property indicator_label4  "Line_Low_Up"
#property indicator_type4   DRAW_LINE
#property indicator_color4  clrLightSkyBlue
#property indicator_style4  STYLE_SOLID
#property indicator_width4  1
//--- plot Hist_Low
#property indicator_label5  "Hist_Low"
#property indicator_type5   DRAW_HISTOGRAM2
#property indicator_color5  clrBlue
#property indicator_style5  STYLE_SOLID
#property indicator_width5  3
//--- plot Line_Low_Down
#property indicator_label6  "Line_Low_Down"
#property indicator_type6   DRAW_LINE
#property indicator_color6  clrLightSkyBlue
#property indicator_style6  STYLE_SOLID
#property indicator_width6  1
//--- input parameters
input uint     Inp_High_Up    = 50; // 'High_Up' shift
input uint     Inp_High_Down  = 30; // 'High_Down' shift
input uint     Inp_Low_Up     = 30; // 'Low_Up' shift
input uint     Inp_Low_Down   = 50; // 'Low_Down' shift
//--- indicator buffers
double         Line_High_UpBuffer[];
double         Hist_HighBuffer1[];
double         Hist_HighBuffer2[];
double         Line_High_DownBuffer[];
double         Line_Low_UpBuffer[];
double         Hist_LowBuffer1[];
double         Hist_LowBuffer2[];
double         Line_Low_DownBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,Line_High_UpBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,Hist_HighBuffer1,INDICATOR_DATA);
   SetIndexBuffer(2,Hist_HighBuffer2,INDICATOR_DATA);
   SetIndexBuffer(3,Line_High_DownBuffer,INDICATOR_DATA);
   SetIndexBuffer(4,Line_Low_UpBuffer,INDICATOR_DATA);
   SetIndexBuffer(5,Hist_LowBuffer1,INDICATOR_DATA);
   SetIndexBuffer(6,Hist_LowBuffer2,INDICATOR_DATA);
   SetIndexBuffer(7,Line_Low_DownBuffer,INDICATOR_DATA);
//---
   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=prev_calculated-1;
   if(prev_calculated==0)
      limit=0;
   for(int i=limit; i<rates_total; i++)
     {
      Line_High_UpBuffer[i]   = high[i]+Inp_High_Up*Point();
      Hist_HighBuffer1[i]     = Line_High_UpBuffer[i];
      Hist_HighBuffer2[i]     = high[i]+Inp_High_Down*Point();
      Line_High_DownBuffer[i] = Hist_HighBuffer2[i];
      Line_Low_UpBuffer[i]    = low[i]-Inp_Low_Up*Point();
      Hist_LowBuffer1[i]      = Line_Low_UpBuffer[i];
      Hist_LowBuffer2[i]      = low[i]-Inp_Low_Down*Point();
      Line_Low_DownBuffer[i]  = Hist_LowBuffer2[i];
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
Files:
3.mq5  5 kb
 

build 2540, I am testing the advisor on mmb:

report profit "1662", "orders and trades" - profit "1463", if you upload to excel and calculate, profit "-4002" and see that balance 995,997 instead of 1,000,000 became - here "-4002" seems to be true.

as 3 different amounts, what is it?

Files:
1.jpg  200 kb
222.jpg  211 kb
333.jpg  205 kb