Can a cBot coded to use an indicator also "Output" or render that indicators on chart.?

Created at 14 Dec 2022, 02:04
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!
TWiLiGHT_FX's avatar

TWiLiGHT_FX

Joined 14.12.2022

Can a cBot coded to use an indicator also "Output" or render that indicators on chart.?
14 Dec 2022, 02:04


 

Hi Support People..  I am new to coding.

I have a cBot that uses 3x separate Bollinger Bands to execute trades but I cannot seem to have one also render

the actual visual indicator on my chart.  Is it not possible or is my code for this function just wrong haha.??  Pls help....

 

using System;
using System.Collections.Generic;
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 Karen : Robot
    {
        private Worker _worker = null;

        [Parameter("Source", Group = "DOMiNO BBand")]
        public DataSeries Source { get; set; }
        
        [Parameter("BandPeriods", Group = "DOMiNO BBand", DefaultValue = 100)]
        public int BandPeriod { get; set; }
        
        [Parameter("Std", Group = "DOMiNO BBand", DefaultValue = 2)]
        public double Std { get; set; }
        
        [Parameter("MAType", Group = "DOMiNO BBand")]
        public MovingAverageType MAType { get; set; }
        
        [Output("Main", LineColor = "Lime")]
        public IndicatorDataSeries Main { get; set; }

        [Output("Top", LineColor = "Lime")]
        public IndicatorDataSeries Top { get; set; }

        [Output("Bottom", LineColor = "Lime")]
        public IndicatorDataSeries Bottom { get; set; }

        private BollingerBands boll;
 

        protected override void OnStart()
        {
            _worker = new Worker(this);
            
            boll = Indicators.BollingerBands(Source, BandPeriod, Std, MAType);
            
            Main = boll.Main;
            Top = boll.Top;
            Bottom = boll.Bottom;

        }


@TWiLiGHT_FX
Replies

Waxy
23 Dec 2022, 22:23

RE:

This isn't possible, you can use indicator data from a bot but you cannot use attributes like Output inside a bot.


@Waxy