Topics

Forum Topics not found

Replies

amusleh
05 Aug 2021, 10:24

Hi,

Try this:

using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
    public class DMIHISTOBAR : Indicator
    {
        private DirectionalMovementSystem _adx;

        [Parameter("ADX Period", DefaultValue = 2, MinValue = 1, MaxValue = 60)]
        public int ADXPeriod { get; set; }

        [Output("Bullish", LineColor = "Blue", PlotType = PlotType.Histogram, Thickness = 4)]
        public IndicatorDataSeries Bullish { get; set; }

        [Output("Bearish", LineColor = "Red", PlotType = PlotType.Histogram, Thickness = 4)]
        public IndicatorDataSeries Bearish { get; set; }

        protected override void Initialize()
        {
            _adx = Indicators.DirectionalMovementSystem(ADXPeriod);
        }

        public override void Calculate(int index)
        {
            Bullish[index] = double.NaN;
            Bearish[index] = double.NaN;

            if (_adx.DIPlus[index] > _adx.DIMinus[index])
            {
                Bullish[index] = _adx.ADX[index];
            }
            else
            {
                // Remove the - (minus) if you want to show both outputs in positive above zero line
                Bearish[index] = -_adx.ADX[index];
            }
        }
    }
}

 


@amusleh

amusleh
03 Aug 2021, 08:09

RE:

opusensemble said:

Dear amusleh, 

Thank you for your reply. 

Does ExecutionEvent also apply to position modification (TP, SL or partial closes)? 

Thank you 

Hi,

Yes, it does.


@amusleh

amusleh
02 Aug 2021, 07:55

Hi,

Please check the code example on API references for the Chart trend line.


@amusleh

amusleh
02 Aug 2021, 07:53

RE: Heartbeat documentation

opusensemble said:

Hi,

Where can the heartbeat documentation or a usage example be found?

Looking forward to hearing back from you, 
Best Regards, 

Hi,

You can find all details on the documentation.


@amusleh

amusleh
02 Aug 2021, 07:53

RE: RE:

opusensemble said:

Hi amusleh, 

Where can the heartbeat documentation or a usage example for Open API be found?

Looking forward to hearing back from you, 
Best Regards, 

Hi,

Please read the documentation connection tutorial.


@amusleh

amusleh
02 Aug 2021, 07:52

Hi,

You have to use ExecutionEvent, whenever a trader executes a trading operation you will receive an execution event with the trading operation details.

Regarding connection status, you have to use your socket and check if you can send/receive a message or not, there is also a client disconnected proto message that you can use.

Please check our OpenAPI.NET WPF and ASP web app samples.

For more please check the Open API documentation.


@amusleh

amusleh
01 Aug 2021, 16:12

Hi,

You should post this on the Jobs page, or ask one of our consultants to develop it for you.


@amusleh

amusleh
01 Aug 2021, 10:14

Hi,

Please create a thread in the forum suggestions section.


@amusleh

amusleh
01 Aug 2021, 10:13

Hi,

Most probably the issue is with your optimization settings or cBot, please check the logs tab and you might find some error message there.


@amusleh

amusleh
01 Aug 2021, 10:12

RE:

volvefx2 said:

Is anyone using cMAM to mirror trades between cTrader and Metatrader accounts? or do you use any other software for that purpose? Thanks!

Hi,

cMAM is not a product of Spotware, it's a 3rd party product.

Please contact the developers and ask them your question.


@amusleh

amusleh
31 Jul 2021, 08:27

Hi,

Heiken Ashi chart is not available on Mobile version of cTrader, if you wanted it to be added please create a thread for it in the forum suggestions section.


@amusleh

amusleh
31 Jul 2021, 08:25

Hi,

If you don't have any programming experience then I recommend you to post a job request on cTrader.com Jobs page.

We only answer specific programming questions related to automate API here.


@amusleh

amusleh
31 Jul 2021, 08:22

Hi,

The code you pasted iterates over all available trend lines on your chart, and then you save each trend line reference to _chartTrendLine variable, at the end of the loop it will have a reference to the latest iterated trend line.

Then you get the latest bar index Y (Price) value by using the trend line CalculateY method.

I'm not sure what exactly you are trying to do, but that's what your code does.


@amusleh

amusleh
30 Jul 2021, 17:21

Hi,

All chart objects are inside Chart.Objects collection and you can iterate over it to find specific object by using Linq or a foreach loop:

using System;
using cAlgo.API;
using System.Linq;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Test : Indicator
    {
        protected override void Initialize()
        {
            // GetTrendLine can return null if there was no matching trend line
            var myTrendLine = GetTrendLine("MyTrendLine");
        }

        private ChartTrendLine GetTrendLine(string name)
        {
            var chartObjects = Chart.Objects.ToArray();

            return chartObjects.FirstOrDefault(chartObject => chartObject.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && chartObject.ObjectType == ChartObjectType.TrendLine) as ChartTrendLine;
        }

        public override void Calculate(int index)
        {
        }
    }
}

 


@amusleh

amusleh
30 Jul 2021, 13:44

The trendbars time zone is UTC as I said.


@amusleh

amusleh
30 Jul 2021, 09:47

Hi,

There are plenty of Volume/market profile indicators for cTrader developed by the community, you can develop one based on your own specific needs if the available ones don't have the features you are after.

You can try this one from AlgoDeveloper: https://www.algodeveloper.com/product/volume-profile/


@amusleh

amusleh
30 Jul 2021, 09:45

Hi,

Right now there is no such feature but you can create a suggestion for this on the forum suggestions section.


@amusleh

amusleh
30 Jul 2021, 09:43

Please create a thread in the suggestions section of the forum.


@amusleh

amusleh
30 Jul 2021, 09:43

Hi,

Symbols are added by brokers, please ask your broker to add the Euro Index symbol.


@amusleh

amusleh
30 Jul 2021, 09:41

Hi,

cBots has no effect on your system connection with cTrader, if something goes wrong when you run your cBot then it means your cBot is the problem and you should check the cBot code.


@amusleh