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

 

Good afternoon!

Please advise on OrderOpenTime() function. I would like to know, if the time of order changes, for example, if it was pending (OP_STOPBUY or OP_STOPSELL), and then it has triggered? If the time changes, then where can I find the time of a stop order (i.e. when it was set)?

 

Hello all!


There's a little code. What property to add to make a horizontal line appear selected immediately (i.e. no need to click on it twice, but can be moved immediately).


int start()

{

ask=MarketInfo(Symbol(),MODE_ASK);

point=MarketInfo(Symbol(),MODE_POINT);

text="Price;

ObjectCreate(text,OBJ_HLINE,0,Time[0],ask);

ObjectSet(text,OBJPROP_COLOR,Blue);

ObjectSet(text,OBJPROP_STYLE,4);

return(0);

}

 
Vyacheslav Suchkov:

Hello all!


There's a little code. What property to add to make the horizontal line appear selected immediately (i.e. you don't have to click on it twice, you can move it immediately).

ObjectSetInteger(ChartID,name,OBJPROP_SELECTED,true);

Or you can do it in a different way - without selection.
Track the first mouse click on the line, and if the button is pressed, start moving it immediately.

 
Thank you!!!
 

I'm writing a custom indicator, there are init and onInit initialisations in different examples in the tutorial.

What is the reason for using one or the other? Are there any meaningful differences between them that give advantages or impose limitations?

 
psyman:

I'm writing a custom indicator, there are init and onInit initialisations in different examples in the tutorial.

What is the reason for using one or the other? Are there any meaningful differences between them that give advantages or impose limitations?

Use OnInit(). This is a new syntax, as close to mql5 as possible.
There is no difference, apart from a further simple switch to an A.
 

And when should I use void or int for OnInit?

I don't need to do anything special during initialization, just assign a buffer and check that the period of i-ra is greater than zero.

After reading the examples I used int, but I want to know the differences.

 
psyman:

And when should I use void or int for OnInit?

I don't need to do anything special during initialization, just assign a buffer and check that the period of i-ra is greater than zero.

After reading the examples I used int, but I want to know the difference.

Create"Custom indicator" in MetaEditor and use what is in the standard template. Everything else is a relic of the past.

 

Forum on trading, automated trading systems & strategy testing

Any questions for beginners in MQL4, help and discussion on algorithms and codes

Vitaly Muzichenko, 2018.10.15 19:46

Create a"Custom Indicator" in MetaEditor, and use what will be in the standard template. Everything else is a relic of the past.


It should be written at the beginning of the textbook, as Medvedev said "Cast in granite" :-)

 
psyman:

This should be written at the beginning of the textbook, as Medvedev said "Cast in granite" :-)

Where did you find a textbook on mql5 ?

Reason: