Replies

PanagiotisCharalampous
15 Apr 2020, 08:29

Hi Luca,

See an example below

        IchimokuKinkoHyo _ikh;
        protected override void OnStart()
        {
            _ikh = Indicators.IchimokuKinkoHyo(9,26,52);
            Print(_ikh.SenkouSpanA.Last(1));
            Print(_ikh.SenkouSpanB.Last(1));
        }

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
15 Apr 2020, 08:25

Hi contact.bitq,

You can check the reason which caused the position to close using PositionCloseReason provided in the Position.Closed event arguments.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 17:10

Hi dachoor,

You can post the source code and images of the parameters and optimization results here. But as far as I understand, this is a commercial product therefore you probably have no source code. If Paul can send us some code privately, we can have a look.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 14:44

Hi einrel.lernie,

No since this is not a cTrader Automate API specific question but a general programming question. The process should be the same as in any .Net application therefore you need to choose a licensing product you will use and refer to the documentation of that product.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 14:41

Hi sessialessio,

Not really. It is a general suggestion to a general question. Trying to become more specific, save in a file the information you need in order to make a decision if an indicator needs to be reinitialized or not e.g. if objects have been drawn or if they have to be drawn again. But you are the one who knows what needs to be done exactly. If you have more specific questions, I would be happy to give more specific answers.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 12:52

Hi sessialessio,

By design, when a chart is refreshed for any reason, the indicator is reinitialized. If you want to avoid some part of the code being executed when the indicator is initialized, you will need to implement your own logic that will keep track of the indicator state e.g. write the state in a file.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 12:00

Hi Paul,

There are some known issues with optimization results therefore we will need some source code to reproduce this behavior and determine if this is one of them or a new one that we will have to look into.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 11:48

Hi Luca,

You can use the Bars.OpenPrices dataseries. If you need the open price 10 candles before, you should check Bars.OpenPrices[Bars.OpenPrices.Count - 10].

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 10:30

Hi Takis,

This behavior is by design. But even if it was a bug, you are still in the wrong section :).

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 09:00

Hi Samuel,

You can use the Server.Time property to check the time and execute the relevant actions. If you need somebody to program a complete cBot for you, you can post a Job or contact a Consultant.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 08:38

Hi Takis,

Please use the Suggestions section for suggestions.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 08:22

Hi dachoor,

To be able to check this issue, you need to provide us with the cBot code, the optimization parameters and your broker so that we can reproduce this behavior.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
14 Apr 2020, 08:20

Hi Samuel,

There is no built-in feature in cTrader to do this but you can write a cBot that will place the order at the relevant time.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
13 Apr 2020, 16:33

Hi einrel.lernie,

You can check the Maximum and Minimum methods.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
13 Apr 2020, 14:11

Hi Tj11,

Can you please explain to us what is the problem?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
13 Apr 2020, 12:38

Hi Sebastijan,

No this is not possible. You should consider other ways of saving your connection strings.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 Apr 2020, 11:44

Hi there,

Check the example below

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

namespace cAlgo
{

    [Indicator("test", IsOverlay = true, AccessRights = AccessRights.None)]
    public class test : Indicator
    {
        [Parameter("Offset (Pips)", DefaultValue = 5)]
        public int Offset { get; set; }

        protected override void Initialize()
        {


        }

        public override void Calculate(int index)
        {


            Chart.DrawVerticalLine("line 9", index - 8, Color.Gray, 1, LineStyle.LinesDots);
            Chart.DrawVerticalLine("line 17", index - 16, Color.Gray, 1, LineStyle.LinesDots);

            Chart.DrawText("9", "9", index - 8, Chart.BottomY + (Symbol.PipSize * Offset), Color.White);
            Chart.DrawText("17", "17", index - 16, Chart.BottomY + (Symbol.PipSize * Offset), Color.White);


        }

    }
}

 

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 Apr 2020, 09:11

Hi systemtradingvn02,

If you need somebody to develop the indicator for you, you can consider posting a Job or contact a Consultant.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 Apr 2020, 09:06

Hi mahnas2869,

You can get both Bid and Ask prices in backtesting, hence you can calculate the spread as well. See below 

using System;
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()
        {
            // Put your initialization logic here
        }

        protected override void OnTick()
        {
            Print("Ask: " + Symbol.Ask);
            Print("Bid: " + Symbol.Bid);
            Print("Spread: " + Math.Round(Symbol.Ask - Symbol.Bid, Symbol.Digits));
        }

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

 

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 Apr 2020, 08:56

Hi contact.bitq,

You need to explain more clearly what do you mean when you say they do not work. What did you expect to happen and what happens instead? Also please provide the complete indicator code.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous