[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 82

 
Leo59:
How do I correctly attach one indicator to another via iCustom()?
I have one indicator in which all 8 indicator arrays are occupied. How to create correctly the second one, so that it draws the curve from the first indicator in 1 indicator array?
Both indicators #property indicator_chart_window.
The most obvious explanation, is the analogue in the form of the code of the two linked indicators.
Thank you in advance!!!


Wouldn't it be easier to just put two indicators on the chart?
 
How to correctly attach one indicator to another via iCustom()?
I have one indicator in which all 8 indicator arrays are occupied. How to create a second one, so that it draws the curve of the first indicator in 1 indicator array?
Both indicators #property indicator_chart_window.
The most obvious explanation is the analogue in the form of the code of the two linked indicators.
Thank you in advance!!!
 
Leo59:
How to attach one indicator to another via iCustom()?
I have one indicator in which all 8 indicator arrays are occupied. How to create a second one, so that it draws the curve of the first indicator in 1 indicator array?
Both indicators #property indicator_chart_window.
The clearest explanation is the analogue in the form of the code of the two linked indicators.
Thank you in advance!!!

Do you need someone to write it for you?

Read in the second indicator the buffer of the first one by iCustom(). Put the second indicator on the chart - it will draw the necessary line.

If it is not clear, start to write the code and post here all unclear things - they will explain, help and advice.

 
artmedia70:
If (4<5) is true, then the following line is executed: if(5<6), but... if (4<5) is false, then the next if () along with its print are not processed, but pass to the closing parenthesis of if (2<3).


I still think you're wrong. Any IF group is executed sequentially as long as they are not separated by brackets {}.

for example

int start

{

if (...)print (1)

if (...) print(2)

if (...) print (3)

}

return;

=======================================================

prints will work IF the conditions are met. But if condition 1 is not met, the second one doesn't care about it. It works by itself, without any obeying.

Well, I think NOTHING changes if this IF group is inside some other subconditions, the main thing is that there are NO brackets between these three and they run in series independent of each other, and only their statements (after if ) will depend on the value of if itself (using princes as an example)

so your code3>4>5>5>6 is independent of each other and will work ANYWHERE if2>3

//+----------------------------------------------------------------------------+
if (1<2) {                                // Если один меньше два и ...
   if(2<3) {                              // ... два меньше три, ...
      if (3<4) PlaySound("alert.wav");    // Если три меньше четыре - врежем рок в этой дыре ... (С), 
                                          // Далее пойдём проверять остальные условия:
      if (4<5)                            // Если четыре меньше пять и ...
      if (5<6) Print("Истина");           // ... пять меньше шесть - верно, блин...
      }
   }
//+----------------------------------------------------------------------------+
 
lottamer:


I still think you're wrong. Any IF group is executed sequentially as long as they're not separated by {} brackets.

such as this

int start

{

if (...) print (1)

if (...) print(2)

if (...) print (3)

}

return;

=======================================================

prints will work IF the conditions are met. But if condition 1 is not met, the second one doesn't care about it. It works by itself, without any obeying.

Well, I think NOTHING changes if this IF group is inside some other subconditions, the main thing is that there are NO brackets between these three and they run in series independent of each other, and only their statements (after if ) will depend on the value of if itself (using princes as an example)

Just write a script by my code and change signs more to less in ifs - see for yourself :)

I don't think it's necessary to argue.

 

Compare these two constructions, what is the difference?

Like this:

//+----------------------------------------------------------------------------+
if (1<2) {                                // Если один меньше два и ...
   if(2<3) {                              // ... два меньше три, ...
      if (3<4) PlaySound("alert.wav");    // Если три меньше четыре - врежем рок в этой дыре ... (С), 
                                          // Далее пойдём проверять остальные условия:
      if (4<5)                            // Если четыре меньше пять и ...
      if (5<6) Print("Истина");           // ... пять меньше шесть - верно, блин...
      }
   }
//+----------------------------------------------------------------------------+

And like this:

//+----------------------------------------------------------------------------+
   if (1<2)                               // Если один меньше два и ...
   if(2<3) {                              // ... два меньше три, ...
      if (3<4) PlaySound("alert.wav");    // Если три меньше четыре - врежем рок в этой дыре ... (С), 
                                          // Далее пойдём проверять остальные условия:
      if (4<5)                            // Если четыре меньше пять и ...
      if (5<6) Print("Истина");           // ... пять меньше шесть - верно, блин...
      }
//+----------------------------------------------------------------------------+

And justify your conclusions.

 

I'll give you a hint:

What is an operator for the condition if(4<5)?

 
pu6ka:

In order not to open on every tick and to optimise the EA faster, I often use this design:

This way, when a new bar appears, the code will be executed once.

Read how to use MagicNumber in orders and then using total < 1 will enable the EA to open an order for each currency pair and for one currency pair but open in different windows. You can see a sample here.


Thank you very much, I followed your advice (timed it out), very helpful, everything works as it should!!!
 

Good afternoon,

Is it acceptable to use complex compound conditions, such as :

if(condition1 || (condition2 && condition3)){...};

?

Thank you.

 
artmedia70:

I'll give you a tip:

What is an operator for the condition if(4<5)?


now that's a good question! :)))

If the compiler does not throw an error in this place, then you are right :))

Reason: