Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 69

 

Hello!

Please explain to those with more experience, why do I need to use the NormalizeDouble function "in all calculated values"? I've written a dozen EAs, I've done without it everywhere. Everything works. And now I've flipped through the textbook and came across some examples, and I don't understand their logic. Here is an example:

if (NormalizeDouble(SL,Digits)<NormalizeDouble(Bid-TS*Point,Digits))
{
SL=Bid-TS*Point;
string Text="Buy"; // Text for Buy
Modify=true; // Assigned to modify.
}

Why do you need NormalizeDouble, ? Everything works fine without it. You may write the code in this way:

If(SL<Bid-TS*Point)
{
SL=Bid-TS*Point;
string Text="Buy "; // Text for Buy
Modify=true; // Assigned to modify.

}

And you will get the same result.

So what is the point? Why should I round something if my equation has a sign (<) instead of (==)?

 
your right
 

Good afternoon.

Help me out here.

dist = MathAbs((NormalizeDouble(Bid,Digits)-
NormalizeDouble(ObjectGetValueByShift(TrendLineName,0),Digits))*MathPow(10,Digits));

The code finds the distance from the current price level to the trend according to TrendLineName. But there is a problem: apparently the trend is inaccurately transmitted between halves, which is why the distance to the price is different for different halves. How to get around this problem? Ideally, even if the trendline is displayed only on H1, at open time W1 (in fact at any open time) the calculated distance should be the same.

 
MauzerVII:
What is the maximum number of elements in an array?
10 000 000
 
If there is no equality comparison, you don't have to worry about it. Normalisation is also needed when setting prices and lots in the opening and modification functions.
 
Hello, recently started studying mql4, now I'm developing an EA on 4 indices. The code compiles, but in the tester, it does not work, i.e. no results. Please help me to fix a logical or other errors, here is part of the code, as I think the problem may be in the indices of the indicator line, thanks in advance
 // Торговые критерии
   FT_t=iCustom(NULL, 0, "ForexTrend", 1, 0);                       // forex trend если что менять индекс на 2 или 3
   TL_t=iCustom(NULL, 0, "TrendLord", 1, 0);                          // trend lord
   HA_t=iCustom(NULL, 0, "Heiken_Ashi_Smoothed", 1, 0);               // heiken ashi sm. менять индекс на 2-3
   FI_t=iForce(NULL, 0, Period_FI,MODE_EMA,PRICE_CLOSE,0);            // FI

   {
   if ((HA_t == Lime) && FT_t == DeepSkyBlue && TL_t == LightSkyBlue && FI_t >= 0)   // условия 
   {
   Opn_B=true;
   }
   if (HA_t == Red || FT_t == Red || TL_t == LightSalmon || FI_t <= 0)
   {
   Cls_B=true;
   }
   }
   {
   if (HA_t == Red && FT_t == Red && TL_t == LightSalmon && FI_t <= 0)
   {
   Opn_S=true;
   }
   if (HA_t == Lime || FT_t == DeepSkyBlue || TL_t == LightSkyBlue || FI_t >= 0)
   {
   Cls_S=true;
   }
   }
 
bistreevseh:
Hello, I've just started to learn mql4, I'm currently developing an Expert Advisor with 4 indices. I have started development of an mql4 Expert Advisor with 4 indicators. The code should compile, but it is not working in the Strategy Tester, i.e. I have no results. Please help me to fix a logical or other errors, here is part of the code, as I think the problem may be in the indices of the indicator line, thanks in advance

You are comparing the buffer value with the colour the buffer is displayed in.

Lift your eyes to the top of the site - there is more than enough material to at least understand the basics.

 
bistreevseh:
Hello, I just started to learn mql4, I am currently developing an Expert Advisor with 4 indices. The code compiles well, but it is not working in the tester, i.e. no results. Please help me to fix a logical or other errors, part of the code here, i think the problem may be in the indicator line indices, thanks in advance.


So, just out of curiosity, do you have these indices with more than one line? You use the second line everywhere, is this how it should be?

And about the tester, what mode do you use?

And about the code, you are comparing fractional numbers without normalisation. Equality will be difficult to achieve.

 

How do I display an indicator on the daily chart for which the signal is calculated based on the 15 minute EMA timeframe reading?

 
VladislavVG:

You are comparing the buffer value with the colour the buffer is displayed in.

Lift your eyes to the top of the site - there is more than enough material to at least understand the basics.


I apologise for the nonsense written above, I've just started studying, it's hard to get into it straight away. I've been studying for a whole day and I've understood about buffers. I have a custom indicator, it's a histogram, all values are maximum, it only matters the colour of bars in the histogram, it has no input parameters, buffers 2: 0 - with the red bar, and 1 - blue bar, the imperial method, I found that in 0 buffer does not change value, and 1 does. How to write the criteria for the transaction I can't understand, please explain how, thanks in advance.

Roger:


So, just out of curiosity, do you have these indices with more than one line? You use the second line everywhere, is it supposed to be like this?

And about the tester, what mode do you use?

And about the code, you are comparing fractional numbers without normalization. Equality would be difficult to achieve.

After the top post, I think there are no more questions)) about the tester, not really understood, with or without visual?

Reason: