Error

Created at 20 Oct 2020, 11:30
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CH

charitydv

Joined 18.08.2020

Error
20 Oct 2020, 11:30


Hi, I'm building a bot with the indicator Fractals but every time I try to build the bot I get this error, I already removed the indicator, installed it again, but further as that I really don't know how I can fix this. 

 

Anyone ever had this problem and know how to solve it? Thank you :) 


@charitydv
Replies

PanagiotisCharalampous
20 Oct 2020, 11:32

Hi charitydv,

You need to use the complete reference for the indicator. Post the code and I will fix it for you.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

charitydv
20 Oct 2020, 17:38

RE:

PanagiotisCharalampous said:

Hi charitydv,

You need to use the complete reference for the indicator. Post the code and I will fix it for you.

Best Regards,

Panagiotis 

Join us on Telegram

 Okay thank you so much. It is the first bot I write so maybe there it went wrong :)  Here it is :

 

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Fractalbreakout : Robot
    {

        [Parameter("Fractal Period", DefaultValue = 10, MinValue = 10, MaxValue = 100, Step = 10)]
        public int param_fractal_period { get; set; }

        [Parameter("Fractal diff", DefaultValue = 0, MinValue = 0, MaxValue = 10, Step = 1)]
        public int param_fractal_diff { get; set; }

        [Parameter("Include Trailing Stop", Group = "Trailing Stop", DefaultValue = false)]
        public bool IncludeTrailingStop { get; set; }

        [Parameter("Trailing Stop Trigger (pips)", Group = "Trailing Stop", DefaultValue = 5)]
        public int TrailingStopTrigger { get; set; }

        [Parameter("Trailing Stop Step (pips)", Group = "Trailing Stop", DefaultValue = 1)]
        public int TrailingStopStep { get; set; }

        [Parameter("Min TP", DefaultValue = 30, MinValue = 5, MaxValue = 50, Step = 5)]
        public int param_min_take_profit { get; set; }

        [Parameter("Max TP", DefaultValue = 50, MinValue = 30, MaxValue = 50, Step = 1)]
        public int param_max_take_profit { get; set; }

        [Parameter("Volume Units", DefaultValue = 100000, MinValue = 1000, MaxValue = 1000000, Step = 1000)]
        public int volume_units { get; set; }

        private Fractals i_fractal;

        protected override void OnStart()
        {
            _fractal = Indicators.GetIndicator<Fractals>(_period);
        }

        protected override void OnBar()
        {
            var _fractaldown = Math.Round(_fractal.UpFractal.LastValue, Symbol.Digits);
            var _fractalup = Math.Round(_fractal.DownFractal.LastValue, Symbol.Digits);

            var position = ExecuteMarketOrder(TradeType.Buy, Symbol, 1000).Position;
            position.ModifyTakeProfitPrice(_fractaldown);
            position.ModifyStopLossPrice(_fractalup);
        }
    }
}


@charitydv

PanagiotisCharalampous
21 Oct 2020, 08:12

Hi charitydv,

The code you posted does not build and you have not posted the indicator either. But the problem should be fixed if you change your indicator initialization to

_fractal = Indicators.GetIndicator<cAlgo.Indicators.Fractals>(_period);

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous