Questions from a "dummy" - page 97

 
Alfff:

Hello.

Could you please tell me how to set a vertical line on a chart at a certain point?

Thank you.

MQL5 Reference / Graphic Objects

MQL5 Reference / Graphic Objects / ObjectCreate

MQL5Reference / Standard constants, enumerations and structures / Object constants / Object types

MQL5Reference / Graphic Objects / ObjectSetInteger

And so on.

You create an object and then set its properties.

It goes something like this:

   if(ObjectFind(chid,name)==-1)
      ObjectCreate(chid,name,OBJ_VLINE,0,time,0);
   ObjectSetString(chid,name,OBJPROP_TOOLTIP,tool);
   ObjectSetInteger(chid,name,OBJPROP_COLOR,color_line);
   ObjectSetInteger(chid,name,OBJPROP_STYLE,style_line);
   ObjectSetInteger(chid,name,OBJPROP_BACK,true);
   ObjectSetInteger(chid,name,OBJPROP_SELECTED,false);
 
Urain:

MQL5 Reference Guide / Graphic Objects

MQL5 Reference / Graphic Objects / ObjectCreate

MQL5Reference / Standard constants, enumerations and structures / Object constants / Object types

MQL5Reference / Graphic Objects / ObjectSetInteger

And so on.

Create an object, then set its properties.

Somewhere so:

Thank you.
 
if(ObjectFind(chid,name)==-1)
А что означает эта строчка?
 
erkov:

.... and that's it - it's not clear.... method GetData returns either -1 or >= 0 - (and I need the opening price of bar 5)

And what did you want to get? Look at the documentation:"Return value: >=0 - if successful, -1 - if failed to get data".

If "we need the value of bar opening price #5", then this value should be searched for in the "array for placing data", i.e. in the Open[] array in your case.

...Read Handbook

 

Alfff:

if(ObjectFind(chid,name)==-1)
А что означает эта строчка?

If the object named name in the chid graph does not already exist, then ...

If it already exists, we simply skip creating the object and go straight to modifying the settings.

 
Urain:

If the object named name in the chid graph does not already exist, then ...

If it already exists, we just skip creating the object and go straight to modifying the settings.

Small note: "If object is not found, function returns negative number". Apparently, it doesn't necessarily return "-1".

As I say, "...Read the Reference" :)

 
Yedelkin:

A small note: "If no object is found, the function returns a negative number". Apparently, it doesn't necessarily return "-1".

As I say, "...Read the Reference" :)

It's probably better to put

if(ObjectFind(chid,name)<0)

Although it's always worked.

 
Yedelkin:

What did you want to get? See the documentation:"Return value: >=0 - if successful, -1 - if failed to get data".

If you "need value of bar opening price #5", then you should look for this value in "array to place data", i.e. in Open[] array in your case.

...Read Reference

Thank you for your help. I will definitely read it...

 
erkov:

Thank you for your help. I'll be sure to read it...

The general approach to array copying can be found in descriptions of Copy...() functions. For example, CopyBuffer().
 
erkov:
Question 1. Where to look for (with so much effort) open price data (in what place of the Open[] array )...????

Question 2. For the timeframe D1 we should declare another array and create our own instance of the class (or we can do with one)...????

Question 1: ALL Standard Library classes that provide access to indicator and timeseries data require "refreshing" them (the data) before using them.

Write it this way (in a simplified version):

iOpen.Refresh(-1);
iOpen.GetData(...);

Question 2. the other one.

Документация по MQL5: Стандартная библиотека
Документация по MQL5: Стандартная библиотека
  • www.mql5.com
Стандартная библиотека - Документация по MQL5
Reason: