Transferring

Transferring

Hello, 

attempting to send a "one" or "zero" signal from custom indicator as a trade signal, does indeed transfer a signal to cbot, but that signal does not start the trader. 

Funnily, when setting the SIGNAL == 1, no information is available, but setting SIGNAL == 0, shows both signals "zero" and "one", but non of them liberate trading signals.

What mistakes are made by this culprit ? 

Sincerely, 

Björn Bernau 

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 aCBOTbaseBOLLINGER : Indicator
    {
        [Output("B", PlotType = PlotType.Points, LineColor = "#FFFFD700", Thickness = 4)]
        public IndicatorDataSeries B { get; set; }

        [Output("SIGNAL")]
        public int SIGNAL { get; set; }

        [Parameter()]
        public DataSeries Source { get; set; }

        [Parameter("BandPeriod", DefaultValue = 18)]
        public int BandPeriod { get; set; }

        [Parameter("Std", DefaultValue = 1.8)]
        public double Std { get; set; }

        [Parameter("MAType")]
        public MovingAverageType MAType { get; set; }

        public BollingerBands boll;



        protected override void Initialize()
        {
            boll = Indicators.BollingerBands(Source, BandPeriod, Std, MAType);

        }

        public override void Calculate(int index)
        {
            var BBT = boll.Top[index];
            var HP = Bars.HighPrices[index];
            var high = HP - BBT;

            if (high > 0)
            {
                SIGNAL = 1;
                B[index] = Bars.HighPrices[index];
            }

            else
            {
                SIGNAL = 0;
            }
            SIGNAL = 0;
        }
    }
}

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

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

        [Parameter(DefaultValue = 100000)]
        public int Volume { get; set; }

        [Output("B")]
        public IndicatorDataSeries B { get; set; }

        [Output("SIGNAL")]
        public int SIGNAL { get; set; }

        [Parameter()]
        public DataSeries Source { get; set; }

        [Parameter("BandPeriod", DefaultValue = 18)]
        public int BandPeriod { get; set; }

        [Parameter("Std", DefaultValue = 1.8)]
        public double Std { get; set; }

        [Parameter("MAType")]
        public MovingAverageType MAType { get; set; }

        private aCBOTbaseBOLLINGER S2;


        protected override void OnStart()
        {
            S2 = Indicators.GetIndicator<aCBOTbaseBOLLINGER>(Source, BandPeriod, Std, MAType);
        }

        protected override void OnBar()
        {
            if (S2.SIGNAL == 1)
            {
                Print(S2.SIGNAL, "    ", S2.B);
                ExecuteMarketOrder(TradeType.Buy, Symbol.Name, Volume, "buy1", 14, 80);
            }
        }
    }
}