[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 278

 
waitra >> :

Exactly what you need!

Can you tell me how to insert this code correctly into this grid?

(if I put it directly, the tester just stops at the opening of the first position)

I'm a little hesitant about this. I'm not even sure if it will work.

//-----------------------------------------
//Открытие позиции:



bool Open_Buy() {

//------------------------------

for (int v=0; v<OrdersTotal(); v++)                             {       
      if (OrderSelect( v, SELECT_BY_POS, MODE_HISTORY))               {           
        if (OrderSymbol()==Symbol() && OrderMagicNumber()== Magic)     
                                 условие_2 = true ; 
         if (OrderSymbol()==Symbol() && OrderMagicNumber()!= Magic)     
                                 условие_2 = false; 
                                    }
                                 }
//--------------------------------------------------------------


   bool res=false; 

if( условие_1)      {

            if ( условие_2 == false)    {

                    res=true;     }}

else    {

    if( условие_1)       { 

   if ( условие_2 == true  )       { 

   res=true;     }}}

return( res);

 
No. This will not work. You have to specify condition_2 in some other way
 

Gentlemen! What did I write wrong in the script....?

int start()

{

//----------------------------------

int i,counted_bars=IndicatorCounted();

i=Bars-counted_bars-1;

for(i=0; i<Bars; i++)

double a = Open[i]-Close[i];

//----------------------------------

if ( a > 0 )

{

Alert ("candle is BAD");

}

else

//----------------------------------

if ( a < 0 )

{

Alert ("the candle is BULLED");

}

//----

return(0);

}

//+---------------------------------

The task was to determine and output a message that Bar #1 is Bull or Bear. At the same time define and output a message for the subsequent Bar. Don't judge too severely)))

 

Everything below

"

double a = Open[i]-Close[i];

//----------------------------------

"

counts once for i equal to Bars-1.


Instead of for-cycle, put double a = Open[1]-Close[1]; since you need to make calculation for the first bar.

int start()//+----------------------------

{  double a = Open[1]-Close[1];

   if ( a > 0 ) Alert ("свеча МЕДВЕЖЬЯ");

   if ( a < 0 ) Alert ("свеча БЫЧЬЯ");

return(0);
}//+--------------------------------------
 
Urain >> :

Everything below

"

double a = Open[i]-Close[i];

//----------------------------------

"

counts once for i equal to Bars-1.


Instead of for-cycle, put double a = Open[1]-Close[1]; if you need to do calculation for the first bar.

I've already tried it this way. Message was outputted every TIC for some reason?

 
Urain >> :

Everything below

"

double a = Open[i]-Close[i];

//----------------------------------

"

counts once for i equal to Bars-1.


Instead of for-cycle, put double a = Open[1]-Close[1]; since you need to make calculation for the first bar.

Thank you! But why does it output the message now only once, and not every formed candle #1????

 
chaynik_1 >> :

Thank you! But why does it output the message only once now, and not every formed candle #1????

So you said you have a script, make an indicator that will print on every tick, but perepeshite Alert on Comment and get tired of every tick to get Alerts or protect against triggering on every tick put.

 
Urain >> :

So you said you have a script, make an indicator that will print on every tick, but move Alert on Comment and get tired of every tick to get Alerts or protect against triggering on every tick.



All figured it out, it works! Thank you again! Nicholas, and a question on Skype?

 
chaynik_1 >> :

Got it, it's working! THANK YOU again!!! Nikolai, can I ask you a question on Skype?

Email me on Skype or in private.

 
rid писал(а) >>
No. That would not work. We have to set condition_2 in some other way

Could there be a function that simply detects that "there are no orders in the EA history yet"? - that would be enough

Reason: