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

 
TarasBY:

There is one variable missing from the indicator call - the buffer!!!


It's working. Thanks again.
 

Question for connoisseurs.

There is a code on the real chart the comments are correct. in the strategy tester all values are equal to 2147483647

What is wrong here?

Or should we addEMPTY_VALUE to the check?

And should we always normalize obtained data from the indicators for comparing them to each other in 5 digits?

double adxLastBuy,adxLastSell,adxLast;

for (int i=0; i<Bars; i++)
{
   adxLastBuy=iCustom(NULL,0,"Adx_crossing",ADXbars,CountBars,0,i); if (adxLastBuy>0) break;
   
}
for (int j=0; j<Bars; j++)
{
   
   adxLastSell=iCustom(NULL,0,"Adx_crossing",ADXbars,CountBars,1,j); if (adxLastSell>0) break;
}

for (int k=0; k<Bars; k++)
{
   adxLast=iCustom(NULL,0,"Adx_crossing",ADXbars,CountBars,0,k); if (adxLast>0) break;
   adxLast=iCustom(NULL,0,"Adx_crossing",ADXbars,CountBars,1,k); if (adxLast>0) break;
}



 Comment("Цена последнего ADX Покупки: ", adxLastBuy, " Цена последнего ADX продажи: ", adxLastSell, " Последний сигнал ", adxLast );
 
Twilight:

Question for connoisseurs.

There is a code on the real chart the comments are correct. in the strategy tester all values are equal to 2147483647

What is wrong here?

Or should we add EMPTY_VALUE to the check?

And should we always normalize obtained data from the indicators for comparing them to each other in 5 digits?

It is obligatory when using iCustom. Like:
if(signal!=0 && signal!=EMPTY_VALUE){
   BuySignal=true;
}
 
mmm ...there's also a problem ...the beep sometimes sounds like it's set in the News.wav code and more often it rings Alert.wav

#property copyright "Copyright © 2012"
#property link      "Не ссать  против ветра "
 
 extern bool       Будильник      = true ;
 extern string SoundFile      =  "News.wav";
 
int start ()                                  
{
 double  a=iCustom(NULL,0,"HMA_Russian_Color",5,MODE_LWMA,PRICE_MEDIAN,"Uptrend[]",0); 
 double  b=iCustom(NULL,0,"HMA_Russian_Color",8,MODE_LWMA,PRICE_MEDIAN,"Uptrend[]",0); 
 
if (Будильник ==true)
{

  {
 if ( a > b ) 
       
 {  
  Alert("BUY
  PlaySound(SoundFile);
  Sleep(100000);
  }
 }
}


return(0);}
 
odiseif:
mmm ...there's also a problem ...the beep sometimes sounds like it's set in the News.wav code and more often it rings Alert.wav

Could you please tell me where the error is?
 

Please help me, tell me how to implement EA code in two or three lines:

When a signal comes in (e.g. crossing of two MAs)

1.Expert Advisor determines the time of the signal (in hours, minutes), stores it;

2. counts down one minute.

Next, readiness to do something (e.g. open an order)
 
Twilight:

Question for connoisseurs.

There is a code on the real chart the comments are correct. in the strategy tester all values are equal to 2147483647

What is wrong here?

Or should we add EMPTY_VALUE to the check?

And should we always normalize obtained data from the indicators for comparing them to each other in 5 digits?

The indicator buffer has a concept of "empty value". It (by default) equals EMPTY_VALUE, but it can be changed using the SetIndexEmptyValue() function. This is the value the buffer does not draw in the chart (if it draws at all). It is the missing value that needs to be checked, if necessary.
 
odiseif:
Mm ... there's also a problem ... the beep sometimes sounds like the News.wav code and more often it rings Alert.wav

There's some nonsense written here:

 double  a=iCustom(NULL,0,"HMA_Russian_Color",5,MODE_LWMA,PRICE_MEDIAN,"Uptrend[]",0); 
 double  b=iCustom(NULL,0,"HMA_Russian_Color",8,MODE_LWMA,PRICE_MEDIAN,"Uptrend[]",0);

Read about iCustom().

 
Andrey-F:

Please help me, tell me how to implement EA code in two or three lines:

When a signal comes in (e.g. crossing of two MAs)

1.Expert Advisor determines the time of the signal (in hours, minutes), stores it;

2.Countdown one minute.

Next, readiness to do some action (e.g. opening an order)

In a global variable you write the time value at the moment of the signal receipt:

    if (Signal) gdt_TimeSignal = TimeCurrent();

and then count down your minute (you can do this):

    if (gdt_TimeSignal != 0) if (iBarShift (NULL, 1, gdt_TimeSignal) == 1)
    {
        //---- Открываете ордер
        OrderSend ();
        gdt_TimeSignal = 0;
    }

This is one solution to track the time after an event has occurred.

 
TarasBY:

In a global variable, write the time value at the time of the signal:

and then count down your minute (you could do that):

This is one solution to tracking the time after some event has occurred.



Alternatively, you can set any time after the signal arrives
if (Signal) gdt_TimeSignal = TimeCurrent();
//
//
//
if (TimeCurrent()-gdt_TimeSignal >=60)
     {
     //
     }