This is one of the functions that are implemented by Expert Advisors. Of course, you can write an EA, which will contain only a trailing stop (and of course such EAs are already written in large quantities)
In the MT terminal there is a standard trailing stop, not associated with any Expert Advisor.
The MT terminal has in-house trailing, not related to any Expert Advisor.
Thank you. That's exactly what I was asking about. Another question then. How long did it take to understand MQL4? I don't mean to become a pro and write a thoroughly awesome Expert Advisor. I don't mean to become a pro to write a cool EA from A to Z, but at least know what to tweak when writing an already existing one. To make it clearer about myself: At this stage I'm mastering operators. It has been two weeks since I started studying them. What do you think the chances are. I repeat. Teacher is not around to ask no one.
I want to choose a foreign brokerage company, and open an account overseas... I can not find .... on reviews, it feels like a scam and a "shark's office" ....(
Help guys with MT4.... I will be very grateful!!!!!
I don't know if I'm in the right place, this is my first post on the forum.
I'm asking for help.
Maybe someone has encountered something similar.
The problem is as follows. I'm writing an indicator for finding the maximum and minimum of price for a period. I want to divide max by min and display it in separate_window.
But the window is empty:
When adding, subtracting, multiplying, etc. MAXIMUM and MINIMUM the indicator displays normally.
Here is the code. It is not much at all.
#property indicator_separate_window#property indicator_buffers 3#property indicator_color1 MediumSpringGreen#property indicator_color2 Crimson#property indicator_color3 LightGray#property indicator_width1 1#property indicator_width2 1#property indicator_width3 1externint Buy_bars = 20; //Количество баров для открытия позицииexternint Sell_bars = 23; //Количество баров для закрытия позиции double buf_0[], //индикаторныЙ массив максимумов
buf_1[], //индикаторныЙ массив минимумов
buf_sr[] ; //индикаторныЙ массив средних значений//extern int Shift = 0;int init()
{
SetIndexBuffer (0, buf_0);
SetIndexStyle (0, DRAW_LINE);
SetIndexLabel (0, "Maximum");
SetIndexShift (0, 0);
SetIndexBuffer (1, buf_1);
SetIndexStyle (1, DRAW_LINE);
SetIndexLabel (1, "Minimum");
SetIndexShift (1, 0);
SetIndexBuffer (2, buf_sr);
SetIndexStyle (2, DRAW_LINE);
SetIndexLabel (2, "Srednyaya");
SetIndexShift (2, 0);
return;
}
//+------------------------------------------------------------------+//| Custom indicator deinitialization function |//+------------------------------------------------------------------+int deinit()
{
//----//----return(0);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+int start()
{
int i, k ,t;
int counted_bars=IndicatorCounted();
//----
i = Bars - counted_bars - 1;
while (i >= 0)
{
double max = 0;
double min = 999999999999.99;
for (k=i ; k<=i+Buy_bars-1; k++)
{
if (High[k] > max) max = High[k];
}
for (t=i; t<=i+Sell_bars-1; t++)
{
if (Low[t] < min) min = Low[t];
}
i--;
buf_sr[i] = (max/min);
}
return;
}
//+------------------------------------------------------------------+
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.
This is one of the functions that are implemented by Expert Advisors. Of course, you can write an EA, which will contain only a trailing stop (and of course such EAs are already written in large quantities)
In the MT terminal there is a standard trailing stop, not associated with any Expert Advisor.
The MT terminal has in-house trailing, not related to any Expert Advisor.
Thank you. That's exactly what I was asking about. Another question then. How long did it take to understand MQL4? I don't mean to become a pro and write a thoroughly awesome Expert Advisor. I don't mean to become a pro to write a cool EA from A to Z, but at least know what to tweak when writing an already existing one. To make it clearer about myself: At this stage I'm mastering operators. It has been two weeks since I started studying them. What do you think the chances are. I repeat. Teacher is not around to ask no one.
Appreciate the answers.
Guys, this is the worst!!!(((
I want to choose a foreign brokerage company, and open an account overseas... I can not find .... on reviews, it feels like a scam and a "shark's office" ....(
Help guys with MT4.... I will be very grateful!!!!!
One line indicator.
Question.
Why does it draw a line from right to left?
How about this?
Hello, could you please tell me where to find an indicator that re-draws the daily bars so that they start at a different time.
For example: Terminal time is 00:00. In the input parameters of indicator we put: +4. Now the daily bars start at 4:00.
Thank you in advance.
What if you do this?
Yes, that's better. Started to draw in the right direction. But if index--, then one day it becomes index==0 and everything is shut down.
How do you make the movement continue?
Where do I increase the size of the array? Where do I write the value? ( ArrayResize() function)
sorting into arrays by oreder and position types worked out:
but I can't sort them further by profitability of buy and sell positions: it inserts zeros:
Why? I don't understand
Hello friends!
I don't know if I'm in the right place, this is my first post on the forum.
I'm asking for help.
Maybe someone has encountered something similar.
The problem is as follows. I'm writing an indicator for finding the maximum and minimum of price for a period. I want to divide max by min and display it in separate_window.
But the window is empty:
When adding, subtracting, multiplying, etc. MAXIMUM and MINIMUM the indicator displays normally.
Here is the code. It is not much at all.
Point out the error.
Thank you in advance.