Is there anyway to highlight background or to have sorf of marks displayed on the bottom
Is there anyway to highlight background or to have sorf of marks displayed on the bottom
22 Feb 2016, 17:15
Is there anyway to highlight background or to have sorf of marks displayed on the bottom?
I want to highlight background or have marks on the bottom of charts when ADX is above 20
In a nutshell, I want to be notified when ADX is above 20, without plotting ADX on the subcharts.
So are there any functions like background highlight, or displaying shapes on the screen?
Thank you
Replies
croucrou
13 Mar 2016, 18:39
RE:
You can do it like this:
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewIndicator : Indicator { private DirectionalMovementSystem adx; protected override void Initialize() { adx = Indicators.DirectionalMovementSystem(yourPeriod); } public override void Calculate(int index) { if (adx.ADX.LastValue > 20) { ChartObjects.DrawText("Alert", "ADX above 20!", StaticPosition.BottomLeft, Colors.Yellow); } } } }
@croucrou
Singleton
13 Mar 2016, 19:19
RE: RE:
croucrou said:
You can do it like this:
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewIndicator : Indicator { private DirectionalMovementSystem adx; protected override void Initialize() { adx = Indicators.DirectionalMovementSystem(yourPeriod); } public override void Calculate(int index) { if (adx.ADX.LastValue > 20) { ChartObjects.DrawText("Alert", "ADX above 20!", StaticPosition.BottomLeft, Colors.Yellow); } } } }
Thank you so much for writing it. I appreciate it. Is it easy to learn c# for cTrader Algo only?
@Singleton
croucrou
28 Mar 2016, 14:45
Actually this needs one more thing to work. Now it is complete:
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewIndicator : Indicator { private DirectionalMovementSystem adx; protected override void Initialize() { adx = Indicators.DirectionalMovementSystem(14); } public override void Calculate(int index) { if (!IsLastBar) return; if (adx.ADX.LastValue > 20) { ChartObjects.RemoveObject("Alert"); ChartObjects.DrawText("Alert", "ADX above 20!", StaticPosition.BottomLeft, Colors.Yellow); } } } }
@croucrou
Waxy
23 Feb 2016, 00:48
I think the options you have right now is to make a bot to use adx and draw a line or text at a specified location when it is above 20.
@Waxy