Questions from Beginners MQL5 MT5 MetaTrader 5 - page 87

 
Silent:

It might even be faster... Although I don't know what it will look like with memory reallocation.

Please, can you tell me how to see how much memory an Expert Advisor takes and how it is reallocated?
 

And yet I can't figure out why levels are not created using ObjectCreate. All functions work, but no OBJ_TREND objects are created

There are variables defined on the global level:

string oRes, oSup, oPP, oRes1, oRes2, oRes3, oSup1, oSup2, oSup3, textPP, textR1, textR2, textR3, textS1, textS2, textS3;

The code that should create the levels:

void OnInit()
  {
   TimeOpenBar();
   ObjectCreate(0,oRes,OBJ_TREND,0,0,0,0,0);
   ObjectSetInteger(0,oRes,OBJPROP_COLOR,clrNavy);
   ObjectSetInteger(0,oRes,OBJPROP_STYLE,STYLE_SOLID);
   ObjectSetInteger(0,oRes,OBJPROP_WIDTH,2);
   ObjectSetInteger(0,oRes,OBJPROP_RAY,false);
   ObjectCreate(0,oSup,OBJ_TREND,0,0,0,0,0);
   ObjectSetInteger(0,oSup,OBJPROP_COLOR,clrNavy);
   ObjectSetInteger(0,oSup,OBJPROP_STYLE,STYLE_SOLID);
   ObjectSetInteger(0,oSup,OBJPROP_WIDTH,2);
   ObjectSetInteger(0,oSup,OBJPROP_RAY,false);
   CreateLevels();

   ObjectCreate(0,oPP,OBJ_TREND,0,0,0,0,0);
   ObjectSetInteger(0,oPP,OBJPROP_COLOR,clrDeepSkyBlue);
   ObjectSetInteger(0,oPP,OBJPROP_STYLE,STYLE_SOLID);
   ObjectSetInteger(0,oPP,OBJPROP_WIDTH,2);
   ObjectSetInteger(0,oPP,OBJPROP_RAY,false);
   ObjectCreate(0,oRes1,OBJ_TREND,0,0,0,0,0);
   ObjectSetInteger(0,oRes1,OBJPROP_COLOR,clrDeepSkyBlue);
   ObjectSetInteger(0,oRes1,OBJPROP_STYLE,STYLE_DASH);
   ObjectSetInteger(0,oRes1,OBJPROP_WIDTH,1);
   ObjectSetInteger(0,oRes1,OBJPROP_RAY,false);
   ObjectCreate(0,oSup1,OBJ_TREND,0,0,0,0,0);
   ObjectSetInteger(0,oSup1,OBJPROP_COLOR,clrDeepSkyBlue);
   ObjectSetInteger(0,oSup1,OBJPROP_STYLE,STYLE_DASH);
   ObjectSetInteger(0,oSup1,OBJPROP_WIDTH,1);
   ObjectSetInteger(0,oSup1,OBJPROP_RAY,false);
   PPlevel();
  }
Folks, help sort this out. Please
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов - Документация по MQL5
 
fyords:
Print the results of ObjectCreate, maybe there is an error.
Well, what does it say? Did you print the result?
 
Please advise me how to find an easy-to-understand (as simple as possible) literature on technical analysis. It seems to be understandable in the beginning, but when I start reading it, my brain refuses to understand it :(
 
fyords:
So what does it say? Did you do an output of the result?
It didn't work for me, I was doing something wrong. Print didn't give me anything.
 
NeSezon:
Please advise me on how to find a clear (as simple as possible) literature on technical analysis. When I start reading it I understand it, but when I start reading it in details my brain refuses to understand it :(
Try Naiman's "trader's little encyclopedia".
 
WindSW:
It didn't work for me, I was doing something wrong. Print didn't give me anything.
ResetLastError();
bool result=ObjectCreate(0,oRes,OBJ_TREND,0,0,0,0,0);
Print("result=",result," GetLastError()=",GetLastError());
Must have been doing it wrong.
 
fyords:
That must have been the wrong thing to do.
Yes, that's really not how I did it. It generates the error "5040 - tainted parameter of string type". I have parameters for objects set at global level (the compiler warns without them) in the following form: string oRes, oSup, oPP, oRes1; etc. How to fix this and how to correctly specify the correct parameter string, so that everything works and the compiler does not swear?
 
WindSW:
Yes, that's really not how I did it. It generates the error "5040 - tainted parameter of type string". I have parameters for objects defined at the global level (the compiler warns without them) like this: string oRes, oSup, oPP, oRes1; etc. How to fix this and how to correctly specify the correct parameter string, so that everything works and the compiler does not swear?

Well, let's say you've declared variables at global level, have you assigned values to these variables?

If not, then you say to the program "create an object with such-and-such characteristics with the name..." and there is a problem - the name is not given. So it doesn't create it.

Wouldn't it be easier to specify it directly in the ObjectCreate code?

ResetLastError();
bool result=ObjectCreate(0,"Name1",OBJ_TREND,0,0,0,0,0);
Print("result=",result," GetLastError()=",GetLastError());
 
WindSW:
Try Nyman's Little Trader's Encyclopedia
Thank you! Found it. Would love to read it one of these days.
Reason: