I have a script that creates trend lines. that I use to
When I create a trend line using this class, with 2 points, it shifts the second point price a little lower then point 2.
For instance, EURUSD 4H I use:
line.Create(0,line_name,0,dt1,pr1,dt2,pr2)
and the line is created at dt1,pr1,dt2,pr2 - x pips
When I change the class to CChartObjectTrend instead of the CChartObjectTrendByAngle, the line is created ok.
Thanks,
From bried reading, it seems it talks about the magnet sensitivity which is relevant when you draw objects manually.
If I draw using standard library class as mentioned above, by giving exact 2 points (date + price), what can be the problem?
Thanks,
From bried reading, it seems it talks about the magnet sensitivity which is relevant when you draw objects manually.
If I draw using standard library class as mentioned above, by giving exact 2 points (date + price), what can be the problem?
I haven't tried. Are you sure that these options apply only for objects drawn manually ?
If not, then show the code you have used, what's the value of your x in "pr2 - x pips" ?
I haven't tried. Are you sure that these options apply only for objects drawn manually ?
If not, then show the code you have used, what's the value of your x in "pr2 - x pips" ?
Here you go, please take in consideration I use EURUSD H4, and the prices you see are the lows I have on both bars.
#property copyright "Copyright 2012, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" #include <ChartObjects\ChartObjectsLines.mqh> CChartObjectTrendByAngle trendline; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { if(trendline.Create(0,"line",0,D'2013.03.04 08:00',1.29822,D'2013.03.28 08:00',1.27550)) trendline.RayRight(false); }
Here you go, please take in consideration I use EURUSD H4, and the prices you see are the lows I have on both bars.
- www.mql5.com
The drawn line has second point which is placed below that price (below 1.27550), and when I look at the properties of the created line, I see a different second point price than the one I gave (not 1.27550).
Ok, I obtain 1.27553. I am searching an explanation.
Thanks. If I change it to CCHartObjectTrend I get the right price.
Ah ok, I missed that. Then seems to me that it is a problem of rounded price. Angle is a double, and is not always very accurate.
yes I thought so, But does it mean that I can not use the angle object, even if I create the line using 2 points, and not the angle?
How can I use it accurately then, given 2 exact points?
yes I thought so, But does it mean that I can not use the angle object, even if I create the line using 2 points, and not the angle?
How can I use it accurately then, given 2 exact points?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a script that creates trend lines. that I use to
When I create a trend line using this class, with 2 points, it shifts the second point price a little lower then point 2.
For instance, EURUSD 4H I use:
line.Create(0,line_name,0,dt1,pr1,dt2,pr2)
and the line is created at dt1,pr1,dt2,pr2 - x pips
When I change the class to CChartObjectTrend instead of the CChartObjectTrendByAngle, the line is created ok.