Topics

Forum Topics not found

Replies

amusleh
16 Jun 2022, 08:58

Hi,

We were able to reproduce the issue, we will fix this on next release.

Thanks for reporting.


@amusleh

amusleh
15 Jun 2022, 08:59

Hi,

We were able to reproduce this issue, it will be fixed on next version.

Thanks for reporting.


@amusleh

amusleh
15 Jun 2022, 08:49

Hi,

We tried to reproduce this issue but we couldn't, can you record a video and send it to us when it happened again?

 


@amusleh

amusleh
15 Jun 2022, 08:13

Hi,

You can get the distance between two moving averages like this:

            var distanceInPips = Math.Abs(_firstMa.Result[index] - _secondMa.Result[index]) / Symbol.PipSize;
            
            if (distanceInPips > 4)
            {
                // Do something
            }

Regarding your second point, you have to define what's an higher high and what's a lower low, then you will be able to code it.


@amusleh

amusleh
15 Jun 2022, 08:09

H,

You can use standard deviation indicator and a multiplier number like Bollinger Bands, example:

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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.EasternStandardTime, AccessRights = AccessRights.None)]
    public class MADeviationBot : Robot
    {
        [Parameter("Instance Name", DefaultValue = "")]
        public string InstanceName { get; set; }

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

        [Parameter("MA Type")]
        public MovingAverageType Type { get; set; }

        [Parameter("MA Period")]
        public int MAPeriod { get; set; }

        [Parameter("Stop Loss")]
        public int StopLoss { get; set; }

        [Parameter("Risk %", MinValue = 0.01, Step = 0.01)]
        public double RiskPerTrade { get; set; }

        [Parameter("Std Multiplier", DefaultValue = 1)]
        public double StdMultiplier { get; set; }

        private MovingAverage _ma;

        private StandardDeviation _standardDeviation;

        protected override void OnStart()
        {
            _ma = Indicators.MovingAverage(SourceSeries, MAPeriod, Type);
            _standardDeviation = Indicators.StandardDeviation(SourceSeries, MAPeriod, Type);
        }

        protected override void OnBar()
        {
            int index = Bars.Count - 1;
            Entry(index);
            Exits(index);
        }

        private void Entry(int index)
        {
            if (_ma.Result[index] - Bars.ClosePrices[index] > _standardDeviation.Result[index] * StdMultiplier)
            {
                ExecuteMarketOrder(TradeType.Buy, SymbolName, GetVolume(StopLoss), InstanceName, StopLoss, null);
            }
            else if (Bars.ClosePrices[index] - _ma.Result[index] > _standardDeviation.Result[index] * StdMultiplier)
            {
                ExecuteMarketOrder(TradeType.Sell, SymbolName, GetVolume(StopLoss), InstanceName, StopLoss, null);
            }
        }

        private void Exits(int index)
        {
            var positions = Positions.FindAll(InstanceName, SymbolName);

            foreach (var position in positions)
            {
                if ((position.TradeType == TradeType.Buy && Bars.ClosePrices[index] > _ma.Result[index]) || (position.TradeType == TradeType.Sell && Bars.ClosePrices[index] < _ma.Result[index]))
                {
                    ClosePosition(position);
                }
            }
        }

        private double GetVolume(double? stopLossPips = null)
        {
            double costPerPip = (double)((int)(Symbol.PipValue * 10000000)) / 100;

            // Change this to Account.Equity if you want to
            double baseNumber = Account.Balance;

            double sizeInLots = Math.Round((baseNumber * RiskPerTrade / 100) / (stopLossPips.Value * costPerPip), 1);

            var result = Symbol.QuantityToVolumeInUnits(sizeInLots);

            return result;
        }
    }
}

 


@amusleh

amusleh
15 Jun 2022, 07:58

Hi,

You can change the indicator windows height but not the width, it get's full width based on your chart width.

You can try to detach chart and the resize it.

 


@amusleh

amusleh
14 Jun 2022, 09:42

Hi,

Right now it's not possible, you can open a thread under suggestions section for this option to be added on Quick Trade settings.


@amusleh

amusleh
14 Jun 2022, 09:40

Hi,

This: 

double candle1SizePips = Math.Round(candle1Size / Symbol.PipSize, 3);

Will round the result of "candle1Size / Symbol.PipSize" to three decimal places.

Symbol.PipSize gives you a symbol 1 pip value in absolute price, for example the EURUSD pip size is 0.0001.

Dividing the candle1Size to Symbol.PipSize will give you the exact number of Pips, for example if candle1Size is 0.0008 and the symbol pip size is 0.0001 then:

0.0008 / 0.0001 = 8


@amusleh

amusleh
14 Jun 2022, 09:35

Hi,

Stop Limit order limits the price range that your order can be filled, this is very simple.

When you tested it, was there any instance of getting filled in a worst price than your set limit range?

What kind of difference you are expecting? stop limit order is similar to stop order except it limits the price for filling of your order based on your provided limit range.


@amusleh

amusleh
14 Jun 2022, 09:20 ( Updated at: 14 Jun 2022, 11:22 )

Hi,

The Position.EntryPrice always gives you the latest entry price of a position that you see on Positions tab of your cTrader.

 


@amusleh

amusleh
14 Jun 2022, 09:18

Hi,

Most probably your stop loss or take profit price levels that you pass to modify method is not correct, use Print to check the value that you pass to the method, see if those price levels are correct stop loss and take profit levels for your position or not.


@amusleh

amusleh
14 Jun 2022, 09:10 ( Updated at: 19 Mar 2025, 08:57 )

Hi,

You can delete your account by contacting your broker, if the account belongs to Spotware cTrader beta then send us an email and we will delete it.

Our email: support@ctrader.com


@amusleh

amusleh
14 Jun 2022, 09:08

Hi,

I tested it on both cTrader 4.1 and 4.2, it works fine.

The add buttons work fine, and when I changed the chart objects everything worked, no error.

What you did that you got that error? did you developed this indicator? if it's not your indicator then contact the developer and report the issue to him.


@amusleh

amusleh
14 Jun 2022, 09:00

Hi,

They will copy you for free, you can't charge any commission when your account is not a live account.


@amusleh

amusleh
14 Jun 2022, 08:55

Hi,

I can't reproduce this issue, can you post again the exact code you are using?

On which symbol and time frame you tested it?


@amusleh

amusleh
14 Jun 2022, 08:53

Hi,

Can you tell us when then error message appears? and which version of Windows you are using? Is your Windows x64 or x86?


@amusleh

amusleh
14 Jun 2022, 08:52

Hi,

Most probably what you are asking for will require more than few lines of code, and the indicator code you pasted lost it's code syntax format.

Please use editor code snippet to post code.

For these kind of tasks you can post a job request or ask one of our consultants.

 


@amusleh

amusleh
14 Jun 2022, 08:47

Hi,

Detaching and reattaching charts will change the order of charts on cTrader chart container, when you reattach a chart it's appended to the end of container charts.

It was always like this, and this behavior is not changed on 4.2 either.

You can open a thread under suggestion section for this feature to be added.


@amusleh