Replies

ceakuk
21 Mar 2018, 17:42

RE:

Panagiotis Charalampous said:

Please help I completely don't trust cAlgo back testing

After many months of  coding, I can't tell if my Robots could have worked or not. All lost money on back testing but now I can see the problem is the platform. This backtesting business is not right,

 

I'm using Renko of 10 pips. I buy when  renko chart gets red and buy when its green. I expect no position can loose 10pips+  some small  number. unfortunately I loose  even 75 pips which is crazy see image https://imgur.com/a/p02Bl

but when I print logs for Symbol.Bid, Symbol.Ask,  and Renko Position, none shows a loosing position. Infact the pisition  should be +25pips and counting but  calgo closes the position as -75pips.

What exactly is wrong with calgo.

I try both1M bar data and Ticks data

Open buy position and closs all sell positions  when renko turns green and
Open sell position and close all buy positions  when renko turns red
https://www.tradingacademy.com/lessons/wp-content/uploads/bwendell-20131210-spy-renko.jpg

Thanks and  Best regards,

Kevin


@ceakuk

ceakuk
21 Mar 2018, 17:39

RE:

ceakuk said:

Open buy position and closs all sell positions  when renko turns green and
Open sell position and close all buy positions  when renko turns red
https://www.tradingacademy.com/lessons/wp-content/uploads/bwendell-20131210-spy-renko.jpg

@ceakuk

ceakuk
20 Mar 2018, 01:48

RE:

Panagiotis Charalampous said:

Hi Panagiotis,

Thanks a lot. I now know where the problem lies

In the Robot im using 

MarketSeries.Open.LastValue  or MarketSeries.Open.Last(0)

and it is as accurate as Symbol.Ask, Symbol.Bid.

However within the Indicator, MarketSeries.Open.LastValue  or MarketSeries.Open.Last(0)  is totally different

Thanks With kind regards,

Kevin

 


@ceakuk

ceakuk
19 Mar 2018, 17:45

RE:

Panagiotis Charalampous said:

The indicator uses  MarketSeries.Close.LastValue
When I change that to Symbol.Bid or Symbol.Ask or the mean, its totally different. There are other Renko indicators that also use  MarketSeries.Close.LastValue
namely /algos/indicators/show/457 and  /algos/indicators/show/1332 and /algos/indicators/show/1086
so its not the indicator. all are producing the same results. When I open on Bullish then when it turns Bearish from the MarketSeries.Close.LastValue, the Symbol.Bid or Symbol.Ask show something totally different.
 
So you said Symbol.Bid or Symbol.Ask can't be used for historic data or  it can?

 


@ceakuk

ceakuk
19 Mar 2018, 17:34

RE:

/algos/indicators/show/1086

 

 


@ceakuk

ceakuk
19 Mar 2018, 17:33

RE:

Panagiotis Charalampous said:

Hi ceacuk,

Thank you. Where in the cBot are you using MarketSeries.Close.LastValue? I see only renko.Close.Last(0).

Best Regards,

Panagiotis

Here it is :Renko

/algos/indicators/show/1086

 


@ceakuk

ceakuk
19 Mar 2018, 17:24

RE:

Panagiotis Charalampous said:

Hi ceakuk,

MarketSeries.Close.LastValue has the Close value of the last bar. Symbol.Ask and Symbol.Bid contain the latest tick prices. Values included in MarketSeries are constructed from past tick data therefore they are accurate. Would you like to give us some more information on what you are doing, maybe by sharing a cBot, so that we can advise further?

Best Regards,

Panagiotis

Thanks for reply.

im creating a Cbot using this renko/algos/indicators/show/1086

I'm expecting  to buy everytime it Turns Bullish and Sell everytime it turns Bearish.

I'm expecting that if my Bricksize is say 50Pips, then the maximum loss should be 2X= 100pips +- small value. So 1 brick stoploss However I'm seeing upto 4X in Loss whenever I buy and it turns bearish and vice versa. Any Ideas will be highly appreciated

