How to calculate the absolute angle of the 'Line' Chart both in real time and for previous points and ranges in the chart ?
CloudBreaker:
Trend Slope Retracement is what I think you are looking for.
.
Likewise thanks for the info on the ‘Trend Slope Retracement’ I’ll look into it. I assume that this is a MQL4 function. Do you know if it is ‘absolute’ in the sense that it will return the actual slope accurately regardless of the scaling of the chart or the aspect ratio of the monitor? If not, then I would need to know that info and recalculate the absolute correct angle from it. This would significantly increase the load on the computer which I already have concerns about without having to compensate for these ‘error inducing factors’. Though I suppose I would only have to calculate it once for each chart and then use this factor to correct it. The downfall of this approach is that I would think that the ‘scaling’ of charts changes dynamically to suit the current existing conditions. I’m not concerned about the slope appearing correctly in a chart, but want the correct value to utilize in further calculations, functions, operations and conclusions.
One thought I had on this was that if I was unable to find a function to do this was to use a moving average indicator with a time period of 1 with no offset and utilizing a simple curve with the closing value. This exactly follows the ‘line’ in the ‘Line’ chart mode. But this approach would also suffer from the error inducing factors of chart scaling and monitor aspect ratio. Though I would like to use the ‘tick by tick’ time frame this approach may put too much of a load on the computer and bog it down to the point where it is useless, especially as I want to use it on 15 or 20 charts simultaneously.
CB:
Thought I'd seen a post from DougRH4x regarding FXigor, but may be losing the plot.
In my search of MQL4 on this subject, I found one where either Phy I believe it was, who has over 1200 postings so trying to find it again by that route is a formidable task; or tt might have been NakedBear, but I don’t think it was him. I hope he has grown at least some fur for winter (< 8) Whoever it was they posted a short bit of code in response to a similar question but I am unable to find it again.
As I said in my initial posting on this subject that I strongly suspect that as it is one of three possibilities for chart illustration, that there must be a constant streaming data flow from the brokers, which is then calculated by MT to write to the chart in the mode that the user selects. Thus this functionality must be part of the MT4 client code. The question is what that streaming data flow is and how to access it as directly as possible and utilize it.
Hi CloudBreaker,
I found the articles on the wWw about ‘Trend Slope Retracement’ by FxIgor and I agree with you that is probably what the reference to TSR (https://forum.mql4.com/27156) was that I found in my search for ‘How to calculate the absolute angle of the 'Line' Chart both in real time and for previous points and ranges in the chart ? == https://www.mql5.com/en/forum/121563 .
I erroneously made that assumption that the info you gave me on TSR was for the calculation of the absolute angle.
.
Ah communication at its finest LoL I’m guilty of making that incorrect assumption, and I’m sure you know the clique about making assumptions. Well I got caught out by it.
.
But that still leaves me with the qundry about how to find the Abolute angle of the 'Line' in Line Charts.
.
Thanks for the info and TTFN (TaTa for Now (< 8)
D
You can always derive the angle quite simply, but for it to be 'absolute' requires a fixed baseline, probably using minutes
The calculation is thus time (as a constant number of minutes) as the base of a triangle, the 'opposite' (i.e. vertical) side of the triangle calculated as price-change (up or down) in that time
You now have opposite/adjacent giving you the tangent ratio and hence the angle (if you really want it)
On similar posts I have often said that the tangent ratio alone may be enough
FWIW
-BB-
D
You can always derive the angle quite simply, but for it to be 'absolute' requires a fixed baseline, probably using minutes
On similar posts I have often said that the tangent ratio alone may be enough
I've previously described angles as arbitrary, and I'll have another go at explaining why. Let's boil it down to the simplest possible terms, and say that you have two data points - the closes on two consecutive days - and you want to find the angle of the line connecting them. And you decide to do this manually, on paper. (It's no different in principle to having a computer do it for you.)
Your data points are 1.4328 on November 2nd, and 1.4562 on November 3rd. Your first decision is how far apart to draw the days on the x axis of your manual chart. 10cm apart? 20cm? 5cm? Once you've made that decision, you now need to choose a scale for the y axis. How far apart are 1.4328 and 1.4562 going to be? 10cm? 20cm? A metre?
Each of these decisions affects the angle of the line you end up drawing between the two points. Unless you have a reason for choosing the scale of each axis - i.e. some particular significance attached to choosing 5cm or 20cm - then the angle of the line between the points is arbitrary. And meaningless, except in relative terms compared with other angles drawn using the same scale - at which point all you have is a cumbersome way of comparing growth over a period. And, even if you do have a rationale for selecting a scale, you've then got the additional problem that scales in pixels can vary in their visual representation from one computer monitor to another...
Hi and thanks for responding,
I'm familiar with trig and am able to calculate the needed angles from the data, though I am wondering about calculus and integration capabilities in MQL as well. From other info in this forum on this topic, the problem of the distortion and the variance from the absolute angle due to the dynamic scaling of the charts as well as the aspect ratio of the monitor in use have been accurately brought to light as factors that affect and distort the absolute angle of the slope (dynamically) to represent it on the charts. Also as you correctly point out I will have to decide on and fix the scales of the charts that are optimal for my purposes. I do not care about the charts and the angles portrayed on them at all. I am concerned with consistent and reliable mathematical results, thus factors such as pixels are completely irrelevant and meaningless in this context. Though I will be very glad when I get my very high resolution professional graphics monitor repaired and up and running again and can send this horrible one to the recycler where it belongs. I literally cannot always make out the prices on the right hand side of the charts accurately regardless of what I do on this old monitor )< 8) The only worse one I have ever had was a piece of slate (< 8)
I am also looking for a sampling resolution much higher and finer than 1 minute. Down to the tick level, though this will be an adjustable variable both for operation of the EA as well as making adjustments to make allowances for what data feed and the computer can handle and process in real time without bogging down. As the ‘Line’ chart is one of the three types of chart representations in MT4, I would think that this info must be part of the streaming data feed from the broker and I’m wondering if this isn’t streamed in AS an angle which I would then utilize directly, with a compensating fixed factor if needs be, in Isochronous time as opposed to the Delta (differentials) in this data at (fairly) regular intervals. I only care about the Delta T & $ = change in time verses the change of price in Isochronous time. I want to be able to pull this info directly off of the broker feed and access and utilize it with the minimum prior processing by MT4 before I can process it. Using a one minute moving average with the ‘simple’ representation method at the closing/current price with no offset is identical to the angles of the ‘Line’ in a one minute line chart of as opposed to a bar or candlestick chart gives a line pretty well identical to what I am looking for, though as I said, I do want a shorter time frame than one minute. Though we know that if the data feed and the computer are not lagged, bogged down, and having drop outs the line/level/price does constantly change as opposed to being stationary until the fixed time intervals that the chart is using has elapsed and only then moves at these quantum levels. In this matter, from what I have heard of MQL5, they have done away with a fixed number of options of time intervals. Also wnat to obtain as direct access as is possible in Isochronous time for the Bid and Ask prices at the same resolution with the minimum interference and processing of the MT4 terminal before I utilize it as well. If I have no other choice, which I don’t think is the case, I can lock the charts to a fixed 1 to 1 ratio is one option to handle the distortion that the dynamic scaling of the ‘charts’ brings into it. The aspect ratio of the monitor can be factored in if needs be by a simple fixed ratio, though not a preferable one due to the further needless added processing load and overhead to calculate this and ‘write’ it onto the charts on the monitor. As I said I don’t care about the charts at all and most likely will not even use them nor any indicators if at all possible. But the problem is how to utilize the EA without charts as they generally work by attaching them to charts. I did open a demo account on Alpari UK once and was amazed that for such a well known ForEx broker there implementation of MT4 was so poor that they did not have any charts at all available to utilize that I could find. But it this is the case, then it confirms my ideas and illustrates that it would be possible to do what I want without charts at all. If I can access and utilize the info directly from the data stream that I want to use without charts at all, it will significantly cut down much needless processing load and overhead which is important because the EA will need to process and calculate the data from as many ForEx currency pairs as possible (>=20) in as close to Isochronous time as I can get it so that the computer can respond as Isochronously as possible without lags.
I see in the Tools menu of MT4 that there is the ability to make trades from there with no charts.
The question is now how to utilize an EA without any charts?
I've previously described angles as arbitrary, and I'll have another go at explaining why. Let's boil it down to the simplest possible terms, and say that you have two data points - the closes on two consecutive days - and you want to find the angle of the line connecting them. And you decide to do this manually, on paper. (It's no different in principle to having a computer do it for you.)
Your data points are 1.4328 on November 2nd, and 1.4562 on November 3rd. Your first decision is how far apart to draw the days on the x axis of your manual chart. 10cm apart? 20cm? 5cm? Once you've made that decision, you now need to choose a scale for the y axis. How far apart are 1.4328 and 1.4562 going to be? 10cm? 20cm? A metre?
Each of these decisions affects the angle of the line you end up drawing between the two points. Unless you have a reason for choosing the scale of each axis - i.e. some particular significance attached to choosing 5cm or 20cm - then the angle of the line between the points is arbitrary. And meaningless, except in relative terms compared with other angles drawn using the same scale - at which point all you have is a cumbersome way of comparing growth over a period. And, even if you do have a rationale for selecting a scale, you've then got the additional problem that scales in pixels can vary in their visual representation from one computer monitor to another...
What scale is used by the Trend by Angle tool? Once you draw that line and drag the price or the time around on the chart the Trend by Angle line remains constant, everything else around it changes. So when it is first drawn what scale is it using on the chart for the two points it makes??
You expect a reply to a 2 year old thread ?
Well you just replied to a 2 year old thread didn't you?! But I'm not sure what the age of the thread has to do with asking what scale the Trend by Angle tool uses in a similar thread.
At least I just didn't post a question blind without trying to do some research (as everyone on forums always says to do) first.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
The subject line pretty well covers it: I am trying to figure out how to calculate the absolute Angle/Slope of the actual 'Line' of Line Charts as opposed to the CandleSticks or Bar charts: both in real time on every tick as well as being able to specify the number of ticks or to calculate the slope between the trade closing prices in the various time frames Likewise to provide the absolute angle for any given prior point or range of the charts. I need it to be 'absolute' at all times as opposed to the slope being changed by the scaling of the chart or the aspect ratio of the monitor.
I wonder if there is actually a data feed for this variable directly from the broker as it is one of the 3 standard currency pair indicators that are on all (MQ) charts?
.
.
(8 >) Thanks to all who are able to assist me with this (< 8)
.
PS: If anyone knows how to calculate the exact angle of the Line in the line charts ahead of the current moment in time, well then .. . LoL