Replies

ceakuk
17 Aug 2018, 13:41

RE: RE:

I just got the beta version. wow, your  beta version is so great. i cant wait for the final version. modify volume does not misbihave in the  public beta version 3.0

 


@ceakuk

ceakuk
17 Aug 2018, 13:24

RE:

I'm using ctrader 3.0

I don't know if its beta. could you please help me with a link to download beta version?

 


@ceakuk

ceakuk
17 Aug 2018, 12:42 ( Updated at: 21 Dec 2023, 09:20 )

Hi, panagiotis,

Thanks for your reply. when can we expect i?

im tired of my back testing 1000$-156,000$ in just 19 days trading 5pips renko with positions a

These are crazy and impossible profits. every time i close  part of the open position in profit using modify volume, the equity chart just gets  astronomically high as you can see in the chart.

 

Thank you in advance

 


@ceakuk

ceakuk
30 Jul 2018, 12:00

RE:

Dear Panagiotis,

Thanks for the reply. did you mean they have been working on it  before I sent the request or they saw it from my  request?

Thanks

 


@ceakuk

ceakuk
30 Jul 2018, 11:37 ( Updated at: 21 Dec 2023, 09:20 )


@ceakuk

ceakuk
12 Jul 2018, 17:22

RE:

Thank you Andrey Pisarev


@ceakuk

ceakuk
24 Apr 2018, 15:49

I'm sorry it seams to work now though i dont know why. but it was obvious that for H! data to go far into index=1  is in 2012 is  too much back in time. Sorry for the inconvenience


@ceakuk

ceakuk
24 Apr 2018, 15:29

RE:

I think you don't get me. so if calculate does not find data it takes the next index?

well I have looked at say hourly data and the last value in LOG is either so big or so small there is no other suck close in the next  many months none .

I mean 1.18214 in the log is way out of range of 1.2125 to 1.2425 by probably mana many months .

 


@ceakuk

ceakuk
24 Apr 2018, 15:00

RE:

Exactly. look at your log file . it says time 8/13/2017,  current data value= 1.18214.

However in the chart the values range from 1.2125 to 1.2425. way higher than the 1.18214.

Thats why i question the data


@ceakuk

ceakuk
24 Apr 2018, 13:44

RE: RE:
//CORRECTION
if (MarketSeries.OpenTime.Last(0).Ticks == tik)
{               
    Print("end=" + MarketSeries.OpenTime.Last(0);
 }

 


@ceakuk

ceakuk
24 Apr 2018, 13:41

RE:

Thanks a lot. However I got a way around it. In case  someone else has the same problem, here is how I do it.

Sice for example hourly H2 data is longer than say H1 or Minutes30 etc

I switch to higher time frame like H2 and  do this

 if (index == 0)
                Print("tak=" + MarketSeries.OpenTime.Last(0) + "       " + MarketSeries.OpenTime.Last(0).Ticks);
            

now that I have  time "tik" in Ticks as the bigining I switch to my desired lower time eg H1.

I decide how long I want it say 50 days

long tak = MarketSeries.OpenTime.Last(0) that  i got earlier in above code;
long tik = tak + (number of days * 864000000000L);//1 day=864000000000L ticks
 if(MarketSeries.OpenTime.Last(0) >= tak && MarketSeries.OpenTime.Last(0<=tik )
{
    //ALL YOUR CALCULATE LOGIC GOES HERE
   //IF PRINT START & PRINT END ARE SHOWN IN LOG THEN YOUR DATA IS WITHIN THE BOUNDARIES
   if (MarketSeries.OpenTime.Last(0) == tak)
    {
          //begining              
         Print("start=" + MarketSeries.OpenTime.Last(0));
    }
    if (MarketSeries.OpenTime.Last(0).Ticks == tiktak)
    {               
    Print("end=" + MarketSeries.OpenTime.Last(0);
    }
}

 


@ceakuk

ceakuk
23 Apr 2018, 18:50

RE:

Dear Panagiotis,

Unfortunately what you propose  does not exist. These is no way to import data to  calgo indicator. I see no link to that anywhere. thanks

 

 

Panagiotis Charalampous said:

Hi ceakuk,

Yes, I believe this is possible. You could create another indicator that reads values from csv data and use it as an imput to your current indicator.

Best Regards,

Panagiotis

 


@ceakuk

ceakuk
23 Apr 2018, 16:48

RE:

Thanks a lot even though I have no idea how to import data.

the only question I have is this

public override void Calculate(int index)
 {
 }

Usually  index belong to every tick in Market series I guess. if i import data, should i do a for loop every time i have index=0,1 2... or just once at  if(index==0)

or will the index now change to reflect the length of my  new csv data. Thanks


@ceakuk

ceakuk
23 Apr 2018, 14:47

RE:

and can i import say csv data to the indicator

 


@ceakuk

ceakuk
23 Apr 2018, 14:15

RE: RE:

I'm trying to modify parameters to my indicator(not this)

my indicator creates custome renko chart with dynamic  pip size. however everytime i check on the renko it is  very different everytime because of changing data. if i change my parameters i can not know how they affect the renko chart because the data also changes. thanks

 


@ceakuk

ceakuk
23 Apr 2018, 14:11

RE:

Panagiotis Charalampous said:

Its the data at index=0 . But now I see  every tick upsdates the data so data for index ==0 changes.
How can I use a fixed   range of data for testing  indicator

 


@ceakuk

ceakuk
10 Apr 2018, 00:15

RE: RE:

Thank you very much

Since I don't understand the meaning, I don't want to change from the default. are the 2  equivalent

ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "myLabel", 10, 10, null);
ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "myLabel", 10, 10);

 


@ceakuk

ceakuk
27 Mar 2018, 12:52

RE:

Panagiotis Charalampous said:

Thank you very much for always answering promptly. It works with live data. is it possible  to draw on back testing?

 

Sorry I had another question about indicator output

if possible could you please tell me why the indicator output MUST to be in the form

[Output("Close", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries Close { get; set; }

 

I just want to an output of a single double.

I try the one below and doesnt work when I use a robot to fetch the output value

[Output("Close")]
        public double Close { get; set; }

Thanks a lot


@ceakuk

ceakuk
27 Mar 2018, 12:03

RE:

if possible could you please tell me why the indicator output has to be in the form

[Output("Close", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries Close { get; set; }

I try the one below and doesnt work when I use a robot to fetch the output value

[Output("Close")]
        public double Close { get; set; }

 

 


@ceakuk

ceakuk
22 Mar 2018, 02:46 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Panagiotis Charalampous said:

Thank you Panagiotis. Here is the Renko Indicator

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

namespace cAlgo
{
    [Indicator("Renko", IsOverlay = true, AutoRescale = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Renko : Indicator
    {
        [Parameter("Renko (Pips)", DefaultValue = 10, MinValue = 0.1, Step = 1)]
        public double RenkoPips { get; set; }

        [Parameter("Bricks To Show", DefaultValue = 100, MinValue = 1)]
        public int BricksToShow { get; set; }

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

        [Parameter("Bullish Color", DefaultValue = "SeaGreen")]
        public string ColorBull { get; set; }

        [Parameter("Bearish Color", DefaultValue = "Tomato")]
        public string ColorBear { get; set; }

        [Output("Open", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries Open { get; set; }

        [Output("High", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries High { get; set; }

        [Output("Low", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries Low { get; set; }

        [Output("Close", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries Close { get; set; }

        public class Brick
        {
            public double Open { get; set; }
            public double Close { get; set; }
        }

        private List<Brick> renkos = new List<Brick>();
        private double closeLastValue, thickness, renkoPips, renkoLastValue;
        private Colors colorBull, colorBear;
        private bool colorError;
        private int lastCount;

        protected override void Initialize()
        {
            if (!Enum.TryParse<Colors>(ColorBull, out colorBull) || !Enum.TryParse<Colors>(ColorBear, out colorBear))
                colorError = true;

            renkoPips = RenkoPips * Symbol.PipSize;
            thickness = Math.Pow(2, ZoomLevel) - (ZoomLevel > 0 ? 1 : 0);
            renkoLastValue = 0;
        }

        public override void Calculate(int index)
        {
            if (colorError)
            {
                ChartObjects.DrawText("Error0", "{o,o}\n/)_)\n \" \"\nOops! Incorrect colors.", StaticPosition.TopCenter, Colors.Gray);
                return;
            }

            if (renkoLastValue == 0)
            {
                var open = MarketSeries.Open.LastValue;

                renkoLastValue = open - (open % renkoPips) + renkoPips / 2;
                //renkoLastValue = MarketSeries.Close.LastValue;
            }

            closeLastValue = MarketSeries.Close.LastValue;

            while (closeLastValue >= renkoLastValue + renkoPips)
            {
                renkoLastValue += renkoPips;
                renkos.Insert(0, new Brick 
                {
                    Open = renkoLastValue - renkoPips,
                    Close = renkoLastValue
                });
                if (renkos.Count() > BricksToShow)
                    renkos.RemoveRange(BricksToShow, renkos.Count() - BricksToShow);
                if (IsLastBar)
                    UpdateHistory(index);
            }
            while (closeLastValue <= renkoLastValue - renkoPips)
            {
                renkoLastValue -= renkoPips;
                renkos.Insert(0, new Brick 
                {
                    Open = renkoLastValue + renkoPips,
                    Close = renkoLastValue
                });
                if (renkos.Count() > BricksToShow)
                    renkos.RemoveRange(BricksToShow, renkos.Count() - BricksToShow);
                if (IsLastBar)
                    UpdateHistory(index);
            }

            bool isNewBar = MarketSeries.Close.Count > lastCount;

            if (IsLastBar && isNewBar)
            {
                UpdateHistory(index);

                Open[index - BricksToShow] = double.NaN;
                High[index - BricksToShow] = double.NaN;
                Low[index - BricksToShow] = double.NaN;
                Close[index - BricksToShow] = double.NaN;

                lastCount = MarketSeries.Close.Count;
            }

            if (IsRealTime)
                UpdateLive(index);
        }

        private void UpdateHistory(int index)
        {
            for (int i = 0; i < BricksToShow - 1 && i < renkos.Count() - 1; i++)
            {
                var color = renkos[i].Open < renkos[i].Close ? colorBull : colorBear;

                ChartObjects.DrawLine(string.Format("renko.Last({0})", i + 1), index - i - 1, renkos[i].Open, index - i - 1, renkos[i].Close, color, thickness, LineStyle.Solid);

                Open[index - i - 1] = renkos[i].Open;
                High[index - i - 1] = Math.Max(renkos[i].Open, renkos[i].Close);
                Low[index - i - 1] = Math.Min(renkos[i].Open, renkos[i].Close);
                Close[index - i - 1] = renkos[i].Close;
            }
        }

        private void UpdateLive(int index)
        {
            double y1, y2;
            var top = Math.Max(renkos[0].Open, renkos[0].Close);
            var bottom = Math.Min(renkos[0].Open, renkos[0].Close);

            if (closeLastValue > top)
                y1 = top;
            else if (closeLastValue < bottom)
                y1 = bottom;
            else
                y1 = closeLastValue;

            y2 = closeLastValue;

            var colorLive = y1 < y2 ? colorBull : colorBear;

            ChartObjects.DrawLine("renko.Live", index, y1, index, y2, colorLive, thickness, LineStyle.Solid);

            Open[index] = y1;
            High[index] = y1 > y2 ? y1 : y2;
            Low[index] = y1 < y2 ? y1 : y2;
            Close[index] = y2;
        }
    }
}

Here is the Renko Cbot

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


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

        protected override void OnTick()
        {

            double renkoPips = RenkoPips * Symbol.PipSize;
            bool isLastBrickBullish = renko.Open.Last(0) < renko.Close.Last(0);

            var buyPosition = Positions.Find("Renko", Symbol, TradeType.Buy);
            var sellPosition = Positions.Find("Renko", Symbol, TradeType.Sell);
            if (buyPosition != null)
            {
                if (buyPosition.Pips < -2 * RenkoPips)
                {
                    Print("start===================================");
                    Print("buyPositionpips=" + buyPosition.Pips);
                    Print("renkoPips=" + renkoPips + "cbot Symbol.Bid=" + Symbol.Bid + "  Symbol.Ask=" + Symbol.Ask);
                    Print("renko.Open.LastValue=" + renko.Open.LastValue + "  renko.Close.LastValue=" + renko.Close.LastValue);
                    Print("difference Symbol.Bid - renko.Open.LastValue= " + (Symbol.Bid - renko.Open.LastValue));
                    Print("difference Symbol.Bid - renko.Close.LastValue=  " + (Symbol.Bid - renko.Close.LastValue));
                    Print("difference Symbol.Bid - renko.Close.LastValue=  " + (Symbol.Ask - renko.Open.LastValue));
                    Print("difference Symbol.Bid - renko.Close.LastValue=  " + (Symbol.Ask - renko.Close.LastValue));
                    Print("end===================================");
                }
            }

            if (sellPosition != null)
            {
                if (sellPosition.Pips < -2 * RenkoPips || sellPosition.Id == 11)
                {
                    Print("start===================================");
                    Print("sellPositionpips=" + sellPosition.Pips);
                    Print("renkoPips=" + renkoPips + "cbot Symbol.Bid=" + Symbol.Bid + "  Symbol.Ask=" + Symbol.Ask);
                    Print("renko.Open.LastValue=" + renko.Open.LastValue + "  renko.Close.LastValue=" + renko.Close.LastValue);
                    Print("difference Symbol.Bid - renko.Open.LastValue= " + (Symbol.Bid - renko.Open.LastValue));
                    Print("difference Symbol.Bid - renko.Close.LastValue=  " + (Symbol.Bid - renko.Close.LastValue));
                    Print("difference Symbol.Bid - renko.Close.LastValue=  " + (Symbol.Ask - renko.Open.LastValue));
                    Print("difference Symbol.Bid - renko.Close.LastValue=  " + (Symbol.Ask - renko.Close.LastValue));
                    Print("end===================================");
                }
            }



            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");
            }
        }
    }
}

 and here is the Image

 Im 09/03/2017- 23/04/2017 using 1M Ticks data. I guess being ticks it doesnt matter if its 1M. My commision is 70 per million. my time zone is UTC+1 trading 50 pips but I get as  high as -187.6 pips. 2 minutes before closing its just -2.8pips . It happens a lot that clog can record high gain in pips but when the position close a minute later, its large negative pips 4 times (-187.6pips) my stoploss of 1 brick=-5pips.

I used to think the indicator feeds wrong results to cbot but as i print  both the pips and theSymbol.Bis, Symbol.Ask and renko.Open.LastValue, renko.Closelastvalue. its now apparent that something is wrong with the calgo backtesting platform.

Thank you and i'm looking foward.

With kind regards,

Kevin


@ceakuk