[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 436

 
semiromid:

Прошу помощи .

Как в этот коментарий "Возникла ошибка " можно добавить переменную ?

OrderSend(Symbol(),OP_SELLSTOP,0.1,Ask-50*Point,3,Bid+150*Point,Bid-150*Point, "Возникла ошибка ", 0);


string Stroka;

double x;

.............

.............


Stroka=StringConcatenate("An error occurred ", DoubleToStr(x, 0) );

OrderSend(Symbol(),OP_SELLSTOP,0.1,Ask-50*Point,3,Bid+150*Point,Bid-150*Point, Stroka, 0);

 
bercut0077:

Good afternoon experts, in the indicator I am interested in the value obtained by the Expert Advisor

Special constants used to indicate the state of parameters and variables. Can be the following values:

Constant Value Description
NULL 0 Indicates empty string state
EMPTY -1 Indicates empty state of parameter
EMPTY_VALUE 0x7FFFFFFFF Default value, pointer to an empty value. Used in custom indicators
CLR_NONE 0xFFFFFFFFFF Indicates no colour
WHOLE_ARRAY 0 Used with array functions. Indicates that all elements of an array must be processed


0x7FFFFFFFF in hexadecimal is equal to 2147483647 in decimal.

I.e., at some moment, an empty value appears in the indicator buffer - this is what you see in the Expert Advisor. You can set the "empty value" of the indicator buffer:

void SetIndexEmptyValue( int index, double value)

Sets the empty value for the indicator line. Blank values are not drawn or shown in the DataWindow. The default value of the empty value is EMPTY_VALUE.
Parameters:
index - Index - serial number of the line. Must be from 0 to 7.
value - New "empty" value.
 
peshihod:


I.e. opening time doesn't matter whether it was opened a minute ago or two?

Point 2 is not clear. It's all a bit vague.

The opening time can be determined by OrderOpenTime().

I.e. the moment of opening doesn't matter, was it opened a minute ago or two?


Мгновенное открытие

1.Моментальное(Сиюсекундное +0.5 - 2 секунды) определение вновь открывшегося торгового(не отложеных ордеров) ордера(Ордера открытого вручную и открытого спомощью советника).Система идентефецируюет ордер из друх вариантов (Sell или Byu) .

Если система определила ордер который рание не был открыт . то идет продолжение под номером 2.

2. Выполняеться какая то задача (Например,если Sell: Alert("Открытый ордер на продажу"+y);),(Например,если byu: Alert("Открыт ордер на покупку"+w);), всего 1-н раз,именно для этого ордера .

После того как еще открылся один ордер(толи системой, толи вручную ), система вновь действует с пункта 1 по пункт 2 .

 
peshihod:

string Stroka;

double x;

.............

.............


Stroka=StringConcatenate("An error occurred ", DoubleToStr(x, 0) );

OrderSend(Symbol(),OP_SELLSTOP,0.1,Ask-50*Point,3,Bid+150*Point,Bid-150*Point, Stroka, 0);


Nice combination. Um...
 
artmedia70:

Special constants used to indicate the state of parameters and variables. Can be the following values:

Yes it is clear, but it is not clear how to cure the indicator from these empty values, that's why I published the code, I need real help, i.e. I need the indicator to output always 1 or -1.
 
bercut0077:
Yes it is clear, but it is not clear how to cure the indicator of these empty values, that's why I published the code, I need real help, i.e. I need that the indicator would always output 1 or -1.
I have provided an example of a function that sets the value of an empty value for an indicator line. You can do it in a different way. If you need only two values +1 and -1, then when an empty value appears, check the past state (+1 or -1) and enter it instead of the empty value. Then there will always be either +1 or -1 in the buffer.
Suppose there is a value of +1. An empty value appears. Instead, continue entering the previous value (+1) into the buffer as soon as -1 appears, then enter it into the buffer.
There will now be -1 in the buffer. As soon as an empty value appears, you check the previous value (it is now -1), and enter it in the buffer.
This way you will always have +1 or -1 in the buffer
 
artmedia70:

Thank you. Another task has come up...
 
semiromid:

1.Моментальное(Сиюсекундное +0.5 - 2 секунды) определение вновь открывшегося торгового(не отложеных ордеров) ордера(Ордера открытого вручную и открытого спомощью советника).Система идентефецируюет ордер из друх вариантов (Sell или Byu) .

Если система определила ордер который рание не был открыт . то идет продолжение под номером 2.

2. Выполняеться какая то задача (Например,если Sell: Alert("Открытый ордер на продажу"+y);),(Например,если byu: Alert("Открыт ордер на покупку"+w);), всего 1-н раз,именно для этого ордера .

После того как еще открылся один ордер(толи системой, толи вручную ), система вновь действует с пункта 1 по пункт 2 .


I understand that a pending order and an open order are different orders. And if the pending order is opened, then the task is reduced to the initial one, to the open order. If I understand it correctly, it is getting very complicated.

What are the tasks? Maybe, everything can be done in a simpler way?

 
Dear experts help to change the code, we need to get
Cur_Trend без пустой величины, тоесть если появляется пустота, то нужно заменить последним известным значением
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LightBlue
#property indicator_color2 Magenta

double CrossUp[];
double CrossDown[];
double Cur_Trend[];
int CurrentTrend = 0;
int starttime = 0;
extern int FasterEMA = 5;
extern int SlowerEMA = 8;

int init()
  {
   IndicatorBuffers(3); 
   SetIndexStyle(0, DRAW_ARROW, EMPTY);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, CrossUp);
   SetIndexStyle(1, DRAW_ARROW, EMPTY);
   SetIndexArrow(1, 234);
   SetIndexBuffer(1, CrossDown);
   SetIndexBuffer(2, Cur_Trend);
   starttime = TimeLocal(); 
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start() { 
   int limit, i, counter, loop, ii;
   double fasterEMAnow, slowerEMAnow, fasterEMAprevious, slowerEMAprevious, fasterEMAafter, slowerEMAafter;
   double Range, AvgRange;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   loop = 0;
   for(i = 0; i <= limit; i++) {
      counter=i;
      Range=0;
      AvgRange=0;
      for (counter=i ;counter<=i+9;counter++)
      {
         AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
      }
      Range=AvgRange/10;
      fasterEMAnow = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i);
      fasterEMAprevious = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i+1);
      fasterEMAafter = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i-1);
      slowerEMAnow = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_OPEN, i);
      slowerEMAprevious = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_OPEN, i+1);
      slowerEMAafter = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_OPEN, i-1); 
      if ((fasterEMAnow > slowerEMAnow) && (fasterEMAprevious < slowerEMAprevious) && (fasterEMAafter > slowerEMAafter)) {
         CrossUp[i] = Low[i] - Range*0.5;
         if ((loop == 0) && (CurrentTrend != 1))  {
            CurrentTrend = 1;
            Cur_Trend[ii]= CurrentTrend;
            }
         if (loop == 0)  {
            loop = 1;
            }
      }
      else if ((fasterEMAnow < slowerEMAnow) && (fasterEMAprevious > slowerEMAprevious) && (fasterEMAafter < slowerEMAafter)) {
              CrossDown[i] = High[i] + Range*0.5;
           if ((loop == 0) && (CurrentTrend != -1))  {
              CurrentTrend = -1;
              Cur_Trend[ii]= CurrentTrend;
           }
           if (loop == 0)  {
              loop = 1;
          }
       }
   }
   return(0);
}
 

Dear experts!

I need your help with the following question. I have a custom indicator that draws a two-color line with one colour then another one. Is there any way to teach the Expert Advisor to determine which colour the line is at the moment?

Files:
Reason: