Questions from Beginners MQL5 MT5 MetaTrader 5 - page 795

 
Alexey Viktorov:
Are you sure that the indicator is recalculated during the while loop?
Yes, I put the comment on the screen. Or does that not yet prove that the recalculation has taken place?
 
007yurik:
Yes, put the comment on the screen. Or it doesn't yet prove that the recalculation is done?

We need to look at Value[] values in debug mode

In Comment can change outside the loop. I haven't encountered and checked this situation, but something tells me it will not be recalculated and the values will remain unchanged. And consequently, you will never get out of the loop.

 
Alexey Viktorov:

In debug mode, see Value[] values

In Comment may change outside the loop. I have not encountered and checked this situation, but something tells me that it will not be recalculated and the values will remain unchanged. Therefore, you will never get out of the loop.

This is something absurd. In debugging, the values are correct but the loop is always executed once regardless of fulfillment of the condition. I think I'll give up While.
 
007yurik:
This doesn't make sense. In debugging, Value[] values are correct, but the loop always runs once, regardless of whether the condition is met. I think I'll abandon While.

And how do you determine that thevalues in theValue[] arrayare correct? How do you fill it in?

 
Vladimir Karputov:

And how do you determine that thevalues in theValue[] arrayare correct? How do you fill it?

With the indicator handler, if I understand you correctly.)
 
007yurik:
I'll use the indicator handle, if I understand you correctly, to remind you that my level of proficiency in the subject equals that of a dummy)

I think you should do it in reverse order: first you fill in the Value array, and then you compare what's in it.

 
007yurik:
What a mess. In debugging, Value is correct, but the loop always runs once, regardless of whether the condition is met. I'll probably abandon While.

Everything is exactly as written in the program

 bool pravda=false;

   if(pravda || Ind[0]<=-0.7)
   pravda=true;
   
   {   
      
      while(Value[2]<Value[1])
         {
         if(CopyBuffer(InpInd2_Handle,1,SignalBar,3,Value)<=0) {Recount=true; return;}                 
          }
          
         if(BuyPosOpen) BUY_Open=true;     
                                                  
         if(SellPosClose) SELL_Close=true;
         UpSignalTime=datetime(SeriesInfoInteger(Symbol(),InpInd_Timeframe,SERIES_LASTBAR_DATE))+TimeShiftSec;
         }

If CopyBuffer is executed with an error, set Recount to true and exit the loop.

So it wasn't the ... loop.

 

Explain to a fool, please.
The task is to draw a zero line in the sub-window. A simple solid white line.

What I don't do, it turns out striped. I set the levels, and the indicator line, and already inserted a graphical object - and still turns out striped.
The reason is clear - the striped grid line is displayed from above. But here's the strange thing: only horizontal zero grid line is on top, while vertical grid lines are below the indicator ones.

Here, how do you draw a simple solid white zero line in the sub-window?

 
And "if you don't respond, we'll write to Sportlotto"!
 
User_mt5:

Explain to a fool, please.
The task is to draw a zero line in the sub-window. A simple solid white line.

What I don't do, it turns out striped. I set the levels, and the indicator line, and already inserted a graphical object - and still turns out striped.
The reason is clear - the striped grid line is displayed from above. But here's the strange thing: only horizontal zero grid line is on top, while vertical grid lines are below the indicator ones.

Here, how do you draw a simple solid white zero line in the sub-window?

Can I have a screenshot of the way it is now?
Reason: