Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 195

 
Zhunko:
The library. The library has everything for that. Sections 4.3 and 4.6.


Vadim: anecdote.

The zootechnician inseminates the cows with a syringe and leaves. A beautiful woman waits at the exit and asks for a kiss.

 
neon51r:

Hello!

I'm asking for help from professionals.

Please advise how to implement the function of redrawing the lines after the appearance of a new candle. and for different timeframes.

The idea of the indicator is very simple - it looks at high and low of the previous candle, adding 50 points to high and 50 points to low.

Thank you.



It's from a textbook.

//--------------------------------------------------------------------
// userindicator.mq4 
// Предназначен для использования в качестве примера в учебнике MQL4.
//--------------------------------------------------------------------
#property indicator_chart_window    // Индик. рисуется в основном окне
#property indicator_buffers 2       // Количество буферов
#property indicator_color1 Blue     // Цвет первой линии
#property indicator_color2 Red      // Цвет второй линии
 
double Buf_0[],Buf_1[];             // Объявление массивов (под буферы индикатора)
//--------------------------------------------------------------------
int init()                          // Специальная функция init()
  {
   SetIndexBuffer(0,Buf_0);         // Назначение массива буферу
   SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);// Стиль линии
   SetIndexBuffer(1,Buf_1);         // Назначение массива буферу
   SetIndexStyle (1,DRAW_LINE,STYLE_DOT,1);// Стиль линии
   return;                          // Выход из спец. ф-ии init()
  }
//--------------------------------------------------------------------
int start()                         // Специальная функция start()
  {
   int i,                           // Индекс бара
       Counted_bars;                // Количество просчитанных баров 
//--------------------------------------------------------------------
   Counted_bars=IndicatorCounted(); // Количество просчитанных баров 
   i=Bars-Counted_bars-1;           // Индекс первого непосчитанного
   while(i>=0)                      // Цикл по непосчитанным барам
     {
      Buf_0[i]=High[i]+50*Point;             // Значение 0 буфера на i-ом баре
      Buf_1[i]=Low[i]-50*Point;              // Значение 1 буфера на i-ом баре
      i--;                          // Расчёт индекса следующего бара
     }
//--------------------------------------------------------------------
   return;                          // Выход из спец. ф-ии start()
  }
//---------------------------------------------------------------------
 

help with syntax

int k=OrdersTotal();

//+---set orders if there are no orders
if (k==0) {OrderSend(Symbol(),OP_BUYSTOP,v,PriceBs+Tp*Point,0,Sl,PriceBs+2*Tp*Point,NULL,mn,0,Red)

OrderSend(Symbol(),OP_SELLSTOP,v,PriceSs-Tp*Point,0,Sl,PriceSs-2*Tp*Point,NULL,mn,0,Gold) ; }


will both orders be placed or just one?

I need owls to place two pending orders if there are no orders

 
sdm:

...

will both warrants be placed or one?



There will be 0, 1 or 2 orders.
 
neon51r:

Hello!

I'm asking for help from professionals.

Please advise how to implement the function of redrawing the lines after the appearance of a new candle. and for different timeframes.

The idea of the indicator is very simple - it looks at high and low of the previous candle, adding 50 points to high and 50 points to low.

Thank you.


As soon as the new candle arrives, it will re-draw itself.

 
Integer:

It will be 0, 1 or 2 orders.

it needs to put both orders when there are no orders

I do not understand how it works. According to the tutorial, it looks like it will place the first order and the second only if there are orders, but how should I make it place both of them if the condition is fulfilled and none of them if the condition is not fulfilled?

 
sdm:

i need it to place both orders when there are no orders

or i did not set the condition correctly? i do not understand how it works if in the tutorial it looks like it will place the first order and the second only if there are orders, but how should i make it place both if the condition is met and none if the condition is not met


It's OK with the condition, both requests will be set, but no one can guarantee that they will both be executed.
 

int x=0, a=0, b=0

if (x==0) {

}

what should I write in brackets, so that a takes value 1 and b takes value 1 ?

 
sdm:

int x=0, a=0, b=0

if (x==0) {

}

what should I write in brackets, so that a takes value 1 and b takes value 1 ?


The easiest way is to write {a=1; b=1}, but you can invent some nice multi-page formula to calculate them if you really want to.
 

Who is in the know, please explain:

Why do crosses have a much larger spread?

Thank you.