[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 173

 
TarasBY:

This condition somehow changes in the loop:

...If "no", why put it inside the loop?


Well the gist is this:

In external parameters ifUseFiltrMa = TRUE, the condition A > B must be taken into account, but ifUseFiltrMa = False, the condition is not taken into account. This condition(A > B) does not appear elsewhere in the code. I put this filter inside the loop since the previous filter is also in the loop. After all, we have an array of slices. The loop selects a sequence number of a mask (its index).

A > B, according to my code, looks like this:

MA(g_maHigherTF[0]) > MA(g_maHigherTF[1])

You see, everything falls into place here, and you can see the reason for the loop.

 
hoz:


The gist of it is this:

In the external parameters ifUseFiltrMa = TRUE, the condition A > B must be taken into account, and ifUseFiltrMa = False, the condition is not taken into account. This condition(A > B) does not appear elsewhere in the code. I put this filter inside the loop since it was in the loop before, too. After all, we have an array of slices. The loop selects a sequence number of a wagon (its index).

A > B, according to my code, looks like this:

You see, everything is falling into place here, and you can see the reason for the loop.

I still haven't seen any loop conditions that change the condition: if (A > B).

There can ALWAYS be many solutions, and you need the way you came up with...

 
TarasBY:

I still don't see any loop condition that changes the condition: if (A > B).

There can ALWAYS be many solutions, and you want the way you think of...


You don't need this loop... Don't pay any attention to it. You just need to insert the condition as I wrote above:

hoz:

In external parameters, ifUseFiltrMa = TRUE, the condition A > B must be taken into account, and ifUseFiltrMa = False, the condition is not taken into account.

IfUseFiltrMa = False, then the conditionA > B is skipped! That's all. You don't need anything else! Don't pay any attention to loops,... it's a long story, what comes from where. There is only one block. And I described the task.
 
hoz:


The gist of it is this:

In the external parameters ifUseFiltrMa = TRUE, the condition A > B must be taken into account, and ifUseFiltrMa = False, the condition is not taken into account. This condition(A > B) does not appear elsewhere in the code. I put this filter inside the loop since it was in the loop before, too. After all, we have an array of slices. The loop selects a sequence number of a wagon (its index).

A > B, according to my code, looks like this:

You see, everything is falling into place here, and we can see the reason for the loop.

if(UseFiltrMa == TRUE&& А > B )

  {

     //  

   }

else

  {
   //

  } 
 

pako:

if(UseFiltrMa == TRUE&& А > B )

  {

     //  

   }

else

  {
   //
  }


That's how I see it. Couldn't you make it shorter? Implement it in one line... If not, we will have to stretch the code.

For example, I often make an insertion like this before the no-loss order function:

if (UseBU)
{
  // Код функции перевода в БУ
}

But in this case when the variableUseBU is set to False, there is no need to execute the function further. That is why it is easier and shorter there. But it is different here. Further conditions by code obligatory. That is why I think.

 
hoz:


That's how I understand it. Couldn't you make it shorter? It can be implemented in one line. If not, you will have to stretch the code.

For example, I often make an insertion like this before the no-loss order function:

But in this case when the variableUseBU is set to False, there is no need to execute the function further. That is why it is easier and shorter there. But it is different here. Further conditions by code obligatory. That is why I think.

In short, like this:

if((UseFiltrMa == TRUE && А > B) || UseFiltrMa == FALSE)
{
  if(..........................
 
borilunad:
Who knows, is it possible with global variables Hour(), Minute(), Seconds() to control at midnight (0.00) change in indicator DailyPivotPoints to new RR levels and other lines from EA? I did before directly in indicator with Hour(), Minute(), Seconds(), and it worked without need to compile every night. And recently it stopped, maybe from changing the bild? Thanks!

Boris, try asking this question in the pro thread.
 
hoz:

Boris, try asking this question in the pro thread.

Thank you, Victor! Did my short version come up for you?

if((UseFiltrMa == TRUE && А > B) || UseFiltrMa == FALSE)
{
  if(..........................
 
granit77:
Try to uncheck the "Disable EA on Profile Switch" option in the settings to see if it helps.

Thank you. - I'll give it a try. Unfortunately, I noticed the answer late - the markets are off for the weekend. And I can't reset my settings via init() either way. Although, in theory, they should.

I am not sure why MT resets its settings at all. It does not matter what is the timeframe; if I set the parameters in the settings, they should (in theory) be saved in any TF.

 
Good day to all. Can you tell me how to copy trades in Metatrader 4. So that by opening a trade on one terminal you could get an open trade on another.
Reason: