You don't need to add anything... It's already in the line.
I would like to ask Igor and everyone who writes regularly in this thread. I have browsed through the branch and did not find the function that determines the angle of the trend. Do you have a function that will determine the angle of the trend on a 15-minute chart for 6 or more candlesticks?
mazepa писал(а)>> I would like to ask Igor and everyone who writes regularly in this thread. I looked through the branch and did not find the function that determines the angle of the trend. Do you have a function that will determine the angle of the trend on a 15-minute candle at 6 or more candles?
We can talk not about the angle, but the rate of change in price
Greetings! Thanks for your work, you are doing a good job.
I am making an indicator but the EquationDirect function sometimes calculates the crossing point incorrectly :(
I have calculated the points of lines on my chart and attached them in a test indicator for clarity. The function does not calculate the intersection correctly with an offset, i.e. at some angle the formula in the function is not appropriate and it needs to be corrected in some way, so when it happens the calculations will be done by a different formula IMHO
#define CPR "DECIDE"#define mName "Signal"#property indicator_chart_windowexternint SignalBars=30;// кол-во баров для сигналаexternint TrendBars=300;// кол-во баров для т. линийexterncolor CostMaxColor=FireBrick;// цвет максимальной ценыexterncolor CostMinColor=SteelBlue;// цвет минимальной ценыexterncolor VLineColor=DarkSlateGray;// цвет минимальной ценыexterncolor TrendColor=Gray;// цвет трендовых линийexterncolor OrderColor=Green;// цвет сигнала ордераexterncolor LabelColor=Navy;// цвет меток// Инициализация - функция начальных установокint init(){if(!IsDemo())return(0);if( SignalBars<30) SignalBars=30;}// ДеИнициализация - функция завершения работыint deinit(){ObjectDelete("UpTrend");ObjectDelete("DownTrend");ObjectDelete("MaxCost");ObjectDelete("MinCost");ObjectDelete("SignOrder");ObjectDelete("Trend");ObjectDelete("Volume");}// СТАРТ - основная функция обработкиint start(){int bar;double val, upb, t1, t2, h1, h2;
val=173;
bar=iHighest(NULL,0,MODE_HIGH,100,0);
t1=Time[0]-273600;
h1=High[ bar];
t2= t1-518400;
h2=High[ bar]- val*Point;
SetTLine( TrendColor,"DownTrend", t2, h2, t1, h1, True,STYLE_SOLID,2);
upb= EquationDirect( t1, h1, t2, h2,Time[0]);
SetArrow(6,DarkViolet,"UpBorder",Time[0], upb,2);
SetVLine( VLineColor,"VLine",Time[0],STYLE_SOLID);}// --- ВСПОМОГАТЕЛЬНЫЕ ФУНКЦИИ ---// вертикальная временная линияvoid SetVLine(color cl,string nm="",datetime t1=0,int st=0,int wd=1){// Параметры:// cl - цвет линии// nm - наименование ("" - время открытия текущего бара)// t1 - время (0 - время открытия текущего бара)// st - стиль линии (0 - простая линия)// wd - ширина линии (1 - по умолчанию)if( nm=="") nm=DoubleToStr(Time[0],0);if( t1<=0) t1=Time[0];if(ObjectFind( nm)<0)ObjectCreate( nm,OBJ_VLINE,0,0,0);ObjectSet( nm, OBJPROP_TIME1, t1);ObjectSet( nm, OBJPROP_COLOR, cl);ObjectSet( nm, OBJPROP_STYLE, st);ObjectSet( nm, OBJPROP_WIDTH, wd);}// установка трендовой линииvoid SetTLine(color cl,string nm="",datetime t1=0,double p1=0,datetime t2=0,double p2=0,bool ry= False,int st=0,int wd=1){// Параметры:// cl - цвет линии// nm - наименование ( "" - время открытия текущего бара)// t1 - время открытия бара ( 0 - Time[10]// p1 - ценовой уровень ( 0 - Low[10])// t2 - время открытия бара ( 0 - текущий бар)// p2 - ценовой уровень ( 0 - Bid)// ry - луч (False - по умолчанию)// st - стиль линии ( 0 - простая линия)// wd - ширина линии ( 1 - по умолчанию)if( nm=="") nm=DoubleToStr(Time[0],0);if( t1<=0) t1=Time[10];if( t2<=0) t2=Time[0];if( p1<=0) p1=Low[10];if( p2<=0) p2=Bid;if(ObjectFind( nm)<0)ObjectCreate( nm,OBJ_TREND,0,0,0,0,0);ObjectSet( nm, OBJPROP_TIME1, t1);ObjectSet( nm, OBJPROP_PRICE1, p1);ObjectSet( nm, OBJPROP_TIME2, t2);ObjectSet( nm, OBJPROP_PRICE2, p2);ObjectSet( nm, OBJPROP_COLOR, cl);ObjectSet( nm, OBJPROP_RAY, ry);ObjectSet( nm, OBJPROP_STYLE, st);ObjectSet( nm, OBJPROP_WIDTH, wd);}// вычисление точки пересеченияdouble EquationDirect(double x1,double y1,double x2,double y2,double x){// Параметры:// x1,y1 - координаты первой точки,// x2,y2 - координаты второй точки,// x - значение, для которого вычислить Yif( x2== x1)return( y1);elsereturn(NormalizeDouble(( y2- y1)/( x2- x1)*( x- x1)+ y1,Digits));}// установка значькаvoid SetArrow(int cd,color cl,string nm="",datetime t1=0,double p1=0,int sz=0){// Параметры:// cd - код значка// cl - цвет значка// nm - наименование ("" - время открытия текущего бара)// t1 - время открытия бара (0 - текущий бар)// p1 - ценовой уровень (0 - Bid)// sz - размер значка (0 - по умолчанию)if( nm=="") nm=DoubleToStr(Time[0],0);if( t1<=0) t1=Time[0];if( p1<=0) p1=Bid;if(ObjectFind( nm)<0)ObjectCreate( nm,OBJ_ARROW,0,0,0);ObjectSet( nm, OBJPROP_TIME1, t1);ObjectSet( nm, OBJPROP_PRICE1, p1);ObjectSet( nm, OBJPROP_ARROWCODE, cd);ObjectSet( nm, OBJPROP_COLOR, cl);ObjectSet( nm, OBJPROP_WIDTH, sz);}
it is not because of the EquationDirect function, the calculation is correct, it is because of a bug in the terminal, the line is drawn with an offset
that is why I had to first determine the crossing point with Time[0] and then draw a trend line from the initial point to the crossing point with Time[0], in this case everything works fine
the rightmost time in the chart is needed for positioning the indicator signal switch icon (when the chart scale is changed), i.e. if you move the switch icon beyond the rightmost time, i.e. not yet reached, the icon switches (the signal for placing an order switches on or off, it means that you can prohibit or permit the EA to trade by switching the signal)
The lefthand time is determined as follows: we obtain the outermost bar visible on the chart
WindowFirstVisibleBar() and get the time Time[WindowFirstVisibleBar()]
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.
You don't need to add anything... It's already in the line.
Thank you very much!
Your thread is a treasure on the internet. I can't get enough of what I found.
You don't need to add anything... It's already in the line.
I would like to ask Igor and everyone who writes regularly in this thread. I have browsed through the branch and did not find the function that determines the angle of the trend. Do you have a function that will determine the angle of the trend on a 15-minute chart for 6 or more candlesticks?are there any functions that allow you to pull (trigger)
profile
template
???
I would like to ask Igor and everyone who writes regularly in this thread. I looked through the branch and did not find the function that determines the angle of the trend. Do you have a function that will determine the angle of the trend on a 15-minute candle at 6 or more candles?
We can talk not about the angle, but the rate of change in price
Greetings! Thanks for your work, you are doing a good job.
I am making an indicator but the EquationDirect function sometimes calculates the crossing point incorrectly :(
I have calculated the points of lines on my chart and attached them in a test indicator for clarity. The function does not calculate the intersection correctly with an offset, i.e. at some angle the formula in the function is not appropriate and it needs to be corrected in some way, so when it happens the calculations will be done by a different formula IMHO
screenshot
added via opera, not added in explorer
How can I determine the end time (from left) that is visible in the graph?
TimeCurrent()
TimeCurrent()
This seems to be on the right.
I already figured it out.
it is not because of the EquationDirect function, the calculation is correct, it is because of a bug in the terminal, the line is drawn with an offset
that is why I had to first determine the crossing point with Time[0] and then draw a trend line from the initial point to the crossing point with Time[0], in this case everything works fine
the rightmost time in the chart is needed for positioning the indicator signal switch icon (when the chart scale is changed), i.e. if you move the switch icon beyond the rightmost time, i.e. not yet reached, the icon switches (the signal for placing an order switches on or off, it means that you can prohibit or permit the EA to trade by switching the signal)
The lefthand time is determined as follows: we obtain the outermost bar visible on the chart
WindowFirstVisibleBar() and get the time Time[WindowFirstVisibleBar()]