Topics
23 Sep 2022, 21:25
 1763
 13
26 Oct 2021, 11:33
 6
 996
 1
25 Feb 2021, 15:07
 920
 4
19 Oct 2020, 16:18
 0
 1123
 1
Replies

xabbu
07 Sep 2020, 13:48

Dear Panagiotis,

 

can this be also done with the backtesting results unter "Trade statistics" or is there another way to export these informations after backtesting...?

 

Best regards,

 


@xabbu

xabbu
07 Sep 2020, 11:35

RE:

great, thank you very much Panagiotis, now it works finally - have a great week

 


@xabbu

xabbu
07 Sep 2020, 10:56

Dear Panagiotis,

I don't want to be to pushy, did you have any idea for me resolving this issue / behavior so that I can move on with my cBot? Because the event is triggered multiple time, any statement I would like to be executed is also executed multiple time...

Kindest regards and many thanks for your support


@xabbu

xabbu
04 Sep 2020, 13:02

RE:

here it is, and many thanks again for your always ultrafast responses:

 

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

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

        public double _initialTradeVolume { get; set; }


        
        private double getATRPips()
        {

            return _atr.Result.LastValue / Symbol.PipSize;
        }
    }
}

 


@xabbu

xabbu
25 Aug 2020, 12:54

Dear Panagiotis,

 

many thanks for picking this question up. The code is in my first post, the SampleSMA ist from cTrader 3.8 or from cTrader Automate Guides. The simple (demo) task is to display the latest value (as text, in the middle of the top screen) in the chart area. This works fine with indicators, which are build into the cTrader logic (MoneyflowIndix, CCI etc) but for me NOT with custom indicators.

Q: Can you please explain to us what do you mean that it does not work?

A: nothing is displayed in the top middle of the screen (when using CCI or another build-in indicator it works)

Does this make my question clearer..? Best regards,

 


SampleSMA Code:

 

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
    public class SampleSMA : Indicator
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter(DefaultValue = 14)]
        public int Periods { get; set; }

        [Output("Main", LineColor = "Turquoise")]
        public IndicatorDataSeries Result { get; set; }

        public override void Calculate(int index)
        {
            double sum = 0.0;

            for (int i = index - Periods + 1; i <= index; i++)
            {
                sum += Source[i];
            }
            Result[index] = sum / Periods;
        }
    }
}

 


 

my test code:

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 NNFXInfosonChart : Indicator
    {

        public MoneyFlowIndex _cci_daily;
        public SampleSMA _sma;
        string test;


        protected override void Initialize()
        {



            _cci_daily = Indicators.MoneyFlowIndex(MarketData.GetBars(TimeFrame.Daily), 14);
            _sma = Indicators.GetIndicator<SampleSMA>(MarketData.GetBars(TimeFrame.Daily), 14);

        }



        public override void Calculate(int index)
        {



            test = Convert.ToString(_sma.Result.LastValue);

            Chart.DrawStaticText("Symbols", test, VerticalAlignment.Top, HorizontalAlignment.Center, Color.Silver);
        }


    }
}

 


@xabbu