Topics
14 Dec 2019, 23:09
 1
 1386
 1
14 Dec 2019, 15:02
 3
 1327
 1
14 Dec 2019, 14:57
 5
 1282
 2
29 Nov 2019, 11:59
 1
 1248
 1
17 Nov 2019, 01:49
 7
 1886
 1
17 Nov 2019, 01:46
 6
 1509
 1
17 Nov 2019, 01:43
 4
 1215
 1
Add-ons

cTrader Automate

Suggestions
17 Nov 2019, 01:34
 3
 1523
 1
17 Nov 2019, 01:32
 3
 1334
 1
17 Nov 2019, 01:31
 6
 1274
 1
17 Nov 2019, 01:29
 2
 1238
 1
20 Feb 2019, 19:23
 1384
 4
21 Jan 2018, 16:53
 0
 1780
 1
Replies

whis.gg
19 Apr 2016, 13:49 ( Updated at: 21 Dec 2023, 09:20 )

Hi,

Some brokers simple do not provide real DoM and have their volumes fixed.

I hope it helps.


@whis.gg

whis.gg
01 Apr 2016, 08:57

I usually use this. I suppose you won't let the bot run on same symbol and timeframe multiple times (if sou, you can add parameters into it).

string label = string.Format("cBot name ({0} : {1})", Symbol.Code, MarketSeries.TimeFrame);

 


@whis.gg

whis.gg
26 Mar 2016, 22:33

Short version.

double result = 100;
for (int i = 0; i < Period; i++)
{
    result *= (1 + value1[index - i])
}

Curr1[index] = result;

 


@whis.gg

whis.gg
26 Mar 2016, 22:28

Hey, I haven't tested but it should work.

double result = 0;
for (int i = 0; i < Period; i++)
{
    if (i == 0)
    {
        result = (1 + value1[index]);
    }
    else
    }
        result *= (1 + value1[index - i])
    }
}

Curr1[index] = 100 * result;

 


@whis.gg

whis.gg
19 Mar 2016, 17:37

RE:

aimerdoux said:

Hi , Ill be really I think is probably a good idea to add the Ticks Timeframes to the TimeFrames interface because sometimes we want to get the market series of that timeframe using marketdata.getseries(Symbol.Code, Timeframes.Tick10(what now is not possible because the interface only contains the values >= Timeframe.Minute))

I agree, would like to see that option as well.


@whis.gg

whis.gg
17 Mar 2016, 23:53

Hello, if you want to execute random order each time, change following piece of code:

if (position.GrossProfit > 0)                                 // if last closed position ended up in profit
{
   ExecuteOrder(InitialQuantity, GetRandomTradeType());       // execute random trade type order
}
else                                                          // else
{
   ExecuteOrder(position.Quantity * 2, position.TradeType);   // execute same trade type order as last one with doubled quantity
}

to this:

if (position.GrossProfit > 0)                                 // if last closed position ended up in profit
{
   ExecuteOrder(InitialQuantity, GetRandomTradeType());       // execute random trade type order
}
else                                                          // else
{
   ExecuteOrder(position.Quantity * 2, GetRandomTradeType()); // execute random trade type order with doubled quantity
}

 

I hope it helps. :)


@whis.gg

whis.gg
26 Feb 2016, 01:39

RE:

tmc. said:

What about making the custom indicator which would hold OHLC values in certain time range? That way you could achieve the gap you want.

You can even shift the previous values to simulate the gap for calculations in other indicators your bot is based on. :)


@whis.gg

whis.gg
26 Feb 2016, 01:37

What about making the custom indicator which would hold OHLC values in certain time range? That way you could achieve the gap you want.


@whis.gg

whis.gg
17 Feb 2016, 02:02

You're welcome! Glad to help. :)


@whis.gg

whis.gg
16 Feb 2016, 15:26

You need to write the method finding highs and lows first, then you just compare them. However you don't need an array for it, it's better to use IndicatorDataSeries instead. I recommend to look at indicators that are published by others. Or hire someone to code the indicator you want. I'm also freelancer so feel free to contact me via email if you want my service.


@whis.gg

whis.gg
16 Feb 2016, 13:37 ( Updated at: 21 Dec 2023, 09:20 )

