If I am polling up to 2 dozen charts the interval between polling the same chart is very unlikely to be less than 1 second. Obviously I would prefer as little lag as possible, but so long as teh time stamp taht accompanies the surrent price is accurate for that particular price, then 2 sets of Server Time & corresponding price will give me an accurate slope / absolute angle even though it may be lagged.
Try from MT4 Insert--> Lines ---> TrendLine by Angle ---> Put it on a chart and in Parameters - Angle in Degrees type in 450 or anything you want - it will normalize it.
In your case ( 450) you will get vertical line (90 degrees). In program take division results without remainder multiply your normalization base ( lets say 90) ny that number
than suntract from original degree (450) = 0. I would check the remainder first - if it is zero then angle is = your base (90 in this case).
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.
Hi JB,
If I am polling up to 2 dozen charts the interval between polling the same chart is very unlikely to be less than 1 second. Obviously I would prefer as little lag as possible, but so long as teh time stamp taht accompanies the surrent price is accurate for that particular price, then 2 sets of Server Time & corresponding price will give me an accurate slope / absolute angle even though it may be lagged.
ok...
I get 10 pips and 2 bars = slope 5
5*90 = 450
Now what?
Your angle is 90 degrees or close to it (scale reformatting). If you have angle 0f 90* 5 (n) times it is still angle = 90.
This should be normalized according to your needs (-90, 90) (-180, 180) etc.
ok...
I get 10 pips and 2 bars = slope 5
5*90 = 450
Now what?
Try from MT4 Insert--> Lines ---> TrendLine by Angle ---> Put it on a chart and in Parameters - Angle in Degrees type in 450 or anything you want - it will normalize it.
In your case ( 450) you will get vertical line (90 degrees). In program take division results without remainder multiply your normalization base ( lets say 90) ny that number
than suntract from original degree (450) = 0. I would check the remainder first - if it is zero then angle is = your base (90 in this case).
I hope this helps.
Sorry not everything get posted last time.This piece of code was missing.
I believe this should do the trick:
double slope = ((price1-price2)/Point)/(Number_of_Bars_Back);
double Angle = 90 * slope;
double mabs = MathAbs(Angle);
double mamod = MathMod(Angle,90);
if(mabs > 90 && mamod != 0.0)
{
Angle = Angle - 90* MathFloor(Angle/90);
}
Angle can be negatice or positive here.
Thanks.