//--------------------------------------------------------------------// 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()
}
//---------------------------------------------------------------------
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?
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.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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.
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.
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
...
will both warrants be placed or one?
There will be 0, 1 or 2 orders.
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.
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?
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
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 ?
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.