using System;
using System.Linq;
using System.Collections.Generic;
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 RenkoBot : Robot
    {
 
        [Parameter("Renko Pips", DefaultValue = 10, MinValue = 0.5, Step = 2)]
        public double RenkoPips { get; set; }
 
 
        [Parameter("Number Of Bricks", DefaultValue = 100, MinValue = 10, Step = 100)]
        public int BricksToShow { get; set; }
 
        [Parameter("Zoom Level", DefaultValue = 3, MinValue = 0, MaxValue = 5, Step = 1)]
        public double ZoomLevel { get; set; }
 
        [Parameter("Bullish bar color", DefaultValue = "SeaGreen")]
        public string BullishBarColor { get; set; }
 
        [Parameter("Bearish bar color", DefaultValue = "Tomato")]
        public string BearishBarColor { get; set; }
 
        [Parameter("Quantity", DefaultValue = 1000, MinValue = 1000, Step = 1000)]
        public int Quantity { get; set; }
 
 
        private Renko renko;
 
        protected override void OnStart()
        {
            object[] parameterValues = 
            {
                RenkoPips,
                // Bar size
                BricksToShow,
                // Show number of bricks
                ZoomLevel,
                //ZoomLevel
                BullishBarColor,
                // Bullish bar color
                BearishBarColor
                // Bearish bar color
            };
            renko = Indicators.GetIndicator<Renko>(parameterValues);
        }
 
        protected override void OnTick()
        {
 
            var buyPosition = Positions.Find("Renko", Symbol, TradeType.Buy);
            var sellPosition = Positions.Find("Renko", Symbol, TradeType.Sell);
 
            bool isLastBrickBullish = renko.Open.Last(0) < renko.Close.Last(0);
 
 
            if (isLastBrickBullish && buyPosition == null)
            {
                if (sellPosition != null)
                    ClosePosition(sellPosition);
                //Print("buying");
                ExecuteMarketOrder(TradeType.Buy, Symbol, Quantity, "Renko");
            }
 
            else if (!isLastBrickBullish && sellPosition == null)
            {
                if (buyPosition != null)
                    ClosePosition(buyPosition);
                //Print("Selling");
                ExecuteMarketOrder(TradeType.Sell, Symbol, Quantity, "Renko");
            }
        }
    }
}

 

 


@ceakuk

ceakuk
19 Mar 2018, 17:09

RE:

ceakuk said:

Thanks for reply.

im creating a Cbot using this renko/algos/indicators/show/1086

I'm expecting  to buy everytime it Turns Bullish and Sell everytime it turns Bearish.

I'm expecting that if my Bricksize is say 50Pips, then the maximum loss should be 2X= 100pips +- small value. So 1 brick stoploss However I'm seeing upto 4X in Loss whenever I buy and it turns bearish and vice versa. Any Ideas will be highly appreciated

 

    using System;
    using System.Linq;
    using System.Collections.Generic;
    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 RenkoBot : Robot
        {

            [Parameter("Renko Pips", DefaultValue = 10, MinValue = 0.5, Step = 2)]
            public double RenkoPips { get; set; }


            [Parameter("Number Of Bricks", DefaultValue = 100, MinValue = 10, Step = 100)]
            public int BricksToShow { get; set; }

            [Parameter("Zoom Level", DefaultValue = 3, MinValue = 0, MaxValue = 5, Step = 1)]
            public double ZoomLevel { get; set; }

            [Parameter("Bullish bar color", DefaultValue = "SeaGreen")]
            public string BullishBarColor { get; set; }

            [Parameter("Bearish bar color", DefaultValue = "Tomato")]
            public string BearishBarColor { get; set; }

            [Parameter("Quantity", DefaultValue = 1000, MinValue = 1000, Step = 1000)]
            public int Quantity { get; set; }


            private Renko renko;

            protected override void OnStart()
            {
                object[] parameterValues = 
                {
                    RenkoPips,
                    // Bar size
                    BricksToShow,
                    // Show number of bricks
                    ZoomLevel,
                    //ZoomLevel
                    BullishBarColor,
                    // Bullish bar color
                    BearishBarColor
                    // Bearish bar color
                };
                renko = Indicators.GetIndicator<Renko>(parameterValues);
            }

            protected override void OnTick()
            {

                var buyPosition = Positions.Find("Renko", Symbol, TradeType.Buy);
                var sellPosition = Positions.Find("Renko", Symbol, TradeType.Sell);

                bool isLastBrickBullish = renko.Open.Last(0) < renko.Close.Last(0);


                if (isLastBrickBullish && buyPosition == null)
                {
                    if (sellPosition != null)
                        ClosePosition(sellPosition);
                    //Print("buying");
                    ExecuteMarketOrder(TradeType.Buy, Symbol, Quantity, "Renko");
                }

                else if (!isLastBrickBullish && sellPosition == null)
                {
                    if (buyPosition != null)
                        ClosePosition(buyPosition);
                    //Print("Selling");
                    ExecuteMarketOrder(TradeType.Sell, Symbol, Quantity, "Renko");
                }
            }
        }
    }


 


