DO
ATR Example
01 Aug 2013, 01:21
Hi,
can you pleas show one example how to use AverageTrueRange with robot.
ATR Example
01 Aug 2013, 01:21
Hi,
can you pleas show one example how to use AverageTrueRange with robot.
cAlgo_Fanatic
02 Aug 2013, 17:52
You can use any of the cAlgo.API.Indicators in Robots by declaring, initializing and then accessing them by the given name.
An example with AverageTrueRange is such as this:
// Declare private AverageTrueRange atrIndicator; [Parameter(DefaultValue = 20)] public int Period { get; set; } [Parameter("MA Type", DefaultValue = MovingAverageType.Simple)] public MovingAverageType MAType { get; set; } [Parameter(DefaultValue = 0.002)] public double ATRValue { get; set; } protected override void OnStart() { // Initialize atrIndicator = Indicators.AverageTrueRange(Period, MAType); } protected override void OnTick() { //If atrIndicator last value is greater than the ATRValue input if (atrIndicator.Result.LastValue > ATRValue) { //Do something Print("LastValue {0}", atrIndicator.Result.LastValue); } //... }@cAlgo_Fanatic