This loop, in the code named BuscarSenal() es used to get the singal for open or close a trade.
The loop return the value of two bools, var_760 and var_756.
The result of this bools will be used to open or close positions.
Let going to see the example of the Expert Advisor CyberEA-Template.
In the template if
var_760=true is a buy signal and if var_756=true is a sell signal.CyberEA gets the value of var_784 (Slow MA) and var_776 (Fast MA) and if
var_776>var_784 return var_760=true so, a buy signal.This value will be called from check for open and check for close loops, wich we will see in other post, to take action.
Note that the settings of MA are selected from external variables that can be changed after compilation of the code.
void BuscarSenal()
{
if (var_772 != Time[0])
{
var_772 = Time[0];
var_784 = iMA(NULL,0,SlowMAPeriod,SlowMAShift,SlowMAMode,SlowMAApplyPrice,Bar);
var_776 = iMA(NULL,0,FastMAPeriod,FastMAShift,FastMAMode,FastMAApplyPrice,Bar);
}
var_752 = false;
var_748 = false;
if (var_776>var_784) var_748 = true;
if (var_784>var_776) var_752=true;
var_760 = var_748;
var_756 = var_752;
if (var_760 || var_756) return;
if (BuscarOrdenes() != 0)
{
var_760 = false;
var_756 = false;
}
}