Replies

fx.pro
28 Sep 2023, 15:51

RE: Problem with remote desktop

PanagiotisChar said: 

Hi there,

How can somebody reproduce your problem?

Problem solved,

cTrader only works properly with Teamviewer.

Best Regards,

P.

 


@fx.pro

fx.pro
28 Sep 2023, 11:52 ( Updated at: 21 Dec 2023, 09:23 )

RE: Problem with remote desktop

PanagiotisChar said: 

Hi there,

How can somebody reproduce your problem?

Simple Trading Panel :

before

after


@fx.pro

fx.pro
28 Sep 2023, 06:45

RE: Problem with remote desktop

PanagiotisChar said: 

Hi there,

How can somebody reproduce your problem?

Hi,

it's quite easy.

a) run any optimalization via remote desktop, change cpu core usage to 100% and/or sort results by any cryteria,

logout from rdp session and login, you should see problem

b) or run cbot in real mode, draw buttons in “onstart”, logout and login,

In my case this object (border→stackpanel→button) was reduced to “0” dimension (i see small dot with colour of my border).

This problem starts about year ago after some update of cTrader. Before works without problems.

I checked 3 pc with 3 different os (W10,W11, Windows Server 2016).

Best Regards,


@fx.pro

fx.pro
27 Sep 2023, 13:26

Using stoploss is the best way to wipe Your account.


@fx.pro

fx.pro
22 Jul 2023, 21:21

RE: RE: RE:

Mark_Passio said: 

fx.pro said: 

 

Did You solve this problem ? I have identical.

Best Regards,

P.

 

No. The problem is still there. The data is loading each time for the same time period while backtesting.

If I want to backtest for more than 3 years, it won't even load the data. And I should be able to backtest on tick data since 2016.

I have enough ram and enough virtual ram on my computer.

I resolve my problem:

a) uninstall cTrader

b) and most important : remove cTrader folder in Documents (not cAlgo, only cTrader)

c) install cTrader

 


@fx.pro

fx.pro
20 Jul 2023, 13:45

RE:

Mark_Passio said:

Hi,

 

Yesterday I ran the backtesting (tick data) from 2016 to July 2023. Although I ran it many times before, the data was loading again for a long time. I thought this is just because of the new update to cTrader 4.8.15 and I'll just have to load the data once for the same period. But today I restarted my computer and wanted to run the backtesting for the same time period and the data is loading again.

Will the data be newly loaded each time now with this cTrader update, although I already ran the same backtesting for the same time period?

 

Please advise

 

EDIT: I noticed something else.

I just restarted my computer again. When I went to backtesting and only pressed the play button the data didn't load. It started backtesting. But when I only add one more day to the time period it loads the whole data again for the whole time period. It should only load the data for the newly added day to the time period. So this should be quite fast to load the data.

Example. I want to backtest the bot from 12.1.2023 to 1.7.2023. If I already backtested the time period before the data won't load newly. It will start backtesting right away. But if I only add one more day, so from 11.1.2023 to 1.7.2023 it will load the data for the entire period and will take a long time.

Am I doing something wrong? 

Did You solve this problem ? I have identical.

Best Regards,

P.


@fx.pro

fx.pro
16 Jul 2023, 12:55

RE: RE: RE:

This is for optimization of custom Timeframe , not a main  (on which Your cbot is running).

P.


@fx.pro

fx.pro
16 Jul 2023, 12:24

RE:

Kaspricci said:

Hi,

not sure what you want to achieve with this, but in my case there is a timeframe parameter available out of the box for optimization. No need to add one. 

If you just need an additional time frame parameter for a second timeframe in your bot, you can simply use the type TimeFrame for your parameter (see example below). Unfortunately I cannot set a default using DefaultValue = TimeFrame.Minute15. This does not compile. And secondly when you use my example the TimeFrame parameter is not available for optimization. Only the one provided by cTrader Desktop works for me. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class Test : Robot
    {
        [Parameter("My Time Frame")]
        public TimeFrame InpTimeFrame { get; set; }

        protected override void OnStart()
        {
        }

        protected override void OnTick()
        {
        }

        protected override void OnStop()
        {
        }
    }
}

 

Do You see difference ?


@fx.pro

fx.pro
27 Oct 2022, 19:32

RE:

firemyst said:

Google is your friend:

 

Thanks for answer,

I wrote this post about 9 h earlier than this thread was explain this error.

I managed this error the same way as in this thread.

P.


@fx.pro

fx.pro
24 Oct 2022, 10:26

RE:

PanagiotisChar said:

Hi there,

From my experience, there is an obvious mismatch between your setups that you are missing. Happened to me many times :) Usually is in front of your eyes. Blaming the CPUs is a bit far fetched at the moment. Make sure you are running the same versions of cTrader. Then you could try a clean installation of cTrader on both machines to make sure nothing is cached.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

I found reason. On e2-900 I tested on real account from FXpro, 

I make some tested on 5900x machine with real not demo accounts, and I get almost identical results like on e2-900.

Fx Pro real : 1730%

IC Markets : 1780%

Thanks for help.PN

 


@fx.pro

fx.pro
16 Dec 2020, 00:18 ( Updated at: 21 Dec 2023, 09:22 )

RE:

PanagiotisCharalampous said:

Hi fx.pro,

Your problem is here

You need to check if the IndicatorArea is not null before you draw objects on it.

Best Regards,

Panagiotis 

Join us on Telegram

Hi,

now all works OK. Thank You for helping.

Best Regards,

Pem


@fx.pro

fx.pro
11 Dec 2020, 16:02

RE:

PanagiotisCharalampous said:

Hi fx.pro,

Please post the complete cBot code and parameters so that we can check.

Best Regards,

Panagiotis 

Join us on Telegram

I removed others indicators and I left only Adx for clear view a problem, indicator and cbot, please:

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

namespace cAlgo
{

    [Indicator(IsOverlay = false, AccessRights = AccessRights.None, ScalePrecision = 0)]
    public class ADXbyPem : Indicator
    {
        [Parameter("ADX Period", Group = "ADX", DefaultValue = 7, MinValue = 6, Step = 1, MaxValue = 21)]
        public int Adx_per { get; set; }
        [Parameter("ADX MA Period", Group = "ADX", DefaultValue = 14, MinValue = 6, Step = 1, MaxValue = 36)]
        public int Adx_ma_per { get; set; }
        [Parameter("Treshold skew", Group = "ADX", DefaultValue = 30, MinValue = -30, MaxValue = 70, Step = 10)]
        public int Adx_skew { get; set; }
        [Parameter("ADX Looback", Group = "ADX", DefaultValue = 130, MinValue = 10, Step = 10, MaxValue = 360)]
        public int Adx_lback { get; set; }

        public MovingAverage ma_adx;
        public DirectionalMovementSystem adx;
        public IndicatorDataSeries adx_h;
        public bool BUYcond;
        public bool SELLcond;

        [Output("ADX", LineColor = "gold", PlotType = PlotType.Histogram)]
        public IndicatorDataSeries Adx_ma_n { get; set; }

        protected override void Initialize()
        {
            adx_h = CreateDataSeries();
            adx = Indicators.DirectionalMovementSystem(Adx_per);
            ma_adx = Indicators.MovingAverage(adx_h, Adx_ma_per, MovingAverageType.Exponential);

        }

        public override void Calculate(int index)
        {

            IndicatorArea.DrawHorizontalLine("Zero line", 0, Color.White, 1, LineStyle.Solid);
            IndicatorArea.DrawHorizontalLine("BUY Level ", -30 - Adx_skew, Color.Green, 1, LineStyle.Solid);
            IndicatorArea.DrawHorizontalLine("SELL Level", 30 + Adx_skew, Color.Red, 1, LineStyle.Solid);

            if (index >= Adx_ma_per && index >= Adx_per)
            {
                adx_h[index] = adx.DIPlus[index] - adx.DIMinus[index];

                var MaAdxHL = ma_adx.Result.Maximum(Adx_lback);
                var MaAdxLL = ma_adx.Result.Minimum(Adx_lback);
                Adx_ma_n[index] = ((ma_adx.Result.LastValue - MaAdxLL) / (MaAdxHL - MaAdxLL) * 100 - 50) * 2;



            }
            BUYcond = Adx_ma_n.LastValue < (-30 - Adx_skew);
            SELLcond = Adx_ma_n.LastValue > (30 + Adx_skew);


        }
    }
}
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.API.Requests;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class FXExplorerV2 : Robot
    {
        private const string MyLabel = "FX ExplorerV2";


        [Parameter("Start trading (hour) 1", DefaultValue = 7)]
        public int StartHour { get; set; }
        [Parameter("Stop trading (hour) 1", DefaultValue = 23)]
        public int StopHour { get; set; }
        [Parameter("Trading hours", DefaultValue = true)]
        public bool condition_tradeHours { get; set; }

        [Parameter("Include Trailing Stop", DefaultValue = true)]
        public bool hasTrailingStop { get; set; }
        [Parameter("Trailing Stop Trigger (pips)", DefaultValue = 0)]
        public int TrailingStopTrigger { get; set; }
        [Parameter("Trailing Stop Step (pips)", DefaultValue = 5)]
        public int TrailingStopStep { get; set; }

        [Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
        public double Volume { get; set; }


        [Parameter("Period", Group = "STOCH", DefaultValue = 15)]
        public int Period_stoch { get; set; }
        [Parameter("%K", Group = "STOCH", DefaultValue = 3)]
        public int kPeriods_D { get; set; }
        [Parameter("%D", Group = "STOCH", DefaultValue = 3)]
        public int kSlowing_K { get; set; }
        [Parameter("Skew OPEN", Group = "STOCH", DefaultValue = 0, MinValue = -15, MaxValue = 15, Step = 1)]
        public int stoch_open_skew { get; set; }
        [Parameter("Skew CLOSE", Group = "STOCH", DefaultValue = 0, MinValue = -15, MaxValue = 15, Step = 1)]
        public int stoch_close_skew { get; set; }


        [Parameter("ADX Period", Group = "ADX", DefaultValue = 7, MinValue = 6, Step = 1, MaxValue = 21)]
        public int Adx_per { get; set; }
        [Parameter("ADX MA Period", Group = "ADX", DefaultValue = 14, MinValue = 6, Step = 1, MaxValue = 36)]
        public int Adx_ma_per { get; set; }
        [Parameter("Treshold skew", Group = "ADX", DefaultValue = 0, MinValue = -30, MaxValue = 70, Step = 10)]
        public int Adx_skew { get; set; }
        [Parameter("ADX Looback", Group = "ADX", DefaultValue = 130, MinValue = 10, Step = 10, MaxValue = 360)]
        public int Adx_lb { get; set; }

        [Parameter("MA Type", Group = "MACD", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MAType { get; set; }
        [Parameter("Long Cycle", Group = "MACD", DefaultValue = 26)]
        public int Mcd_long { get; set; }
        [Parameter("Short Cycle", Group = "MACD", DefaultValue = 12)]
        public int Mcd_short { get; set; }
        [Parameter("Signal Periods", Group = "MACD", DefaultValue = 9)]
        public int Mcd_per { get; set; }


        //private StochbyPem stoch;
        private ADXbyPem adx;
        //private StochRSIbyPem srsi;

        protected override void OnStart()
        {

            //srsi = Indicators.GetIndicator<StochRSIbyPem>(20, 20, 20, 20, 20);
            adx = Indicators.GetIndicator<ADXbyPem>(Adx_per, Adx_ma_per, Adx_skew, Adx_lb);
            //stoch = Indicators.GetIndicator<StochbyPem>(Period_stoch, kPeriods_D, kSlowing_K, stoch_open_skew, stoch_close_skew);
            //mcd = Indicators.MacdCrossOver(mcd_long, mcd_short, mcd_per);

        }
        protected override void OnBar()
        {
            bool cond_tradeHours = (Server.Time.Hour > StartHour) && (Server.Time.Hour < StopHour);

            Print(adx.BUYcond);
            Print(adx.adx_h.Last(2));
            Print(adx.Adx_ma_n.LastValue);
/*
            if (stoch.BUYsig && cond_tradeHours)
            {
                Close(TradeType.Sell);
                Open(TradeType.Buy);
            }
            // && adx_cond() > adx_trsh)
            else if (stoch.SELLsig && cond_tradeHours)
            {
                Close(TradeType.Buy);
                Open(TradeType.Sell);
            }
    */
        }

        private void Close(TradeType tradeType)
        {
            foreach (var position in Positions.FindAll("FX Explorer", SymbolName, tradeType))
                ClosePosition(position);
        }

        private void Open(TradeType tradeType)
        {
            var position = Positions.Find("FX Explorer", SymbolName, tradeType);
            var volumeInUnits = Symbol.QuantityToVolumeInUnits(Volume);

            if (position == null)
                ExecuteMarketOrder(tradeType, SymbolName, volumeInUnits, "FX Explorer");
        }

      
    }

  
}

 


@fx.pro

fx.pro
10 Dec 2020, 21:26 ( Updated at: 21 Dec 2023, 09:22 )

Passing values to cbot

PanagiotisCharalampous said:

Hi fx.pro,

The problem is here

adx_hist[index] = adx.DIMinus[index] - adx.DIPlus[index];

You are not initializing adx_hist anywhere.

Best Regards,

Panagiotis 

Join us on Telegram

I posted working version , but I have problem in importing values of this indicator to my cbot. This is part of my cbot :



        private StochbyPem stoch;
        private ADXbyPem adx;
        

        protected override void OnStart()
        {

            
            adx = Indicators.GetIndicator<ADXbyPem>(Adx_per, Adx_ma_per, Adx_skew, Adx_lb);
            stoch = Indicators.GetIndicator<StochbyPem>(Period_stoch, kPeriods_D, kSlowing_K, stoch_open_skew, stoch_close_skew);

          

        }
        protected override void OnBar()
        {
            

            Print(adx.BUYcond);
            Print(adx.adx_h);
            Print(adx.Adx_ma_n.LastValue);

 

As You see first print causes always false (but indicator show properly values),

second naN

third : rest of errors.

 

Indicator is registered properly and i checked almost all posibilties for accesing to values of this indicator (Last, Lastvalue etc).

The same proplem is with my second custom indiator (stoch).

Can You give a little hint.

Thanks,

Pem

 


@fx.pro

fx.pro
10 Dec 2020, 21:14

Hi,

Thanks for reply. I posted working final version.

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

namespace cAlgo
{

    [Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
    public class ADXbyPem : Indicator
    {
        [Parameter("ADX Period", Group = "ADX", DefaultValue = 7, MinValue = 6, Step = 1, MaxValue = 21)]
        public int Adx_per { get; set; }
        [Parameter("ADX MA Period", Group = "ADX", DefaultValue = 14, MinValue = 6, Step = 1, MaxValue = 36)]
        public int Adx_ma_per { get; set; }
        [Parameter("Treshold skew", Group = "ADX", DefaultValue = 30, MinValue = -30, MaxValue = 70, Step = 10)]
        public int Adx_skew { get; set; }
        [Parameter("ADX Looback", Group = "ADX", DefaultValue = 130, MinValue = 10, Step = 10, MaxValue = 360)]
        public int Adx_lback { get; set; }

        public MovingAverage ma_adx;
        public DirectionalMovementSystem adx;
        public IndicatorDataSeries adx_h;
        public bool BUYcond;
        public bool SELLcond;

        [Output("ADX", LineColor = "gold", PlotType = PlotType.Histogram)]
        public IndicatorDataSeries Adx_ma_n { get; set; }

        protected override void Initialize()
        {
            adx_h = CreateDataSeries();
            adx = Indicators.DirectionalMovementSystem(Adx_per);
            ma_adx = Indicators.MovingAverage(adx_h, Adx_ma_per, MovingAverageType.Exponential);

        }

        public override void Calculate(int index)
        {

            IndicatorArea.DrawHorizontalLine("Zero line", 0, Color.White, 1, LineStyle.Solid);
            IndicatorArea.DrawHorizontalLine("Treshold Level Buy", -30 - Adx_skew, Color.Green, 1, LineStyle.Solid);
            IndicatorArea.DrawHorizontalLine("Treshold Level Sell", 30 + Adx_skew, Color.Red, 1, LineStyle.Solid);

            if (index >= Adx_ma_per && index >= Adx_per)
            {
                adx_h[index] = adx.DIPlus[index] - adx.DIMinus[index];

                var MaAdxHL = ma_adx.Result.Maximum(Adx_lback);
                var MaAdxLL = ma_adx.Result.Minimum(Adx_lback);
                Adx_ma_n[index] = ((ma_adx.Result[index] - MaAdxLL) / (MaAdxHL - MaAdxLL) * 100 - 50) * 2;



            }
            BUYcond = Adx_ma_n.LastValue < (-30 - Adx_skew);
            SELLcond = Adx_ma_n.LastValue > (30 + Adx_skew);


        }
    }
}

 


@fx.pro