Topics

Forum Topics not found

Replies

amusleh
10 Jun 2022, 13:51

Hi,

Yes, its possible, if you received any rejection you can check the reason and act accordingly.


@amusleh

amusleh
10 Jun 2022, 10:18

Hi,

Here you can read more about stop limit orders: Stop-Limit Order Definition: Features & Examples (investopedia.com)

Basically they limit the price that your order can be filled, if price goes outside your set limit (StopLimitRange) then the order will not be filled.

In cTrader you set that limit amount in Pips.


@amusleh

amusleh
10 Jun 2022, 10:14

Hi,

No, we don't have any list of all rejection reasons but the most probably cause can be invalid order data like price, stop loss, take profit, or volume.


@amusleh

amusleh
10 Jun 2022, 10:12

Hi,

MarkestSeries is the obsolete version of Bars, and Bars contains the OHLC  price data, it's a collection like data structure that contains all available chart bars data.

We will add description for them eventually, as the Bars overloads are added recently they lack the description.


@amusleh

amusleh
10 Jun 2022, 10:09

Hi,

I just tested on both version 4.1 and 4.2.10 and it works fine:

Does it gets suspended immediately after you attach it or after sometime? which exact version of cTrader 4.2 you are using?


@amusleh

amusleh
10 Jun 2022, 09:46

Hi,

It doesn't work on version 4.1 because your source parameter is private not public, all parameter must be public on a cBot or indicator.

Try this:

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

namespace cAlgo.RobotsKO
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class FractalsSample37 : Robot
    {
        private double _volumeInUnits;
        private Fractals _fractals;

        [Parameter("Source")]
        public DataSeries SourceSeries { get; set; }

        [Parameter("Max Spread", DefaultValue = 2, MinValue = 0, MaxValue = 300)]
        public double MaxSpread { get; set; }

        [Parameter("Volume (Lots)", DefaultValue = 0.01)]
        public double VolumeInLots { get; set; }

        [Parameter("Stop Loss (Pips)", DefaultValue = 20)]
        private double StopLossInPips { get; set; }

        [Parameter("Take Profit (Pips)", DefaultValue = 60)]
        private double TakeProfitInPips { get; set; }

        [Parameter("Label", DefaultValue = "Sample")]
        public string Label { get; set; }

        private RelativeStrengthIndex _rsi;
        private ExponentialMovingAverage _ema17rsi;

        public Position[] BotPositions
        {
            get { return Positions.FindAll(Label); }
        }

        protected override void OnStart()
        {
            _volumeInUnits = Symbol.QuantityToVolumeInUnits(VolumeInLots);
            _fractals = Indicators.Fractals(5);
            _rsi = Indicators.RelativeStrengthIndex(SourceSeries, 14);
            _ema17rsi = Indicators.ExponentialMovingAverage(_rsi.Result, 14);
        }

        protected override void OnBar()
        {
            var cBotPositions = Positions.FindAll(Label);

            if (_fractals.UpFractal.LastValue < Bars.ClosePrices.Last(1))
            {
                ClosePositions(TradeType.Sell);

                if (cBotPositions.Length == 0 && (_ema17rsi.Result.LastValue < (_rsi.Result.LastValue)) && Symbol.Spread < MaxSpread * Symbol.PipSize)
                {
                    ExecuteMarketOrder(TradeType.Buy, SymbolName, _volumeInUnits, Label, StopLossInPips, TakeProfitInPips);
                }
            }
            else if (_fractals.DownFractal.LastValue > Bars.ClosePrices.Last(1))
            {
                ClosePositions(TradeType.Buy);

                if (cBotPositions.Length == 0 && _ema17rsi.Result.LastValue > (_rsi.Result.LastValue) && Symbol.Spread < MaxSpread * Symbol.PipSize)
                {
                    ExecuteMarketOrder(TradeType.Sell, SymbolName, _volumeInUnits, Label, StopLossInPips, TakeProfitInPips);
                }
            }
        }

        private void ClosePositions(TradeType tradeType)
        {
            foreach (var position in BotPositions)
            {
                ClosePosition(position);
            }
        }
    }
}

 


@amusleh

amusleh
10 Jun 2022, 08:54

Hi,

Please use suggestions section of the forum for posting your suggestions.


@amusleh

amusleh
10 Jun 2022, 08:51

Hi,

cMAM is not a product of Spotware, we don't provide support for it, you can use their Telegram group for getting support: https://t.me/cmam_official


@amusleh

amusleh
09 Jun 2022, 12:15

Hi,

I'm not aware of such an indicator but you can develop it easily if you are a cBot / Indicator developer, otherwise post a job request on jobs page or contact one of our consultants.


@amusleh

amusleh
09 Jun 2022, 09:47

Hi,

Please contact your broker, and if your position had stop loss are you sure spread was not the reason?


@amusleh

amusleh
09 Jun 2022, 09:46

Hi,

Please check my reply on: 

You don't have to open multiple threads for same topic.


@amusleh

amusleh
09 Jun 2022, 09:44

Hi,

You can't do this with Chart objects, but you can use controls:

using cAlgo.API;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot2 : Robot
    {
        protected override void OnStart()
        {
            var textBlock = new TextBlock
            {
                Text = "Text",
                BackgroundColor = Color.Red,
                ForegroundColor = Color.White,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                Padding = 5
            };

            Chart.AddControl(textBlock);
        }

        protected override void OnStop()
        {
        }
    }
}

The problem with controls is that they are static, so you can't get the same behavior like a ChartText object.


@amusleh

amusleh
09 Jun 2022, 09:30 ( Updated at: 09 Jun 2022, 09:40 )

Hi,

Here is an example:

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

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot2 : Robot
    {
        private double _peak;
        private readonly List<double> _drawdown = new List<double>();
        private double _maxDrawdown;

        [Parameter(DefaultValue = "BarBuySell")]
        public string Label { get; set; }

        protected override void OnStart()
        {
            Positions.Closed += Positions_Closed;
        }

        protected override void OnStop()
        {
            Print(_maxDrawdown);
        }

        private void Positions_Closed(PositionClosedEventArgs obj)
        {
            CalculateMaxDrawDown();
        }

        protected override void OnBar()
        {
            var lastBar = Bars.Last(1);
            var position = Positions.Find(Label, SymbolName);

            if (lastBar.Close > lastBar.Open)
            {
                if (position is not null && position.TradeType == TradeType.Sell) _ = ClosePosition(position);

                _ = ExecuteMarketOrder(TradeType.Buy, SymbolName, Symbol.VolumeInUnitsMin, Label);
            }
            else if (lastBar.Close < lastBar.Open)
            {
                if (position is not null && position.TradeType == TradeType.Buy) _ = ClosePosition(position);

                _ = ExecuteMarketOrder(TradeType.Sell, SymbolName, Symbol.VolumeInUnitsMin, Label);
            }
        }

        private void CalculateMaxDrawDown()
        {
            _peak = Math.Max(_peak, Account.Equity);

            _drawdown.Add((_peak - Account.Equity) / _peak * 100);
            _drawdown.Sort();

            _maxDrawdown = _drawdown[_drawdown.Count - 1];
        }

        protected override double GetFitness(GetFitnessArgs args)
        {
            return 100 - _maxDrawdown;
        }
    }
}

The above bot calculates drawdown based on account equity, and uses it for optimization fitness.

You can change the Account.Equity to Account.Balance if you want to use balance drawdown.

You can check on "GetFitness" method if drawdown is above a fixed value then return 0.


@amusleh

amusleh
09 Jun 2022, 09:14

Hi,

In case you open two connections with same credentials one is closed and another will remain open, you should not open two connections.


@amusleh

amusleh
08 Jun 2022, 08:59

RE: RE:

roan.is said:

amusleh said:

Hi,

We were able to reproduce this issue and it will be fixed on future versions, thanks for reporting.

Hi,

Thank you but, your charts need to be 100% accurate all the time. People are risking their money based on information from your charts. 

In the example I gave, which one was the accurate chart? Chrome or Firefox?

Thanks and regards,

Roan

Hi,

We recommend you to use Chrome, even if you are using Firefox you can solve this issue by refreshing the page before new sessions.

This issue will be resolved on next version of cTrader web.


@amusleh

amusleh
08 Jun 2022, 08:49

Hi,

You can use or (||):

            if ((_rsi.Result.Last(1) < 70 && _rsi.Result.Last(2) >= 70) || (_rsi.Result.Last(1) >= 30 && _rsi.Result.Last(2) < 30))
            {
                foreach (var position in Positions.Where(p => p.SymbolName == SymbolName && p.TradeType == TradeType.Buy))
                    position.Close();
            }

I recommend you to read: Boolean logical operators - C# reference | Microsoft Docs


@amusleh

amusleh
08 Jun 2022, 08:47

RE: RE:

Asianmouse said:

amusleh said:

Hi,

No, we don't have any plane for now to release a Mac version as cTrader desktop uses WPF for UI which is dependent on Windows.

You can try to use a Windows VPS or virtual machine.

I see Ctrader created for iPad and iOs, so if you are able to make it on these devices. I would have thought one could be created for Mac Osx.

Is there an indepth video on cTrader for iPad?  I would like to see how it works on iPad.  I do not want to buy a new windows laptop just for trading since I am not a fan of Windows and I don't use it at all.  

Hi,

You can read cTrader iOS guide: cTrader Mobile (iOS) | cTrader Help Center


@amusleh

amusleh
08 Jun 2022, 08:47 ( Updated at: 19 Mar 2025, 08:57 )

RE: RE:

krismarxh said:

amusleh said:

Hi,

It should show both client ID and secret when you click on the credentials "view" button.

I just checked your application and it does show both, can you tell me on which web browser you tried?

Thanks for the reply.

The web browser used is Microsoft Edge.

Hi,

I also use Edge and it works fine for me, can you take a screenshot of view dialog and send it to me via Telegram or email?

Our email is: support@ctrader.com


@amusleh

amusleh
07 Jun 2022, 11:58

Hi,

We are aware of this issue, it will be fixed on future versions.


@amusleh

amusleh
07 Jun 2022, 09:28

Hi,

What do you mean by "How to fix Boolean"?


@amusleh