ADX on Chart
ADX on Chart
22 Jan 2014, 20:37
Hello,
can somebody help me display the current ADX value right on the chart???
I found a similar indicator that draws the current spread on the chart:
Since I'm not a programmer I just can't get it to work with the value of the ADX.
It also would be great if the text can change colors depending on a rising or falling ADX value.
Any help would be much appreciated.
Thanks.
Replies
Old Account
23 Jan 2014, 18:49
RE:
StBechstedt said:
Can you explain that a little bit further please???
// ------------------------------------------------------------------------------- // // This is a Template used as a guideline to build your own Robot. // // ------------------------------------------------------------------------------- using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; namespace cAlgo.Indicators { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC)] public class DrawSpread : Indicator { protected override void Initialize() { // Initialize and create nested indicators } public override void Calculate(int index) { // Calculate value at specified index DisplaySpreadOnChart(); } private void DisplaySpreadOnChart() { var spread = Math.Round(Symbol.Spread/Symbol.PipSize, 2); string text = string.Format("{0}", spread); ChartObjects.DrawText("Label", "Spread:", StaticPosition.TopLeft, Colors.Yellow); ChartObjects.DrawText("spread", text.PadLeft(12), StaticPosition.TopLeft, Colors.White); } } }
If to look where it says: [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC)]
if it is true it's on the chart, if it's false it won't be on the chart
@Old Account
StBechstedt
23 Jan 2014, 22:49
Yes I understand that.
But how do I code the rest to show me the current ADX value???
@StBechstedt
ErikD
24 Jan 2014, 01:14
// ------------------------------------------------------------------------------- // // This will draw the value of the ADX on the chart // // ------------------------------------------------------------------------------- using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; namespace cAlgo.Indicators { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC)] public class DrawSpread : Indicator { [Parameter(DefaultValue = 25)] public int Period { get; set; } private DirectionalMovementSystem _dms; protected override void Initialize() { _dms = Indicators.DirectionalMovementSystem(Period); } public override void Calculate(int index) { DisplayADXChart(); } private void DisplayADXChart() { string text = string.Format("ADX: {0}", _dms.ADX.LastValue); ChartObjects.DrawText("Label", "ADX:", StaticPosition.TopLeft, Colors.Yellow); ChartObjects.DrawText("adx", text.PadLeft(12), StaticPosition.TopLeft, Colors.White); } } }
@ErikD
Old Account
23 Jan 2014, 09:52
@Old Account