Hi everybody,
I'm trying to get the value from the "average angle" indicator. But the value of the indicator displayed on the chart is different from the value of the indicator taken from iCustom. I am very confused with this problem
Please help me fix my code. Thanks in advance.
instead of placing the indicator separately onto the chart, do it from the EA after creating the handle.
the inputs of that indicator are using non-standard enumerations so it is likely an issue with the way you are setting the inputs, this avoids that and will match but you still need to ensure you are getting the inputed values that you have specified - check the enumerations...
also set the array as series in Oninit not every tick.
ChartIndicatorAdd(0,1,Handle_of_Angle);
Hi everybody,
I'm trying to get the value from the "average angle" indicator. But the value of the indicator displayed on the chart is different from the value of the indicator taken from iCustom. I am very confused with this problem
Please help me fix my code. Thanks in advance.
All working just fine :
input int MAPeriod = 34; // MA period enum enumAveragesType { avgSma, // Simple moving average avgEma, // Exponential moving average avgDsema, // Double smoothed EMA avgDema, // Double EMA avgTema, // Tripple EMA avgSmma, // Smoothed MA avgLwma, // Linear weighted MA avgPwma, // Parabolic weighted MA avgAlex, // Alexander MA avgHull, // Hull MA avgTma, // Triangular MA avgSine, // Sine weighted MA avgLsma, // Linear regression value avgIe2, // IE/2 avgNlma, // Non lag MA avgZlma, // Zeo lag EMA avgLead // Leader EMA }; input enumAveragesType MAType = avgNlma; // Calculation type enum enPrices { pr_close, // Close pr_open, // Open pr_high, // High pr_low, // Low pr_median, // Median pr_typical, // Typical pr_weighted // Weighted }; input enPrices MAPrice = pr_close; // Price to use input int AngleBars = 6; // Bars for angle input double AngleLevel = 8; // Level // // // int _handle; int OnInit() { _handle = iCustom(_Symbol,_Period,"angle_of_averages",MAPeriod,MAType,MAPrice,AngleBars,AngleLevel); if (_handle==INVALID_HANDLE) { Print("Error loading indicator"); return(INIT_FAILED); } return(INIT_SUCCEEDED); } void OnDeinit(const int reason) {} void OnTick() { double _result[]; if (CopyBuffer(_handle,0,0,10,_result)==10) { string _comment = (string)TimeLocal()+"\n\n"; for (int i=0; i<10; i++) _comment += StringFormat(" bar : %i value : %s\n",9-i,DoubleToString(_result[i],_Digits)); Comment(_comment); }
Please help me fix my code. Thanks in advance.
-
There is no angle from 2 anchor points. An angle requires distance divided by distance; a unit-less number. A chart has price and time. What is the angle of going 30 miles in 45 minutes? Meaningless!
-
You can get the slope from a trendline: m=ΔPrice÷ΔTime or m=ΔPrice÷Δ(bar index). Changing the price scale, bar width, or window size, changes the apparent angle, the slope is constant. Angle is meaningless.
-
You can create an angled line using one point and setting the angle (Object Properties - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference.) The line is drawn that angle in pixels. Changing the axes scales does NOT change the angle (and thus is meaningless.)
-
If you insist, take the two price/time coordinates, convert them to pixel coordinates and then to apparent angle with arctan.
How to get the angle of a trendline and place a text object to it? - Trend Indicators - MQL4 programming forum - Page 2

- 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 everybody,
I'm trying to get the value from the "average angle" indicator. But the value of the indicator displayed on the chart is different from the value of the indicator taken from iCustom. I am very confused with this problem
Please help me fix my code. Thanks in advance.