Multiframe in backtesting

Created at 30 Jan 2019, 02:45
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!
bienve.pf's avatar

bienve.pf

Joined 19.09.2018

Multiframe in backtesting
30 Jan 2019, 02:45


Hi,
Is it possible to backtest with different TimeFrames of the same symbol?


@bienve.pf
Replies

PanagiotisCharalampous
30 Jan 2019, 10:07

Hi bienve.pf,

I am not sure what do you mean. You can choose the timeframe on Symbol parameters. Do you mean to get data from another timeframe that the one specified on the chart? If yes, read the discussion here.

Best Regards,

Panagiotis


@PanagiotisCharalampous

bienve.pf
30 Jan 2019, 12:23

If I add an Indicator in visual backtesting (manual, not by code ) with another TimeFrame only works the same TimeFrame of the cBot. I have an indicator for Supports and Resistances with differents TimeFrames.In visual Chart only loads history data in another TF but on indicator context it not update the nexts bars buffer. Use the indicator by code works good. It update the nexts bars history. Thanks. Sorry, my english it is no good.
@bienve.pf

PanagiotisCharalampous
30 Jan 2019, 12:33

Hi bienve.pf,

Can you share the indicator with us? If programmed properly, it should work fine.

Best Regards,

Panagiotis


@PanagiotisCharalampous

bienve.pf
30 Jan 2019, 14:28 ( Updated at: 21 Dec 2023, 09:21 )

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, AutoRescale = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class SRFractals : Indicator
    {
        [Parameter("Bars", DefaultValue = 600)]
        public int CalcBars { get; set; }


        [Parameter("TimeFrame1", DefaultValue = "Minute30")]
        public TimeFrame TimeFrame1 { get; set; }


        [Parameter("TimeFrame2", DefaultValue = "Hour")]
        public TimeFrame TimeFrame2 { get; set; }


        [Parameter("TimeFrame3", DefaultValue = "Hour4")]
        public TimeFrame TimeFrame3 { get; set; }


        [Parameter("TimeFrame4", DefaultValue = "Daily")]
        public TimeFrame TimeFrame4 { get; set; }




        private MarketSeries series4;
        private MarketSeries series3;
        private MarketSeries series2;
        private MarketSeries series1;


        protected override void Initialize()
        {

           
            // Initialize and create nested indicators
            series4 = MarketData.GetSeries(Symbol, TimeFrame4);
            series3 = MarketData.GetSeries(Symbol, TimeFrame3);
            series2 = MarketData.GetSeries(Symbol, TimeFrame2);
            series1 = MarketData.GetSeries(Symbol, TimeFrame1);
        }



        int counter = 0;
        public int side = 2;

        public override void Calculate(int index)
        {
            if (counter < index)
            {
                counter = index;
               
                string info = "TF: " + TimeFrame1 + ", Bars: " + series1.Open.Count
                              + "\r\n" + "TF: " + TimeFrame2 + ", Bars: " + series2.Open.Count
                              + "\r\n" + "TF: " + TimeFrame3 + ", Bars: " + series3.Open.Count
                              + "\r\n" + "TF: " + TimeFrame4 + ", Bars: " + series4.Open.Count;
                Chart.DrawStaticText("info", info, VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);


            }


        }

    }
}

Add to Visual Backtesting on empty Robot. The data history buffer for TimeFrames distinct to cbot TF not Work for my ctrader version 3.3


@bienve.pf

PanagiotisCharalampous
30 Jan 2019, 14:40 ( Updated at: 21 Dec 2023, 09:21 )

Hi bienve.pf,

Seems to be working fine for me. See below

Best Regards,

Panagiotis


@PanagiotisCharalampous

bienve.pf
30 Jan 2019, 14:54

The counter of Total Bars for others TF distinct to cBot dont work. It does not work for me in 3.4 or in 3.3 version
Can you to see to move the counter for Daily along of backtesting?
Pleasse send image frames with this text.
Regards!


@bienve.pf

bienve.pf
30 Jan 2019, 15:03 ( Updated at: 21 Dec 2023, 09:21 )

Only the "Hour" counter moves


@bienve.pf

PanagiotisCharalampous
30 Jan 2019, 15:17

Hi bienve.pf,

Ok now I understood. It should be working, we will check this.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
31 Jan 2019, 12:26

Hi bienve.pf,

We managed to reproduce the probem. We will fix it in an upcoming update.

Best Regards,

Panagiotis


@PanagiotisCharalampous

bienve.pf
31 Jan 2019, 15:24

Perfect!!
Thanks


@bienve.pf

TOPGUNFX
14 Mar 2020, 19:58

When is the fix likely to be live? Thanks.


@TOPGUNFX

PanagiotisCharalampous
16 Mar 2020, 09:32

Hi TOPGUNFX,

We do not have an ETA for this fix yet.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous