Topics
13 Sep 2024, 11:59
 201
 1
25 Sep 2023, 10:29
 441
 1
13 Aug 2023, 00:45
 451
 0
14 Mar 2023, 13:21
 850
 3
Replies

ys2310
02 Oct 2024, 05:33

RE: OnBar() not fired at specified interval

PanagiotisCharalampous said: 

Hi there,

Bars are not time based but tick based. Therefore the OnBar() method will be triggered when the new tick for that time range arrives. So if the tick comes 10 seconds after the previous bar was supposed to be closed, the OnBar method will be triggered with 10 seconds delay. If no tick arrives within that timeframe, then no bar will be formed.

Best regards,

Panagiotis 

Hello Panagiotis,

Thank you for your reply. I'm clear now.

What if I want to every 5 minutes event?


@ys2310

ys2310
13 Sep 2024, 07:10

RE: Importing 1min Bars in Csv causes "Symbol not found or has no quotes" error

PanagiotisCharalampous said: 

hi there,

Can you try using the cross broker cTrader application and let me know if you can still reproduce this problem?

Best regards,

Panagiotis

I tried with Spotware cTrader cross broker cTrader and it generates a similar error message.

Error | Failed to get symbol 'USDJPY' quotes: Symbol USDJPY has no quotes at 2003/07/01 4:00:00.

I think this is because my Csv data is going all the way back to year of 2003 while the broker's USDJPY's first data is some where 2011.

How we can deal situation like this? 


@ys2310

ys2310
13 Sep 2024, 06:42

RE: Importing 1min Bars in Csv causes "Symbol not found or has no quotes" error

Hi Panagiotis

I'm using IC Markets and yes they offer this symbol. 

I guess the problem is that we can't use MarketData.GetBars() to refer other symbol's data if we import a Csv file?


@ys2310

ys2310
13 Sep 2024, 06:42

RE: Importing 1min Bars in Csv causes "Symbol not found or has no quotes" error

Hi Panagiotis

I'm using IC Markets and yes they offer this symbol. 

I guess the problem is that we can't use MarketData.GetBars() to refer other symbol's data if we import a Csv file?


@ys2310

ys2310
18 Jun 2024, 09:44 ( Updated at: 18 Jun 2024, 14:05 )

RE: RE: RE: RE: RE: RE: Crash in visual mode during backtest and StopLoss not set duing backtest

PanagiotisCharalampous said: 

ys2310 said: 

Hi Panagiotis,

I'm using ICMarkets. How can I check and prevent this using code?

PanagiotisCharalampous said: 

ys2310 said: 

ys2310 said: 

PanagiotisCharalampous said: 

Hi there,

We have received the exception and the issue will be solved in an upcoming release.

Regarding the SL issue, we would need the cBot code and backtesting parameters in order to reproduce this and explain what happens.

Best regards,

Panagiotis

Hi Panagiotis,

Here is the test code that produce the SL issue, I'm using Nikkei225, Hm1 for testing

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.FullAccess, TimeZone = TimeZones.EasternStandardTime)]
    public class Test2 : Robot
    {        
        [Parameter(DefaultValue = 10, MinValue = 0, MaxValue = 500, Step = 10)]
        public int lossCut { get; set; }
        
        [Parameter(DefaultValue = 10, MinValue = 0, MaxValue = 500, Step = 10)]
        public int takeProfit { get; set; }
        
        double volume = 0.0;
        
        protected override void OnStart()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate
        }

        protected override void OnBarClosed()
        {
            volume = 10;
            
            var last_buy_position = Positions.Where(x => x.Label == "Test" && x.SymbolName == Symbol.Name && x.TradeType == TradeType.Buy).OrderByDescending(x => x.EntryTime).FirstOrDefault();
            
            // Handle price updates here
            if(MarketData.GetBars(TimeFrame, "US500").ClosePrices.Last(0) > MarketData.GetBars(TimeFrame, "US500").OpenPrices.Last(0))
               if (last_buy_position == null || Symbol.Ask < last_buy_position.EntryPrice - 100 * Symbol.TickSize)
                   ExecuteMarketOrder(TradeType.Buy, Symbol.Name, volume, "Test", lossCut, takeProfit, (Server.Time - Bars.Last(0).OpenTime).Milliseconds.ToString());            
        }
        protected override void OnTick() {
            foreach(var position in Positions.FindAll("Test", Symbol.Name))
                if(position.StopLoss == null)
                    ModifyPositionAsync(position, Symbol.Ask - 20 * Symbol.PipSize, position.TakeProfit);
                
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
    }
}

Can you also tell me the broker? This usually happens when your SL falls within the symbol's spread. Please check if this is the case

 

Hi there,

You can use Positions.Opened event and check if the stop loss was set. If the stop loss is null you can act accordingly i.e. place it at a valid distance.

Best regards,

Panagiotis

I want not to submit an order if the StopLoss price is invalid. 

so, I wrote a if check statement like below but my order is still without SL (empty SL). Why?

double stopLossPrice = Symbol.Bid - StopLossPips * Symbol.PipSize;
double takeProfitPrice = Symbol.Bid + TakeProfitPips * Symbol.PipSize;

if (stopLossPrice < Symbol.Ask - Symbol.Spread) // Check if stop loss is valid
     ExecuteMarketOrder(TradeType.Buy, Symbol.Name, volume, "Test", StopLossPips, TakeProfitPips, stopLossPrice.ToString()); 


@ys2310

ys2310
18 Jun 2024, 05:48 ( Updated at: 18 Jun 2024, 09:04 )

RE: RE: RE: RE: Crash in visual mode during backtest and StopLoss not set duing backtest

Hi Panagiotis,

I'm using ICMarkets. How can I check and prevent this using code?

PanagiotisCharalampous said: 

ys2310 said: 

ys2310 said: 

PanagiotisCharalampous said: 

Hi there,

We have received the exception and the issue will be solved in an upcoming release.

Regarding the SL issue, we would need the cBot code and backtesting parameters in order to reproduce this and explain what happens.

Best regards,

Panagiotis

Hi Panagiotis,

Here is the test code that produce the SL issue, I'm using Nikkei225, Hm1 for testing

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.FullAccess, TimeZone = TimeZones.EasternStandardTime)]
    public class Test2 : Robot
    {        
        [Parameter(DefaultValue = 10, MinValue = 0, MaxValue = 500, Step = 10)]
        public int lossCut { get; set; }
        
        [Parameter(DefaultValue = 10, MinValue = 0, MaxValue = 500, Step = 10)]
        public int takeProfit { get; set; }
        
        double volume = 0.0;
        
        protected override void OnStart()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate
        }

        protected override void OnBarClosed()
        {
            volume = 10;
            
            var last_buy_position = Positions.Where(x => x.Label == "Test" && x.SymbolName == Symbol.Name && x.TradeType == TradeType.Buy).OrderByDescending(x => x.EntryTime).FirstOrDefault();
            
            // Handle price updates here
            if(MarketData.GetBars(TimeFrame, "US500").ClosePrices.Last(0) > MarketData.GetBars(TimeFrame, "US500").OpenPrices.Last(0))
               if (last_buy_position == null || Symbol.Ask < last_buy_position.EntryPrice - 100 * Symbol.TickSize)
                   ExecuteMarketOrder(TradeType.Buy, Symbol.Name, volume, "Test", lossCut, takeProfit, (Server.Time - Bars.Last(0).OpenTime).Milliseconds.ToString());            
        }
        protected override void OnTick() {
            foreach(var position in Positions.FindAll("Test", Symbol.Name))
                if(position.StopLoss == null)
                    ModifyPositionAsync(position, Symbol.Ask - 20 * Symbol.PipSize, position.TakeProfit);
                
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
    }
}

Can you also tell me the broker? This usually happens when your SL falls within the symbol's spread. Please check if this is the case

 


@ys2310

ys2310
18 Jun 2024, 02:49 ( Updated at: 18 Jun 2024, 05:18 )

RE: RE: Crash in visual mode during backtest and StopLoss not set duing backtest

ys2310 said: 

PanagiotisCharalampous said: 

Hi there,

We have received the exception and the issue will be solved in an upcoming release.

Regarding the SL issue, we would need the cBot code and backtesting parameters in order to reproduce this and explain what happens.

Best regards,

Panagiotis

Hi Panagiotis,

Here is the test code that produce the SL issue, I'm using Nikkei225, Hm1 for testing

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.FullAccess, TimeZone = TimeZones.EasternStandardTime)]
    public class Test2 : Robot
    {        
        [Parameter(DefaultValue = 10, MinValue = 0, MaxValue = 500, Step = 10)]
        public int lossCut { get; set; }
        
        [Parameter(DefaultValue = 10, MinValue = 0, MaxValue = 500, Step = 10)]
        public int takeProfit { get; set; }
        
        double volume = 0.0;
        
        protected override void OnStart()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate
        }

        protected override void OnBarClosed()
        {
            volume = 10;
            
            var last_buy_position = Positions.Where(x => x.Label == "Test" && x.SymbolName == Symbol.Name && x.TradeType == TradeType.Buy).OrderByDescending(x => x.EntryTime).FirstOrDefault();
            
            // Handle price updates here
            if(MarketData.GetBars(TimeFrame, "US500").ClosePrices.Last(0) > MarketData.GetBars(TimeFrame, "US500").OpenPrices.Last(0))
               if (last_buy_position == null || Symbol.Ask < last_buy_position.EntryPrice - 100 * Symbol.TickSize)
                   ExecuteMarketOrder(TradeType.Buy, Symbol.Name, volume, "Test", lossCut, takeProfit, (Server.Time - Bars.Last(0).OpenTime).Milliseconds.ToString());            
        }
        protected override void OnTick() {
            foreach(var position in Positions.FindAll("Test", Symbol.Name))
                if(position.StopLoss == null)
                    ModifyPositionAsync(position, Symbol.Ask - 20 * Symbol.PipSize, position.TakeProfit);
                
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
    }
}


@ys2310

ys2310
16 Jun 2024, 04:43

RE: Crash in visual mode during backtest and StopLoss not set duing backtest

PanagiotisCharalampous said: 

Hi there,

We have received the exception and the issue will be solved in an upcoming release.

Regarding the SL issue, we would need the cBot code and backtesting parameters in order to reproduce this and explain what happens.

Best regards,

Panagiotis

Hi Panagiotis,

In visual backtesting another instance, I received another crash with error code #6271DD1D. 

Can you also solve this error in upcoming release please?


@ys2310

ys2310
16 Jun 2024, 04:43

RE: Crash in visual mode during backtest and StopLoss not set duing backtest

PanagiotisCharalampous said: 

Hi there,

We have received the exception and the issue will be solved in an upcoming release.

Regarding the SL issue, we would need the cBot code and backtesting parameters in order to reproduce this and explain what happens.

Best regards,

Panagiotis

Hi Panagiotis,

In visual backtesting another instance, I received another crash with error code #6271DD1D. 

Can you also solve this error in upcoming release please?


@ys2310

ys2310
12 Apr 2024, 12:06 ( Updated at: 14 Apr 2024, 08:02 )

RE: RE: RE: RE: RE: RE: RE: RE: RE: Custom indicator with TimeFrame.Hour4 not showing Last(1) value in cBot.

PanagiotisCharalampous said: 

ys2310 said: 

PanagiotisCharalampous said: 

ys2310 said: 

PanagiotisCharalampous said: 

ys2310 said: 

PanagiotisCharalampous said: 

ys2310 said: 

PanagiotisCharalampous said: 

Hi there,

This happens because you only assign values to indicator data series, when the index of each higher timeframe changes. Hence for the rest of the array elements the value stays NaN. The solution to this depends on what you want to achieve. For example, why do you 

@PanagiotisCharalampous

Thank you for your reply. I want to test my GMMA strategy with multi-timeframe.

My cBot staretegy is 1hour resolution and should be able to access to the above custom indicator(multi-timeframe GMMA)'s TimeFrame.Hour4 Last(n) values. 

Can you me an example on how to code this correctly?

Hi there,

I am sorry but I cannot write the code for you. If you have specific questions, I am happy to answer them. At the moment I do not see a reason to leave the data series values to NaN.

Best regards,

Panagiotis

Hello Panagiotis,

What do you mean by “At the moment I do not see a reason to leave the data series values to NaN.” ?

I made some mistakes in my code?

Can you share the cBot code as well so that I can tell you exactly where the problem is?

Hi Panagiotis,

Yes, I can share the cBot code to you.

here it is.

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;using cAlgo.Indicators;namespace cAlgo.Robots{    [Robot(AccessRights = AccessRights.FullAccess, TimeZone = TimeZones.TokyoStandardTime)]    public class GMMASingle : Robot    {                     private GMMA _gmma;                      protected override void OnStart()        {            // To learn more about cTrader Automate visit our Help Center:            // https://help.ctrader.com/ctrader-automate                                    _gmma = Indicators.GetIndicator<GMMA>();                    }        protected override void OnBar()                {                                    Print(_gmma.LongEma1.Last(1)," ",_gmma.LongEma4.Last(1)); // <--- prints NaN NaN                        if (_gmma.LongEma1.IsRising() && _gmma.LongEma4.IsRising()) {                    ExecuteMarketOrder(TradeType.Buy, Symbol.Name, 100, "GMMA", null, null);            }            if (_gmma.LongEma1.IsFalling() && _gmma.LongEma4.IsFalling()) {                    ExecuteMarketOrder(TradeType.Sell, Symbol.Name, 100, "GMMA", null, null);            }        }        protected override void OnStop()        {            // Handle cBot stop here        }                    }}

 

Hi there,

Here is a visualization of your problem using the debugger

Your Indicator data series have NaN values because you do not assign anything to them when the time does not match the higher timeframe time. Hence the problems in your logic. 

I do not understand why you have created a separate indicator for this and have to manage all this complexity. You could just initialize the moving averages inside your cBot and use them.

Best regards,

Panagiotis

Hi Panagiotis,

Thank you for the screenshot. I see the problem now.

I changed my cBot code as following and it seems to print higher time frame values correctly. 

However, how can I display, for example, this _longEma2 onto my bachtest chart?

private MovingAverage _longEma1, _longEma2, _longEma3, _longEma4; protected override void OnStart(){      _longEma1 = Indicators.ExponentialMovingAverage(MarketData.GetSeries(TimeFrame.Hour2).Close, 200);      _longEma2 = Indicators.ExponentialMovingAverage(MarketData.GetSeries(TimeFrame.Hour4).Close, 200);      _longEma3 = Indicators.ExponentialMovingAverage(MarketData.GetSeries(TimeFrame.Hour8).Close, 200);      _longEma4 = Indicators.ExponentialMovingAverage(MarketData.GetSeries(TimeFrame.Hour12).Close, 200);}

It's not possible to add them on the chart from the cBot but you could use your GMMA indicator for this purpose

Hi Panagiotis,

So, in this my case scenario, we need to use my custom GMMA indicator during backtest.

The problem is how to solve the NaN values things. 

I'd like to get TimeFrame.Hour4 moviing average values in my 1 hour backtest resolution.

How can I do this correctly?


@ys2310

ys2310
12 Apr 2024, 06:40 ( Updated at: 12 Apr 2024, 11:48 )

RE: RE: RE: RE: RE: RE: RE: Custom indicator with TimeFrame.Hour4 not showing Last(1) value in cBot.

PanagiotisCharalampous said: 

ys2310 said: 

PanagiotisCharalampous said: 

ys2310 said: 

PanagiotisCharalampous said: 

ys2310 said: 

PanagiotisCharalampous said: 

Hi there,

This happens because you only assign values to indicator data series, when the index of each higher timeframe changes. Hence for the rest of the array elements the value stays NaN. The solution to this depends on what you want to achieve. For example, why do you 

@PanagiotisCharalampous

Thank you for your reply. I want to test my GMMA strategy with multi-timeframe.

My cBot staretegy is 1hour resolution and should be able to access to the above custom indicator(multi-timeframe GMMA)'s TimeFrame.Hour4 Last(n) values. 

Can you me an example on how to code this correctly?

Hi there,

I am sorry but I cannot write the code for you. If you have specific questions, I am happy to answer them. At the moment I do not see a reason to leave the data series values to NaN.

Best regards,

Panagiotis

Hello Panagiotis,

What do you mean by “At the moment I do not see a reason to leave the data series values to NaN.” ?

I made some mistakes in my code?

Can you share the cBot code as well so that I can tell you exactly where the problem is?

Hi Panagiotis,

Yes, I can share the cBot code to you.

here it is.

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;using cAlgo.Indicators;namespace cAlgo.Robots{    [Robot(AccessRights = AccessRights.FullAccess, TimeZone = TimeZones.TokyoStandardTime)]    public class GMMASingle : Robot    {                     private GMMA _gmma;                      protected override void OnStart()        {            // To learn more about cTrader Automate visit our Help Center:            // https://help.ctrader.com/ctrader-automate                                    _gmma = Indicators.GetIndicator<GMMA>();                    }        protected override void OnBar()                {                                    Print(_gmma.LongEma1.Last(1)," ",_gmma.LongEma4.Last(1)); // <--- prints NaN NaN                        if (_gmma.LongEma1.IsRising() && _gmma.LongEma4.IsRising()) {                    ExecuteMarketOrder(TradeType.Buy, Symbol.Name, 100, "GMMA", null, null);            }            if (_gmma.LongEma1.IsFalling() && _gmma.LongEma4.IsFalling()) {                    ExecuteMarketOrder(TradeType.Sell, Symbol.Name, 100, "GMMA", null, null);            }        }        protected override void OnStop()        {            // Handle cBot stop here        }                    }}

 

Hi there,

Here is a visualization of your problem using the debugger

Your Indicator data series have NaN values because you do not assign anything to them when the time does not match the higher timeframe time. Hence the problems in your logic. 

I do not understand why you have created a separate indicator for this and have to manage all this complexity. You could just initialize the moving averages inside your cBot and use them.

Best regards,

Panagiotis

Hi Panagiotis,

Thank you for the screenshot. I see the problem now.

I changed my cBot code as following and it seems to print higher time frame values correctly. 

However, how can I display, for example, this _longEma2 onto my bachtest chart?

private MovingAverage _longEma1, _longEma2, _longEma3, _longEma4;
 
protected override void OnStart()
{

      _longEma1 = Indicators.ExponentialMovingAverage(MarketData.GetSeries(TimeFrame.Hour2).Close, 200);
      _longEma2 = Indicators.ExponentialMovingAverage(MarketData.GetSeries(TimeFrame.Hour4).Close, 200);
      _longEma3 = Indicators.ExponentialMovingAverage(MarketData.GetSeries(TimeFrame.Hour8).Close, 200);
      _longEma4 = Indicators.ExponentialMovingAverage(MarketData.GetSeries(TimeFrame.Hour12).Close, 200);
}

@ys2310

ys2310
11 Apr 2024, 13:21 ( Updated at: 12 Apr 2024, 05:45 )

RE: RE: RE: RE: RE: Custom indicator with TimeFrame.Hour4 not showing Last(1) value in cBot.

PanagiotisCharalampous said: 

ys2310 said: 

PanagiotisCharalampous said: 

ys2310 said: 

PanagiotisCharalampous said: 

Hi there,

This happens because you only assign values to indicator data series, when the index of each higher timeframe changes. Hence for the rest of the array elements the value stays NaN. The solution to this depends on what you want to achieve. For example, why do you 

@PanagiotisCharalampous

Thank you for your reply. I want to test my GMMA strategy with multi-timeframe.

My cBot staretegy is 1hour resolution and should be able to access to the above custom indicator(multi-timeframe GMMA)'s TimeFrame.Hour4 Last(n) values. 

Can you me an example on how to code this correctly?

Hi there,

I am sorry but I cannot write the code for you. If you have specific questions, I am happy to answer them. At the moment I do not see a reason to leave the data series values to NaN.

Best regards,

Panagiotis

Hello Panagiotis,

What do you mean by “At the moment I do not see a reason to leave the data series values to NaN.” ?

I made some mistakes in my code?

Can you share the cBot code as well so that I can tell you exactly where the problem is?

Hi Panagiotis,

Yes, I can share the cBot code to you.

here it is.

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;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.FullAccess, TimeZone = TimeZones.TokyoStandardTime)]
    public class GMMASingle : Robot
    {        
     
        private GMMA _gmma;
      
        
        protected override void OnStart()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate
            
            
            _gmma = Indicators.GetIndicator<GMMA>();
            
        }

        protected override void OnBar()        
        {
            
            
            Print(_gmma.LongEma1.Last(1)," ",_gmma.LongEma4.Last(1)); // <--- prints NaN NaN
            
            if (_gmma.LongEma1.IsRising() && _gmma.LongEma4.IsRising()) {

                    ExecuteMarketOrder(TradeType.Buy, Symbol.Name, 100, "GMMA", null, null);
            }
            if (_gmma.LongEma1.IsFalling() && _gmma.LongEma4.IsFalling()) {

                    ExecuteMarketOrder(TradeType.Sell, Symbol.Name, 100, "GMMA", null, null);
            }
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
        
        
    }
}

 


@ys2310

ys2310
11 Apr 2024, 12:57

RE: RE: RE: Custom indicator with TimeFrame.Hour4 not showing Last(1) value in cBot.

PanagiotisCharalampous said: 

ys2310 said: 

PanagiotisCharalampous said: 

Hi there,

This happens because you only assign values to indicator data series, when the index of each higher timeframe changes. Hence for the rest of the array elements the value stays NaN. The solution to this depends on what you want to achieve. For example, why do you 

@PanagiotisCharalampous

Thank you for your reply. I want to test my GMMA strategy with multi-timeframe.

My cBot staretegy is 1hour resolution and should be able to access to the above custom indicator(multi-timeframe GMMA)'s TimeFrame.Hour4 Last(n) values. 

Can you me an example on how to code this correctly?

Hi there,

I am sorry but I cannot write the code for you. If you have specific questions, I am happy to answer them. At the moment I do not see a reason to leave the data series values to NaN.

Best regards,

Panagiotis

Hello Panagiotis,

What do you mean by “At the moment I do not see a reason to leave the data series values to NaN.” ?

I made some mistakes in my code?


@ys2310

ys2310
11 Apr 2024, 12:44 ( Updated at: 11 Apr 2024, 12:46 )

RE: Custom indicator with TimeFrame.Hour4 not showing Last(1) value in cBot.

PanagiotisCharalampous said: 

Hi there,

This happens because you only assign values to indicator data series, when the index of each higher timeframe changes. Hence for the rest of the array elements the value stays NaN. The solution to this depends on what you want to achieve. For example, why do you 

@PanagiotisCharalampous

Thank you for your reply. I want to test my GMMA strategy with multi-timeframe.

My cBot staretegy is 1hour resolution and should be able to access to the Last(n) values of above custom indicator(multi-timeframe GMMA)'s 

TimeFrame.Hour2 ,TimeFrame.Hour4, TimeFrame.Hour8 ,TimeFrame.Hour16, TimeFrame.Daily, TimeFrame.Weekly.

Can you show me an example on how to code this correctly?


@ys2310

ys2310
11 Apr 2023, 11:43

RE:

How the Bloomberg API and cTrader Automate integration works exactly?

Can I define custom symbols and get Bloomberg data feed comig into cBot?

PanagiotisChar said:

Hi there,

If you have access to Bloomberg's APIs, you could do that yourself using cTrader Automate.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

 


@ys2310

ys2310
11 Apr 2023, 11:40 ( Updated at: 21 Dec 2023, 09:23 )

RE:

It's not working for me somehow. It seems cTrader internally converts something using HKDJPY which doesn't exist.

Btw, my account currency setting is JPY and this is a Fondex Demo account.

Can you try again and reproduce this?

PanagiotisChar said:

Hi,

I tried this and works fine for me. Are you using tick data as a source?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

 


@ys2310

ys2310
10 Apr 2023, 19:29 ( Updated at: 10 Apr 2023, 19:36 )

RE:

PanagiotisChar said:

Hi there,

Can you share the complete cBot code so that we can run it and reproduce this behavior?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Yes, here is the code.

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 NewcBot15 : Robot
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        protected override void OnStart()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate            
            Print(Message);
        }

        protected override void OnTick()
        {
            // Handle price updates here
            Print((MarketData.GetBars(TimeFrame.Minute, "HONG KONG 50").MedianPrices.LastValue));
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
    }
}

 


@ys2310

ys2310
10 Apr 2023, 15:54

RE:

firemyst said:

Have you looked up the actual Indicie symbol name for HONG KONG 50 on your platform?

On most other cTrader platforms, it's known as "HK50"

Yeah, I confirmed it's "HONG KONG 50" on Fondex cTrader. Otherwise, I'll get a Null Reference exception error at runtime.


@ys2310

ys2310
14 Mar 2023, 14:47 ( Updated at: 14 Mar 2023, 14:51 )

RE:

I could include Microsoft.ML.OnnxRuntime by compiling it from source code and made it a .Net6.0 dll.

But I get a run-time error "13/02/2023 09:00:00.000 | CBot instance [test, XAUUSD, h1] crashed with error "Crashed in OnStart with OnnxRuntimeException: [ErrorCode:Fail] Load model from C:/cTrader/svm_test.onnx failed:D:\a\_work\1\s\engine\lotus\onnxruntime\core/graph/model_load_utils.h:57 onnxruntime::model_load_utils::ValidateOpsetForDomain ONNX Runtime only *guarantees* support for models stamped with official released onnx opset versions. Opset 16 is under development and support for this is limited. The operator schemas and or other functionality may change before next ONNX release and in this case ONNX Runtime will not guarantee backward compatibility. Current official support for domain ai.onnx is till opset 15.
"".

How can I fix this error?

 

 


@ys2310

ys2310
03 Mar 2023, 17:12

RE:

I solved the problem by using .Net 4.x legacy.


@ys2310