ChartObject in backtesting

Created at 06 Apr 2015, 23:32
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!
lec0456's avatar

lec0456

Joined 14.11.2012

ChartObject in backtesting
06 Apr 2015, 23:32


 Can the ChartObjects.DrawText be used while backtesting.

I have various trade criteria and it would be nice if I could place a number over the candle to indicate the trade criteria used to enter the trade.  Is this supposed to work or is it being planned or is it not on the radar??

 


@lec0456
Replies

Spotware
09 Apr 2015, 09:28

We plant add chart objects to backtesting in the future. Currently all chart objects are ignored in backtesting.


@Spotware

WhiteSage
19 Apr 2015, 22:57

RE:

Spotware said:

We plant add chart objects to backtesting in the future. Currently all chart objects are ignored in backtesting.

It seems everything to do with drawing is disabled during backtest, when drawing becomes a feature it would be handy to have a toggle for it, so the user can turn them back off for speed.


@WhiteSage

Spotware
19 Jun 2015, 14:56

Dear Trader,

Thank you for your suggestion. We will consider it. Additionally you can post your ideas/suggestions to http://vote.spotware.com/


@Spotware

lec0456
24 Oct 2018, 08:51

Can you use the chart Object in backtesting yet? Users have been asking for that for 6 years.


@lec0456

PanagiotisCharalampous
24 Oct 2018, 10:09

Hi lec0456,

Yes you can and you can use in conjunction with visual backtesting as well.

Best Regards,

Panagiotis


@PanagiotisCharalampous

lec0456
26 Oct 2018, 05:30

I tried sing this line of code in my cBot at the point it takes an action:

ChartObjects.DrawVerticalLine("vLine"+OnBarIndex, (int)OnBarIndex, Colors.Red, 1, LineStyle.Solid);

It does not place a line on the backtest chart.

 

How do I do it?

 


@lec0456

lec0456
26 Oct 2018, 05:31

RE:

lec0456 said:

I tried sing this line of code in my cBot at the point it takes an action:

ChartObjects.DrawVerticalLine("vLine"+OnBarIndex, (int)OnBarIndex, Colors.Red, 1, LineStyle.Solid);

It does not place a line on the backtest chart.

 

How do I do it?

 

i tried using(spelling)


@lec0456

PanagiotisCharalampous
26 Oct 2018, 09:22 ( Updated at: 21 Dec 2023, 09:20 )

Hi lec0456,

Here is an example

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 NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            ChartObjects.DrawHorizontalLine("Test", Symbol.Bid, Colors.Red);
        }

        protected override void OnTick()
        {
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

and here is what you should see on the chart

Make sure you are using Visual Mode.

Best Regards,

Panagiotis


@PanagiotisCharalampous

lec0456
26 Oct 2018, 09:30 ( Updated at: 21 Dec 2023, 09:20 )

my interface is different than yours?? and it doesn't work.  I am using 3 different brokers and none have your interface.


@lec0456

lec0456
26 Oct 2018, 09:33

Visual mode?? How do I change?


@lec0456

PanagiotisCharalampous
26 Oct 2018, 09:43 ( Updated at: 21 Dec 2023, 09:20 )

Here it is


@PanagiotisCharalampous

PanagiotisCharalampous
26 Oct 2018, 09:43

Use Spotware Beta


@PanagiotisCharalampous

lec0456
26 Oct 2018, 10:14

It would be nice if you could select the directory for the Backtest Data so that you could use the the Beta release to backtest data from different brokers. I could probalbly manually copy in the data into the tick directory but it would be too cumbersome.  but thanks for letting me know this is soon to be available.  its a very important and nice feature.


@lec0456