Please help me for loop do while

 
I create my EA and use do while for get signal entry : 

...

Improperly formatted code removed by moderator. Please EDIT your post and use the CODE button (Alt-S) when inserting code.

Code button in editor

Hover your mouse over your post and select "edit" ... 

...

With this code, i got a problem freeze chart when i backtest. Please help me to correct this code
 
When you post code please use the CODE button (Alt-S) !
 
Use the debugger to check the variable and the conditions: https://www.metatrader5.com/en/metaeditor/help/development/debug
Code-Debugging - Programme entwickeln - MetaEditor Hilfe
Code-Debugging - Programme entwickeln - MetaEditor Hilfe
  • www.metatrader5.com
MetaEditor hat einen eingebauten Debugger, mit dem Sie die Programmausführung Schritt für Schritt (durch einzelne Funktionen) ü...
 

You don't need a loop to achieve that.

bool buy_entry = Rsi_3 && Ask > MA_5;
 

Taking your code at face value, you have likely created an endless loop, which is why the chart freezes. You should spend as little time in OnTick() as possible. Fabio's above answer is correct and would fix the freeze problem.

 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
Oleksandr Medviediev #:
When you post code please use the CODE button (Alt-S) !
Sorry , i post from my phone
 
Fabio Cavalloni #:

You don't need a loop to achieve that.


I explain my idea in code . What is the loop can i do it with this idea ? . Please help


if (RSI == true)

{
   
   After a few candle or waiting to  
   {
      if (Ask > MA_5)
      {
         Entry a Buy Order;
      }
   
   }
}
 

Your code is incomplete... How do you assign the RSI bool value?

 
Fabio Cavalloni #:

Your code is incomplete... How do you assign the RSI bool value?

void RSI_Signal()
{
   RSI= false;   
   CopyBuffer(RSI_handle,0,0,2,RSI); 		
   
   if (RSI[1] >= 70 || RSI[1]  <= 30  )      
   {
         RSI = true;
   }
}
.
.
.

..............

if (RSI == true)

{
   
   After a few candle or waiting to  
   {
      if (Ask > MA_5)
      {
         Entry a Buy Order;
      }
   
   }
}
I am confused about whether to use do while or while to create a loop, which will wait for the Ask value > MA_5, then exit loop to entry an order.  Please help me
 
Oh, chart frozen on backtest when i use loop do while, but live test is OK. Is there any idea to resolve this issue ?