Hi, I hope this sample will help.

using cAlgo.API;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ArraySample : Indicator
    {
        private double[] array;

        protected override void Initialize()
        {
            array = new double[4];

            array[0] = 23.6;
            array[1] = 38.2;
            array[2] = 50;
            array[3] = 61.8;

            foreach (var a in array)
                Print(a);
        }

        public override void Calculate(int index)
        {

        }
    }
}


@whis.gg

whis.gg
16 Feb 2016, 13:17

RE:

cyfer said:

it does catch some values outside the range (30-70 or whatever the range)

If you want to filter that, you might apply this method, although it's kinda sketchy.

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

namespace cAlgo
{
    [Levels(20, 80)]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class StochasticColored : Indicator
    {
        [Output("Result", Color = Colors.Gray)]
        public IndicatorDataSeries Result { get; set; }

        [Output("Overbought", Color = Colors.LimeGreen, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Overbought { get; set; }

        [Output("Oversold", Color = Colors.Red, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Oversold { get; set; }

        private StochasticOscillator stoch;

        protected override void Initialize()
        {
            stoch = Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple);
        }

        public override void Calculate(int index)
        {
            Result[index] = stoch.PercentK.LastValue;

            // Overbought
            if (Result[index] > 80)
            {
                if (Result[index - 1] < 80)
                    Overbought[index - 1] = 80;
                    
                Overbought[index] = Result[index];
            }
            else if (Result[index - 1] > 80 && Result[index] < 80)
                Overbought[index] = 80;

            // Oversold
            if (Result[index] < 20)
            {
                if (Result[index - 1] > 20)
                    Oversold[index - 1] = 20;
                    
                Oversold[index] = Result[index];
            }
            else if (Result[index - 1] < 20 && Result[index] > 20)
                Oversold[index] = 20;
        }
    }
}


@whis.gg

whis.gg
16 Feb 2016, 02:43

Hey, here is workaround I use. Notice that I define previous value of series as well to make sure discontinuous line are plotted properly.

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

namespace cAlgo
{
    [Levels(20, 80)]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class StochasticColored : Indicator
    {
        [Output("Result", Color = Colors.Gray)]
        public IndicatorDataSeries Result { get; set; }

        [Output("Overbought", Color = Colors.LimeGreen, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Overbought { get; set; }

        [Output("Oversold", Color = Colors.Red, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Oversold { get; set; }

        private StochasticOscillator stoch;

        protected override void Initialize()
        {
            stoch = Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple);
        }

        public override void Calculate(int index)
        {
            Result[index] = stoch.PercentK.LastValue;

            if (Result[index] > 80)
            {
                Overbought[index - 1] = Result[index - 1];
                Overbought[index] = Result[index];
            }

            if (Result[index] < 20)
            {
                Oversold[index - 1] = Result[index - 1];
                Oversold[index] = Result[index];
            }
        }
    }
}

Result:


@whis.gg

whis.gg
09 Feb 2016, 22:48

RE:

Hi, you mean like that?

private DataSeries Source;

protected override void Initialize()
{
    Source = MarketSeries.Close;
}

 


@whis.gg

whis.gg
03 Feb 2016, 16:36

What does Indicators have to do with that? Anyway, default template, no objects - bug is still there.


@whis.gg

whis.gg
03 Feb 2016, 16:20 ( Updated at: 21 Dec 2023, 09:20 )

This is quite interesting too.


@whis.gg

whis.gg
03 Feb 2016, 16:12

This post has been removed by moderator due to a violation of the EULA. Broker discussions are prohibited in cTDN.

 


@whis.gg

whis.gg
03 Feb 2016, 15:56 ( Updated at: 21 Dec 2023, 09:20 )

Same with the menu after right-click on chart.


@whis.gg

whis.gg
02 Feb 2016, 19:07 ( Updated at: 21 Dec 2023, 09:20 )

Never mind, I figured it out. :)


@whis.gg

whis.gg
02 Feb 2016, 15:09

RE:

MaVe said:

Maybe it's there:

/search?q=Directional+Movement+System

It's not. I need the exact formula of calculations in order to achieve same values.


@whis.gg