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

 
Valerius:


Function error() - just prints the error code. I have no problems with this function. I have it in many EAs and I never change it.

So it's definitely not the problem.

And the function itself is this:


Do you have positions and orders open for one symbol?

Ask and Bid, you know, maybe it's better to use

with this construction.

 Ask_=MarketInfo(OrderSymbol(), MODE_ASK);
 Bid_=MarketInfo(OrderSymbol(), MODE_BID);
 
Alekseu Fedotov:


Do you have positions and orders opened for one symbol?

Ask and Bid, you know, maybe it's better to use

this structure.

The orders are opened for several instruments and are clearly tracked and divided in the program.

As for Bid and Ask....That's exactly the wrong way to do it. While the data are assigned to the variables and after that the SendOrder(...) command is given,

this very command might fail to be executed since the price can already have passed and the order will not be placed.

But what does this have to do with it?

The question is different and it is written above.

 

Good afternoon, I'm a beginner in programming and I'm having a hard time. Can you tell me how to calculate the values of the indicator on the last three bars? Can I prescribe some way to check the last three candles to open a buy, where the line Slope_Direction_Line on the last candle has a numerical value above (larger) the previous one, and the numerical value of the line of the previous candle has a numerical value below (less) the third from the end? I hope I described it clearly.

 
AlGuru:

Good afternoon, I'm a beginner in programming and I'm having a hard time. Can you tell me how to calculate the values of the indicator on the last three bars? Can I prescribe some way to check the last three candles to open a buy, where the line Slope_Direction_Line on the last candle has a numerical value above (larger) the previous one, and the numerical value of the line of the previous candle has a numerical value below (less) the third from the end? I hope I described it clearly.

if ( Slope_Direction_Line(0)> Slope_Direction_Line(1) &&  Slope_Direction_Line(1)< Slope_Direction_Line(2) ){}

I hope you know how to get data from the indicator buffer.
 
-Aleks-:

if ( Slope_Direction_Line(0)> Slope_Direction_Line(1) &&  Slope_Direction_Line(1)< Slope_Direction_Line(2) ){}

I hope you know how to retrieve data from the indicator buffer.

Thank you very much!
 

Can graphical objects in MT4 be set to transparent colour on charts?

P.S. clrNONE makes it grey, not transparent.

 
AlGuru:

Thank you very much!

You're welcome.

 
Nauris Zukas:

Can graphical objects in MT4 be set to transparent colour on charts?

P.S. clrNONE makes it grey, not transparent.

It is not possible to do it to objects. But it is possible to draw using CCanvas class - there you can
 

For two days, I've been making a nice panel. But it turned out that I could not change the Expert Advisor parameters set as inputs through it.

What should I do now?

 
Vladimir Tkach:

For two days, I've been making a nice panel. But it turned out that I could not change the Expert Advisor parameters set as inputs through it.

What should I do now?

Declare global level variables and assign them to input variables in OnInit() and then use and change them...