Topics
24 Oct 2020, 15:02
 4
 1632
 1
20 Aug 2020, 12:10
 8
 1533
 1
25 Jun 2020, 12:05
 2012
 3
22 May 2020, 10:18
 3
 1250
 1
14 May 2020, 10:54
 2
 1979
 4
14 May 2020, 10:33
 4
 1422
 1
03 May 2020, 11:42
 2
 1401
 1
03 May 2020, 11:36
 3
 1236
 1
03 May 2020, 11:32
 10
 2530
 5
27 Apr 2020, 18:28
 3
 1155
 1
27 Apr 2020, 18:23
 3
 1188
 1
27 Apr 2020, 12:08
 3
 1157
 1
27 Apr 2020, 12:05
 2
 1192
 1
23 Apr 2020, 11:33
 15
 1980
 1
23 Apr 2020, 11:24
 4
 1465
 1
Replies

afhacker
24 Oct 2018, 07:33

using cAlgo.API;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None, AutoRescale = true)]
    public class AdvancedVolume : Indicator
    {
        #region Fields

        private double _lastPriceValue;

        #endregion Fields

        #region Parameters

        [Parameter("Use Live Data", DefaultValue = false)]
        public bool UseLiveData { get; set; }

        [Parameter("Show in %", DefaultValue = true)]
        public bool ShowInPercentage { get; set; }

        #endregion Parameters

        #region Outputs

        [Output("Bullish Volume", Color = Colors.Lime, PlotType = PlotType.Histogram, Thickness = 5)]
        public IndicatorDataSeries BullishVolume { get; set; }

        [Output("Bearish Volume", Color = Colors.Red, PlotType = PlotType.Histogram, Thickness = 5)]
        public IndicatorDataSeries BearishVolume { get; set; }

        #endregion Outputs

        #region Methods

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

        public override void Calculate(int index)
        {
            if (IsLastBar && UseLiveData)
            {
                if (MarketSeries.Close.LastValue > _lastPriceValue)
                {
                    double volume = double.IsNaN(BullishVolume[index]) ? 1 : BullishVolume[index] + 1;

                    BullishVolume[index] = ShowInPercentage ? volume / MarketSeries.TickVolume[index] : volume;
                }
                else if (MarketSeries.Close.LastValue < _lastPriceValue)
                {
                    double volume = double.IsNaN(BearishVolume[index]) ? -1 : BearishVolume[index] - 1;

                    BearishVolume[index] = ShowInPercentage ? volume / MarketSeries.TickVolume[index] : volume;
                }

                _lastPriceValue = MarketSeries.Close.LastValue;
            }
            else
            {
                double barRange = MarketSeries.High[index] - MarketSeries.Low[index];

                double percentageAboveBarClose = (MarketSeries.High[index] - MarketSeries.Close[index]) / barRange;
                double percentageBelowBarClose = -(MarketSeries.Close[index] - MarketSeries.Low[index]) / barRange;

                BullishVolume[index] = ShowInPercentage ? percentageBelowBarClose : MarketSeries.TickVolume[index] * percentageBelowBarClose;
                BearishVolume[index] = ShowInPercentage ? percentageAboveBarClose : MarketSeries.TickVolume[index] * percentageAboveBarClose;
            }
        }


        #endregion Methods
    }
}

@afhacker

afhacker
23 Oct 2018, 07:57

You can also use my Advanced Volume indicator, it counts each up/down tick of the last bar and shows it in two different up/down histogram bar.

For historical bars, it uses a formula to count the number of up/down ticks, you can find more detail on its description.


@afhacker

afhacker
27 Sep 2018, 16:56

RE: RE: RE:

peterkalw said:

afhacker said:

peterkalw said:

Thanks @afhacker!

I posted a job request.

Perhaps you could do it?

No, I can't.

I'm too busy right now.

Maybe you can recommend somebody?

Try clickalgo


@afhacker

afhacker
27 Sep 2018, 14:08

RE:

peterkalw said:

Thanks @afhacker!

I posted a job request.

Perhaps you could do it?

No, I can't.

I'm too busy right now.


@afhacker

afhacker
27 Sep 2018, 13:40

It's possible to get TradingView alerts data and use it as a trading signal on your cTrader trading account, you can do it directly from cTrader Automate API or by using Spotware Connect API.

Post a job request in the Jobs page and somebody will develop it for you,


@afhacker

afhacker
26 Sep 2018, 17:03 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE:

andresfborrero97@gmail.com said:

ColossusFX said:

Have you guys seen this?

cMulti

Copy trades to &  from multiple cTrader accounts.

cMulti - Copy trades to &  from multiple cTrader accounts.

I have been using this to manage accounts for friends.

You set which account/s you want to copy from and all trades are copied in real time.

https://www.algodeveloper.com/17-cmulti

Yeah, although it looks like a nice tool... It lacks scalability for enterprise use... It says it is a PAMM when it really is just a personal mirror assistant for copying trades. 

Thanks still

Where did it say its a PAMM? cMulti (cMAM) is a tool for managing multiple cTrader accounts.


@afhacker

afhacker
21 Sep 2018, 07:21

