[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 16

 

Help with the code. We have a chart with an indicator with a buffer and a vertical line shifted to the past.

How to read from the indicator buffer values from the bar on which the vertical line is located to the end of the chart (zero bar)?

I wrote it like this:

tm=ObjectGet("VerticalLine",0);
for(x=iBarShift(Symbol(),0,tm);x==0;x--)
{
Print(x);
Print(Buffer[x])

}

It doesn't work, nothing is output at all. Help

 
ZZZEROXXX:

I write it like this:

tm=ObjectGet("VerticalLine",tm);
for(x=iBarShift(Symbol(),0,tm);x==0;x--)
{
Print(x);
Print(Buffer[x];

}

The problem must be in the line: tm=ObjectGet("VerticalLine",tm);

Read the Help, it needs something like: tm=ObjectGet("VerticalLine",OBJPROP_TIME1);


 
IgorM:

the problem must be the line: tm=ObjectGet("VerticalLine",tm);



Sorry, I messed up, I wrote it by hand, in the original tm=ObjectGet("VerticalLine ",0); anyway, it doesn't work

 
ZZZEROXXX:


Sorry, I messed up, I wrote it by hand, in the original tm=ObjectGet(" VerticalLine ",0); so something doesn't work

if(ObjectFind("VerticalLine")!=-1){
    datetime TimeVL=ObjectGet( "VerticalLine", OBJPROP_TIME1); //получили координату времени где стоит вертикальная тиния с именем VerticalLine , которая сознательно  выставлена - так как не проверяется какая это линия и тд 
    int shift=iBarShift(NULL, 0, TimeVL); //получил смещение линииот текущего момента в свечах 
    
    //int c=Bars- shift; //если вдруг хочется до конца истории вывести значение индикатора (после линии)

    int c=10; // а это на скольких свечах после вертикальной линии анализировать значение индикатора
    for(int i=shift; i<=shift+c; i++){
     //double x=iCustom(NULL, 0, "СвойИндикатор", ..., int mode, i); // тут вроде как свой индикатор ....
     double x= iMA(NULL, 0, 12, 0, MODE_SMA, PRICE_CLOSE, i) ; // для примера вывод МА
     Print("x=",i," MA=",x);
    }
   }
   else Print("Нет Вертикальной линии");

- Be careful - the code will work tick by tick - you will get a lot of data for analysis :) on every tick the code is executed anew

That is, if I understood correctly what you want

 
In MQL, is it possible to make a binding to an indicator colour? I.e. when the indicator colour or indicator point changes, a position is opened.
 
vilard:
In MQL, is it possible to make a binding to an indicator colour? I.e. when the indicator colour or indicator point changes, a position is opened.
Yes
 
rustein:
Yes

how can this be implemented, if possible a simple example or code link
 
vilard:

how can this be implemented, if possible a simple example or code link

https://www.mql5.com/ru/search?keyword=iCustom

https://www.mql5.com/ru/code/9235

 

Hi all!

I'm asking a knowledgeable person to tell me what the libraries in MQL4 are and what to use them with. Thank you in advance.