@ceakuk

ceakuk
19 Mar 2018, 17:06

Thanks for reply.

im creating a Cbot using this renko /algos/indicators/show/1086

I'm expecting  to buy everytime it Turns Bullish and Sell everytime it turns Bearish.

I'm expecting that if my Bricksize is say 50Pips, then the maximum loss should be 2X= 100pips +- small value. So 1 brick stoploss However I'm seeing upto 4X in Loss whenever I buy and it turns bearish and vice versa. Any Ideas will be highly appreciated

 

using System;
using System.Linq;
using System.Collections.Generic;
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 RenkoBot : Robot
    {

        [Parameter("Renko Pips", DefaultValue = 10, MinValue = 0.5, Step = 2)]
        public double RenkoPips { get; set; }


        [Parameter("Number Of Bricks", DefaultValue = 100, MinValue = 10, Step = 100)]
        public int BricksToShow { get; set; }

        [Parameter("Zoom Level", DefaultValue = 3, MinValue = 0, MaxValue = 5, Step = 1)]
        public double ZoomLevel { get; set; }

        [Parameter("Bullish bar color", DefaultValue = "SeaGreen")]
        public string BullishBarColor { get; set; }

        [Parameter("Bearish bar color", DefaultValue = "Tomato")]
        public string BearishBarColor { get; set; }

        [Parameter("Quantity", DefaultValue = 1000, MinValue = 1000, Step = 1000)]
        public int Quantity { get; set; }


        private Renko renko;

        protected override void OnStart()
        {
            object[] parameterValues = 
            {
                RenkoPips,
                // Bar size
                BricksToShow,
                // Show number of bricks
                ZoomLevel,
                //ZoomLevel
                BullishBarColor,
                // Bullish bar color
                BearishBarColor
                // Bearish bar color
            };
            renko = Indicators.GetIndicator<Renko>(parameterValues);
        }

        protected override void OnTick()
        {

            var buyPosition = Positions.Find("Renko", Symbol, TradeType.Buy);
            var sellPosition = Positions.Find("Renko", Symbol, TradeType.Sell);

            bool isLastBrickBullish = renko.Open.Last(0) < renko.Close.Last(0);


            if (isLastBrickBullish && buyPosition == null)
            {
                if (sellPosition != null)
                    ClosePosition(sellPosition);
                //Print("buying");
                ExecuteMarketOrder(TradeType.Buy, Symbol, Quantity, "Renko");
            }

            else if (!isLastBrickBullish && sellPosition == null)
            {
                if (buyPosition != null)
                    ClosePosition(buyPosition);
                //Print("Selling");
                ExecuteMarketOrder(TradeType.Sell, Symbol, Quantity, "Renko");
            }
        }
    }
}


@ceakuk

ceakuk
19 Mar 2018, 16:24

How can I post a question I have not seen any button. Thanks


@ceakuk