For double generic collections you can use this method:

        public static double Correlation(IEnumerable<double> x, IEnumerable<double> y)
        {
            double xSum = x.Sum();
            double ySum = y.Sum();

            double xSumSquared = Math.Pow(xSum, 2);
            double ySumSquared = Math.Pow(ySum, 2);

            double xSquaredSum = x.Select(value => Math.Pow(value, 2)).Sum();
            double ySquaredSum = y.Select(value => Math.Pow(value, 2)).Sum();

            double xAndyProductSum = x.Zip(y, (value1, value2) => value1 * value2).Sum();

            double n = x.Count();

            return ((n * xAndyProductSum) - (xSum * ySum)) / Math.Sqrt(((n * xSquaredSum) - xSumSquared) * ((n * ySquaredSum) - ySumSquared));
        }

 


@afhacker

afhacker
21 Sep 2018, 07:16

        public static double GetCorrelation(DataSeries dataSeries, DataSeries otherDataSeries)
        {
            double[] values1 = new double[dataSeries.Count];
            double[] values2 = new double[dataSeries.Count];

            for (int i = 0; i < dataSeries.Count; i++)
            {
                values1[i] = dataSeries.Last(i);
                values2[i] = otherDataSeries.Last(i);
            }

            var avg1 = values1.Average();
            var avg2 = values2.Average();

            var sum = values1.Zip(values2, (x1, y1) => (x1 - avg1) * (y1 - avg2)).Sum();

            var sumSqr1 = values1.Sum(x => Math.Pow((x - avg1), 2.0));
            var sumSqr2 = values2.Sum(y => Math.Pow((y - avg2), 2.0));

            return Math.Round(sum / Math.Sqrt(sumSqr1 * sumSqr2), 2);
        }

This function returns the correlation between two data series.


@afhacker

afhacker
01 Aug 2018, 07:49 ( Updated at: 21 Dec 2023, 09:20 )


@afhacker

afhacker
23 Jul 2018, 16:39

Finally some real improvement!

Please add the platform time zone as a property in form of a TimeZoneInfo object so the developer will be able to know what's the user platform time zone setting, I don't know why you haven't added it yet.


@afhacker

afhacker
28 Jun 2018, 07:50

RE:

irmscher9 said:

Hey guys

Is it possible to STOP all the running cBots with a piece of code?

Cheers

You can do it with named pipe server and some other methods.


@afhacker

afhacker
21 Jun 2018, 07:23

RE:

PapaGohan said:

Pivot points with sup/res is available on every other platform I have tried. Is this something in the works? Could it be added to some sort of "todo list"?

FX Trading Station has the ability to add 6 different types of pivot points:

  • Classic pivot
  • Camarilla
  • Woodie
  • Fibonacci
  • Floor
  • Fibonacci retracement

It's super useful, having anything like this built in would be great!

Five different types of pivot points indicator for cTrader: https://www.algodeveloper.com/product/pivot-points/


@afhacker

afhacker
13 Jun 2018, 15:01

RE:

Panagiotis Charalampous said:

Dear Trader,

Thanks for posting in our forum. This is currently not possible in cAlgo. A workaround is to get the Color as a string parameter and use the following function to convert the string to a Color

        //A function for getting the color from a string
        private Colors GetColor(string colorString)
        {
            foreach (Colors color in Enum.GetValues(typeof(Colors)))
            {
                if (color.ToString() == colorString)
                    return color;
            }
            return Colors.White;
        }

Let me know if this helps,

Best Regards,

Panagiotis

 

Simple method:

        private Colors GetColor(string colorText, string colorParameterName)
        {
            Colors color;

            if (!Enum.TryParse(colorText, true, out color))
            {
                string errorObjName = string.Format("Your input for '{0}' parameter is incorrect", colorParameterName);

                ChartObjects.DrawText("Error", errorObjName, StaticPosition.Center, Colors.Red);

                // throw new ArgumentException(errorObjName);
            }

            return color;
        }

 


@afhacker

afhacker
18 Mar 2018, 06:07

Supply and demand zones indicator for cTrader: https://www.algodeveloper.com/1-supply-and-demand-zones


@afhacker

afhacker
02 Mar 2018, 09:56

First thanks for adding this new features but what about community requests? where is multi-symbol backtesting? or different parameter types like Enums, date time picker,...

And is there any property to get a collection of all available symbols? that will be a simple feature to add before releasing the new version of API.

The current API library is based on .Net framework 4 which is obsolete, please update the .Net version to > 4.6 at least.

Another main issue of current API is limited drawing, please improve the API chart drawing feature by adding:

1. Transparency

2. Different shapes drawing

3. Checking current objects on chart and modifying those objects

4. A collection of objects drawn by current indicator or cBot

And please add a property to get the user platform (not system as it's available by .Net) time zone as a .Net TimeZoneInfo object.

Adding all these features will not get much time but I don't know why Spotware is very slow in adding new features?

Multi-symbol backtesting is one of the top suggestions and most voted of the community so please add it!


@afhacker

afhacker
28 Jan 2018, 08:47

+1

And please add the transparent drawing feature to cAlgo API so we will be able to define the alpha % of each chart object alongside its color.

 


@afhacker

afhacker
03 Nov 2017, 07:27

I sent you an invitation.


@afhacker

afhacker
02 Nov 2017, 20:07

Can you give me your email address? I will invite you to our Slack.


@afhacker

afhacker
02 Nov 2017, 16:04 ( Updated at: 21 Dec 2023, 09:20 )

Hi Hamid Reza,

There were some bugs in Alert library that I fixed and the new version is available, you can download your indicator which uses the new version of the alert library from here:

https://drive.google.com/open?id=0B93GK1Ip4NSMWldXRTljRTZ1ZEk


@afhacker