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

 
PolarSeaman:

Thank you, I did so:

I hope I put_depo ofint type correctly.

MathFloor cannot be set, it will be a zero lot

 
PolarSeaman:

Thank you, I did so:

I hope I put_depo ofint type correctly.

Ihave corrected the formula for you. It should logically work fine.

 
Taras Slobodyanik:

MathFloor cannot be set, it will be a zero lot

I guess my terminal doesn't know that), the position opens with the right lot.

 
Konstantin Nikitin:

Ihave corrected the formula for you. Logically it should work fine.

In the settings, how do I set the pitch =1000?

 
PolarSeaman:

How do I set the pitch =1000in the settings?

And it's purely a percentage of the deposit. And it's normalized to one digit. You can see for yourself what and how it counts. Everything is simple as hell.

 
Konstantin Nikitin:

In other words, it is only a percentage of the deposit. Normalization is made to 1 mark. You may look for yourself what and how it is counted.

The point is to set the step. depo= 1000, lot=0.1 or depo 2000, lot 0.1. The way I did it now, it seems to count correctly.

 
PolarSeaman:

I guess my terminal doesn't know that), the position opens with the right lot.

Make your terminal a deposit of 500, it will know that)

 
Taras Slobodyanik:

MathFloor can't be put in, it will be a zero lot

Actually I thought everyone would have the wit to add a check

if(lot < _lot)
 lot = _lot;

The second option

lot = NormalizeDouble(fmax(_lot, lot), 2);
 
Alexey Viktorov:

Actually, I thought everyone would have the wit to add a check

Second option.

Well, as you can see "the terminal doesn't know this kind of error".

Initially, my example was with rounding upwards and zero could not be obtained.
The lot was calculated by a certain amount. That is, 0.1 for every 1,000.
And with rounding down we get 0.1 from 1999 to 0. Further we get 0.1 plus 0.1 for every 1000, i.e. the essence of MM algorithm is broken.

If rounding down, then you have to do +1 for the calculation to be correct.

 

Greetings all! I'm having a problem creating my first indicator. I have only ever created Expert Advisors before. I have never learned how to use textbook, someone sent me a simple Expert Advisor and I started poking around, and then I got hooked. That was 5-7 years ago. Now I was eager to create an indicator. Again I went to the tutorial and documentation. I'm so dumb there, it's like it's not in my language.


The problem is to create an indicator that will show the maximum number of bullish and bearish candles. Tell me at least where to start. Or throw me a similar indicator.

Reason: