Replies

sebastien.t
04 Sep 2024, 08:10

RE: RE: RE: RE: RE: RE: Placing Stop Order - FAILED with error "TechnicalError"

I found the stupid issue. I was using the old ticker DE30 (but still available for this broker…) instead of the good new one DE40…

 

Now it s working perfectly!

 

Thank you for your support

 

sebastien.t said: 

i was working on the DE40
 

 

PanagiotisCharalampous said: 

sebastien.t said: 

My broker is ICMarkets and here is the simple code, I just put an order. It could be anything a Market order or a stop order, i have always the Failure message.

 

using cAlgo.API;

using cAlgo.API.Internals;

using cAlgo.Indicators;

using System;


 

namespace cAlgo.Robots

{

[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

public class StopLimitOrdersAt915 : Robot

{

private double _high15;

private double _low15;

 

[Parameter("Volume (in units)", DefaultValue = 10)]

public int VolumeInUnits { get; set; }

 

[Parameter("Offset (points)", DefaultValue = 20)]

public double OffsetInPoints { get; set; }

 

[Parameter("Take Profit (points)", DefaultValue = 50)]

public double TakeProfitInPoints { get; set; }


protected override void OnStart()

{

var closedBar = Bars[1];

_high15 = closedBar.High;

_low15 = closedBar.Low;
 

double sellStopLoss = OffsetInPoints / Symbol.PipSize;
 

double takeProfit = TakeProfitInPoints / Symbol.PipSize;

double StopLoss= (_high15-_low15)/Symbol.PipSize

 

PlaceStopOrder(TradeType.Sell, SymbolName, VolumeInUnits, _low15, "Sell Stop Limit Order", StopLoss, takeProfit);
 

}


}

}

Please let us know the symbol as well. I tried this on EURUSD and works fine

 

 


@sebastien.t

sebastien.t
04 Sep 2024, 05:35

RE: RE: RE: RE: RE: Placing Stop Order - FAILED with error "TechnicalError"

i was working on the DE40
 

 

PanagiotisCharalampous said: 

sebastien.t said: 

My broker is ICMarkets and here is the simple code, I just put an order. It could be anything a Market order or a stop order, i have always the Failure message.

 

using cAlgo.API;

using cAlgo.API.Internals;

using cAlgo.Indicators;

using System;


 

namespace cAlgo.Robots

{

[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

public class StopLimitOrdersAt915 : Robot

{

private double _high15;

private double _low15;

 

[Parameter("Volume (in units)", DefaultValue = 10)]

public int VolumeInUnits { get; set; }

 

[Parameter("Offset (points)", DefaultValue = 20)]

public double OffsetInPoints { get; set; }

 

[Parameter("Take Profit (points)", DefaultValue = 50)]

public double TakeProfitInPoints { get; set; }


protected override void OnStart()

{

var closedBar = Bars[1];

_high15 = closedBar.High;

_low15 = closedBar.Low;
 

double sellStopLoss = OffsetInPoints / Symbol.PipSize;
 

double takeProfit = TakeProfitInPoints / Symbol.PipSize;

double StopLoss= (_high15-_low15)/Symbol.PipSize

 

PlaceStopOrder(TradeType.Sell, SymbolName, VolumeInUnits, _low15, "Sell Stop Limit Order", StopLoss, takeProfit);
 

}


}

}

Please let us know the symbol as well. I tried this on EURUSD and works fine

 


@sebastien.t

sebastien.t
03 Sep 2024, 13:31

RE: RE: RE: Placing Stop Order - FAILED with error "TechnicalError"

My broker is ICMarkets and here is the simple code, I just put an order. It could be anything a Market order or a stop order, i have always the Failure message.

 

using cAlgo.API;

using cAlgo.API.Internals;

using cAlgo.Indicators;

using System;


 

namespace cAlgo.Robots

{

[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

public class StopLimitOrdersAt915 : Robot

{

private double _high15;

private double _low15;

 

[Parameter("Volume (in units)", DefaultValue = 10)]

public int VolumeInUnits { get; set; }

 

[Parameter("Offset (points)", DefaultValue = 20)]

public double OffsetInPoints { get; set; }

 

[Parameter("Take Profit (points)", DefaultValue = 50)]

public double TakeProfitInPoints { get; set; }


protected override void OnStart()

{

var closedBar = Bars[1];

_high15 = closedBar.High;

_low15 = closedBar.Low;
 

double sellStopLoss = OffsetInPoints / Symbol.PipSize;
 

double takeProfit = TakeProfitInPoints / Symbol.PipSize;

double StopLoss= (_high15-_low15)/Symbol.PipSize

 

PlaceStopOrder(TradeType.Sell, SymbolName, VolumeInUnits, _low15, "Sell Stop Limit Order", StopLoss, takeProfit);
 

}


}

}


@sebastien.t

sebastien.t
03 Sep 2024, 06:52 ( Updated at: 03 Sep 2024, 07:39 )

RE: Placing Stop Order - FAILED with error "TechnicalError"

Hello,

 

thank you for your answer.

 

I modified the code to respect the Ticksize. I still get an error

Trade | → Placing Stop Order to Sell 10 DE30 (Price: 18772.6, SL: 5700, TP: 5000) FAILED with error "TechnicalError"

 

I also tried to use the Pipsize :

But I have the same issue Trade | → Placing Stop Order to Sell 10 DE30 (Price: 18772.6, SL: 570, TP: 500) FAILED with error "TechnicalError"

 

Thank you for your help.

 

PanagiotisCharalampous said: 

Hi there,

You are setting the SL and TP is absolute price. You need to set them in pips.

Best regards,

Panagiotis

 


@sebastien.t

sebastien.t
20 May 2024, 15:05

RE: RE: Cbot on Cloud

sebastien.t said: 

Is it on Windows?

 

because I have the Mac app and I can't see any of those options.

 

Thank you

Good day,

 

could you revert please?


@sebastien.t

sebastien.t
20 May 2024, 08:43

RE: Cbot on Cloud

Is it on Windows?

 

because I have the Mac app and I can't see any of those options.

 

Thank you


@sebastien.t

sebastien.t
30 Apr 2024, 08:32

RE: RE: RE: RE: RE: RE: RE: RE: RE: Issue / explanation AmountRisked

Hello,

 

I think there is also a huge issue on the lot calculation on the FOREX. I tried the function on GBPUSD

For an account of $1.000.000 and 10 pips Stop Loss, the function Symbol.VolumeForProportionalRisk proposed me to buy 2.500.00 lots which is by far too much…

But when I trued to reverse it with the function Symbol.AmountRisked, it says that I risk $2.500 which is the right number because my risk is 0.25% of the balance.

But obviously, it is not the risk that I have for 2.500.000 lots with a 10pips Stop Loss.  

I can't even put a trade with that figures…

 

Is it also a but? When do you expect to fix it?

 

Thank you

 

protected override void OnStart()

{

Print("Symbol "+ Symbol.Name);

Print("Pip size "+Symbol.PipSize);

Print("Account Balance " + Account.Balance);


 

Print("Volume to risk for SL 10pips " + Symbol.VolumeForProportionalRisk( ProportionalAmountType.Balance, RiskPerTrade, 10));

Print("Amount risked for Volume 2 500 000 with SL 10pips " + Symbol.AmountRisked(Symbol.VolumeForProportionalRisk( ProportionalAmountType.Balance, RiskPerTrade, 10), 10));

}

 


@sebastien.t

sebastien.t
29 Apr 2024, 15:08 ( Updated at: 30 Apr 2024, 05:23 )

RE: RE: RE: RE: RE: RE: RE: Issue / explanation AmountRisked

Hi PanagiotisCharalampous

Do you have any idea where the issue is?

It is very weird…

Thank you


@sebastien.t

sebastien.t
29 Apr 2024, 08:39

RE: RE: RE: RE: RE: RE: Issue / explanation AmountRisked

Your issue is definitely coming from the Spotware Demo Account.

Here is my result for the S&P with an other broker

But i would need your Demo account because you have by far deeper historical for my backtesting…


@sebastien.t

sebastien.t
29 Apr 2024, 08:15

RE: RE: RE: RE: RE: Issue / explanation AmountRisked

On Mac, I use the Demo account for my bot testing 

 

 

On Windows :

The same Demo account 


@sebastien.t

sebastien.t
29 Apr 2024, 06:25

RE: RE: RE: Issue / explanation AmountRisked

Good day,

 

I have both Mac and Windows

Here is the results this morning from my Mac 

 

And from my Windows server

 

The only difference I can see with your screenshot is the PipSize…

 


@sebastien.t

sebastien.t
28 Apr 2024, 19:59

RE: Issue / explanation AmountRisked

True in your case it is perfectly fine. 

But look at my results for the same code on a Demo account

I have no idea why I get the weird results…

 

 

PanagiotisCharalampous said: 

Hi there,

I don't see any problem.

Can you please explain what the problem is?

Best regards,

Panagiotis

 


@sebastien.t

sebastien.t
28 Apr 2024, 10:48

Good day,

I have a problem the  function AmountRisked. I would like to risk 0.5% of my Balance for each trade.

So I tried to use that function. So basically for the same % of risk, I expect the Volume calulated to be doubled when my Stop Loss is divided by 2.

 

Here is my code

protected override void OnStart()

{

Print("Pip size "+Symbol.PipSize);

Print("Account Balance " + Account.Balance);

var Volume_10pips_SL = Symbol.VolumeForProportionalRisk( ProportionalAmountType.Balance, RiskPerTrade, 10);

var Volume_20pips_SL = Symbol.VolumeForProportionalRisk( ProportionalAmountType.Balance, RiskPerTrade, 20);

Print("Volume for 0.5% Risk of the Balance with 10 pips Stop Loss "+ Volume_10pips_SL);

Print("Volume for 0.5% Risk of the Balance with 20 pips Stop Loss "+ Volume_20pips_SL);

Print("AmountRisked for 0.5% Risk of the Balance with 10 pips Stop Loss " + Symbol.AmountRisked(Volume_10pips_SL, 10));

Print("AmountRisked for 0.5% Risk of the Balance with 20 pips Stop Loss " + Symbol.AmountRisked(Volume_20pips_SL, 20));

}

 

 

And the result for US500

 

Could you help what is going wrong in my usage of the function Symbol.VolumeForProportionalRisk?

 

Thank you


@sebastien.t

sebastien.t
24 Apr 2024, 08:28 ( Updated at: 25 Apr 2024, 05:47 )

RE: RE: RE: RE: RE: RE: Backtesting on Multi Timeframe

Thank you @Panagiotis for your help. now my backtesting is working!

 

PanagiotisCharalampous said: 

sebastien.t said: 

Hi Panagiotis,

I tried to use your workaround but it doesn't really work for 2 reasons :

1/ if I want to backtest the bot that I use on Live market I can't change a lot of code and so I have to keep using the same functions. It seems that even if the history date are loaded (I can see see it if I check the date with Bars[0]), I can't recall that data with the MarketData.GetBars

2/ To run the Backtest I have to choose 1 timeframe (let s say H1) but in my bot I need check the historical data of the H4 and the Daily. And so even if I start the backtest to beofre my “real” backtesting date to load the data, it loads only the data for H1 and not for H4/Daily.

Here is my 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 EasyHistoLoad : Robot

{

 

[Parameter("Backtest On/Off", Group = "BackTest", DefaultValue = false)]

public bool BackTest { get; set; }


 

[Parameter("Backtest Date", Group = "BackTest", DefaultValue = "2024/03/01 01:00:00")]

public string BackTestDate { get; set; }


 

protected override void OnStart()

{

// To learn more about cTrader Automate visit our Help Center:

// https://help.ctrader.com/ctrader-automate


 

// Print(Bars.Count());

DateTime time_to_test = Bars[Bars.Count()-5].OpenTime.AddDays(-15);

// Print(time_to_test);

// Get m1 Bars

 

if(BackTest && Bars.Last().OpenTime>DateTime.Parse(BackTestDate)){


 

Bars _OfTimeFrameBars = MarketData.GetBars(TimeFrame.Minute, SymbolName);

var LastOpenTimeLoaded = _OfTimeFrameBars.OpenTimes[0];

 

Print("Bars[0].OpenTime " + Bars[0].OpenTime+ " _OfTimeFrameBars.OpenTimes[0] "+ _OfTimeFrameBars.OpenTimes[0] + " time_to_test "+ time_to_test);

if (_OfTimeFrameBars.OpenTimes[0] > time_to_test){

Print("_OfTimeFrameBars is not using Bars history already loaded");


 

}


 

}

}


 

protected override void OnBarClosed()

{

DateTime time_to_test = Bars[Bars.Count()-5].OpenTime.AddDays(-15);

 

if(BackTest && Bars.Last().OpenTime>DateTime.Parse(BackTestDate)){


 

Bars _OfTimeFrameBars = MarketData.GetBars(TimeFrame.Minute, SymbolName);

var LastOpenTimeLoaded = _OfTimeFrameBars.OpenTimes[0];

 

 

Print("Bars[0].OpenTime " + Bars[0].OpenTime+ " _OfTimeFrameBars.OpenTimes[0] "+ _OfTimeFrameBars.OpenTimes[0] + " time_to_test "+ time_to_test);

if (_OfTimeFrameBars.OpenTimes[0] > time_to_test){

 

Print("_OfTimeFrameBars is not using Bars history already loaded");

 

}


 

 

}

}


 

protected override void OnStop()

{

// Handle cBot stop here

}

}

}

 

 

 

 

 

 

 

sebastien.t said: 

Thank s for your answer, that seems a very nice option!

 

PanagiotisCharalampous said: 

sebastien.t said: 

Good day,

thank you for your answer. 

Do you have a workaround? 

The idea of my code/bot is to check some data in the past for the H4 to know if I am bullish or bearish and the to deep dive in the 1 minute chart. 

Basically I have to go 60 bars on the timeframe and then go to the m1. Let s say I want to backtest from the 1st february, I check the H4 10 days before (60*4/24), that should be around mid of January and then I check some data on that date on the m1.

So most of the time I need to LoadMoreHistory on the m1.

Thank you

Seb

PanagiotisCharalampous said: 

Hi there,

Your problem is here

           while (_OfTimeFrameBars.OpenTimes[0] > time_to_test){               var numberOfLoadedBars = _OfTimeFrameBars.LoadMoreHistory();

LoadMoreHistory does not work in backtesting therefore your code enters an infinite loop.

Best regards,

Panagiotis

 

Hi Seb,

The workaround I use is to start the backtesting at earlier dates so that all the necessary information is loaded, while skipping all trading operations until a custom defined date. So I have a set of parameters like this

which replace the backtesting start date and I move my backtesting start date as far in the past as I want.

Best regards,

Panagiotis

 

 

Hi Seb,

  1. I did not understand what the problem is here, sorry
  2. You should retrieve the data on start, before the if condition. That's the whole point of the workaround
        protected override void OnStart()        {            // To learn more about cTrader Automate visit our Help Center:            // https://help.ctrader.com/ctrader-automate            // Print(Bars.Count());            DateTime time_to_test = Bars[Bars.Count() - 5].OpenTime.AddDays(-15);                        Bars _OfTimeFrameBars = MarketData.GetBars(TimeFrame.Minute, SymbolName);            Print("Bars[0].OpenTime " + Bars[0].OpenTime + " _OfTimeFrameBars.OpenTimes[0] " + _OfTimeFrameBars.OpenTimes[0] + " time_to_test " + time_to_test);            // Print(time_to_test);            // Get m1 Bars            if (BackTest && Bars.Last().OpenTime > DateTime.Parse(BackTestDate))            {                                var LastOpenTimeLoaded = _OfTimeFrameBars.OpenTimes[0];                if (_OfTimeFrameBars.OpenTimes[0] > time_to_test)                {                    Print("_OfTimeFrameBars is not using Bars history already loaded");                }            }        }

 


@sebastien.t

sebastien.t
22 Apr 2024, 19:44 ( Updated at: 23 Apr 2024, 05:47 )

RE: RE: RE: RE: Backtesting on Multi Timeframe

Hi Panagiotis,

I tried to use your workaround but it doesn't really work for 2 reasons :

1/ if I want to backtest the bot that I use on Live market I can't change a lot of code and so I have to keep using the same functions. It seems that even if the history date are loaded (I can see see it if I check the date with Bars[0]), I can't recall that data with the MarketData.GetBars

2/ To run the Backtest I have to choose 1 timeframe (let s say H1) but in my bot I need check the historical data of the H4 and the Daily. And so even if I start the backtest to beofre my “real” backtesting date to load the data, it loads only the data for H1 and not for H4/Daily.

Here is my 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 EasyHistoLoad : Robot

{

 

[Parameter("Backtest On/Off", Group = "BackTest", DefaultValue = false)]

public bool BackTest { get; set; }


 

[Parameter("Backtest Date", Group = "BackTest", DefaultValue = "2024/03/01 01:00:00")]

public string BackTestDate { get; set; }


 

protected override void OnStart()

{

// To learn more about cTrader Automate visit our Help Center:

// https://help.ctrader.com/ctrader-automate


 

// Print(Bars.Count());

DateTime time_to_test = Bars[Bars.Count()-5].OpenTime.AddDays(-15);

// Print(time_to_test);

// Get m1 Bars

 

if(BackTest && Bars.Last().OpenTime>DateTime.Parse(BackTestDate)){


 

Bars _OfTimeFrameBars = MarketData.GetBars(TimeFrame.Minute, SymbolName);

var LastOpenTimeLoaded = _OfTimeFrameBars.OpenTimes[0];

 

Print("Bars[0].OpenTime " + Bars[0].OpenTime+ " _OfTimeFrameBars.OpenTimes[0] "+ _OfTimeFrameBars.OpenTimes[0] + " time_to_test "+ time_to_test);

if (_OfTimeFrameBars.OpenTimes[0] > time_to_test){

Print("_OfTimeFrameBars is not using Bars history already loaded");


 

}


 

}

}


 

protected override void OnBarClosed()

{

DateTime time_to_test = Bars[Bars.Count()-5].OpenTime.AddDays(-15);

 

if(BackTest && Bars.Last().OpenTime>DateTime.Parse(BackTestDate)){


 

Bars _OfTimeFrameBars = MarketData.GetBars(TimeFrame.Minute, SymbolName);

var LastOpenTimeLoaded = _OfTimeFrameBars.OpenTimes[0];

 

 

Print("Bars[0].OpenTime " + Bars[0].OpenTime+ " _OfTimeFrameBars.OpenTimes[0] "+ _OfTimeFrameBars.OpenTimes[0] + " time_to_test "+ time_to_test);

if (_OfTimeFrameBars.OpenTimes[0] > time_to_test){

 

Print("_OfTimeFrameBars is not using Bars history already loaded");

 

}


 

 

}

}


 

protected override void OnStop()

{

// Handle cBot stop here

}

}

}

 

 

 

 

 

 

 

sebastien.t said: 

Thank s for your answer, that seems a very nice option!

 

PanagiotisCharalampous said: 

sebastien.t said: 

Good day,

thank you for your answer. 

Do you have a workaround? 

The idea of my code/bot is to check some data in the past for the H4 to know if I am bullish or bearish and the to deep dive in the 1 minute chart. 

Basically I have to go 60 bars on the timeframe and then go to the m1. Let s say I want to backtest from the 1st february, I check the H4 10 days before (60*4/24), that should be around mid of January and then I check some data on that date on the m1.

So most of the time I need to LoadMoreHistory on the m1.

Thank you

Seb

PanagiotisCharalampous said: 

Hi there,

Your problem is here

           while (_OfTimeFrameBars.OpenTimes[0] > time_to_test){               var numberOfLoadedBars = _OfTimeFrameBars.LoadMoreHistory();

LoadMoreHistory does not work in backtesting therefore your code enters an infinite loop.

Best regards,

Panagiotis

 

Hi Seb,

The workaround I use is to start the backtesting at earlier dates so that all the necessary information is loaded, while skipping all trading operations until a custom defined date. So I have a set of parameters like this

which replace the backtesting start date and I move my backtesting start date as far in the past as I want.

Best regards,

Panagiotis

 

 


@sebastien.t

sebastien.t
22 Apr 2024, 09:11

RE: RE: RE: Backtesting on Multi Timeframe

Thank s for your answer, that seems a very nice option!

 

PanagiotisCharalampous said: 

sebastien.t said: 

Good day,

thank you for your answer. 

Do you have a workaround? 

The idea of my code/bot is to check some data in the past for the H4 to know if I am bullish or bearish and the to deep dive in the 1 minute chart. 

Basically I have to go 60 bars on the timeframe and then go to the m1. Let s say I want to backtest from the 1st february, I check the H4 10 days before (60*4/24), that should be around mid of January and then I check some data on that date on the m1.

So most of the time I need to LoadMoreHistory on the m1.

Thank you

Seb

PanagiotisCharalampous said: 

Hi there,

Your problem is here

           while (_OfTimeFrameBars.OpenTimes[0] > time_to_test){               var numberOfLoadedBars = _OfTimeFrameBars.LoadMoreHistory();

LoadMoreHistory does not work in backtesting therefore your code enters an infinite loop.

Best regards,

Panagiotis

 

Hi Seb,

The workaround I use is to start the backtesting at earlier dates so that all the necessary information is loaded, while skipping all trading operations until a custom defined date. So I have a set of parameters like this

which replace the backtesting start date and I move my backtesting start date as far in the past as I want.

Best regards,

Panagiotis

 


@sebastien.t

sebastien.t
22 Apr 2024, 07:44

RE: Backtesting on Multi Timeframe

Good day,

thank you for your answer. 

Do you have a workaround? 

The idea of my code/bot is to check some data in the past for the H4 to know if I am bullish or bearish and the to deep dive in the 1 minute chart. 

Basically I have to go 60 bars on the timeframe and then go to the m1. Let s say I want to backtest from the 1st february, I check the H4 10 days before (60*4/24), that should be around mid of January and then I check some data on that date on the m1.

So most of the time I need to LoadMoreHistory on the m1.

Thank you

Seb

PanagiotisCharalampous said: 

Hi there,

Your problem is here

           while (_OfTimeFrameBars.OpenTimes[0] > time_to_test){               var numberOfLoadedBars = _OfTimeFrameBars.LoadMoreHistory();

LoadMoreHistory does not work in backtesting therefore your code enters an infinite loop.

Best regards,

Panagiotis

 


@sebastien.t

sebastien.t
20 Apr 2024, 10:02

RE: Backtesting on Multi Timeframe

PanagiotisCharalampous said: 

Hi there,

Feel free to share the cBot code with us so that we can investigate further.

Best regards,

Panagiotis

Good day, thank you for your answer. 

I can't share my full bot with you, I spent so many weeks/months to build my model…

But I can share a very simple piece of code that even doesn't work on Backtesting b ut works perfectly fine on a classic run.

I tried to run it on NSDQ and EURUSD on backtesting mode. the process starts but runs forever without any log

Thank you

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 EasyHistoLoad : Robot
   {
       

       protected override void OnStart()
       {
 

           DateTime time_to_test = Bars[Bars.Count()-5].OpenTime.AddDays(-15);
           Print(time_to_test);
 

           // Get m1 Bars
           Bars _OfTimeFrameBars = MarketData.GetBars(TimeFrame.Minute, SymbolName);
           var LastOpenTimeLoaded = _OfTimeFrameBars.OpenTimes[0];
           Print("_OfTimeFrameBars.OpenTimes[0] "+ _OfTimeFrameBars.OpenTimes[0] + " time_to_test "+ time_to_test);
           while (_OfTimeFrameBars.OpenTimes[0] > time_to_test){
               var numberOfLoadedBars = _OfTimeFrameBars.LoadMoreHistory();

               Print("_OfTimeFrameBars.OpenTimes[0] "+ _OfTimeFrameBars.OpenTimes[0] + " time_to_test "+ time_to_test);
               if (LastOpenTimeLoaded==_OfTimeFrameBars.OpenTimes[0]){
                   Print( SymbolName + " Error could not load deeper historical data, last data is "+_OfTimeFrameBars.OpenTimes[0]);
                   
               }
               LastOpenTimeLoaded=_OfTimeFrameBars.OpenTimes[0];
           }

           Print("Finish to load, first bar is "+_OfTimeFrameBars.OpenTimes[0]);
       }

       protected override void OnTick()
       {
           // Handle price updates here
       }

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


@sebastien.t

sebastien.t
14 Mar 2024, 07:48

RE: Clear the LocalStorage

PanagiotisCharalampous said: 

Hi there,

There is no API method available at the moment. You can only clear it manually by deleting everything in this folder. Make sure cTrader is closed before you do this

Documents\cAlgo\LocalStorage

Best regards,

Panagiotis

Thank you for your answer. Is there any way to store the info properly in a DB?

 

Thank you


@sebastien.t

sebastien.t
13 Mar 2024, 20:50 ( Updated at: 14 Mar 2024, 05:57 )

RE: RE: LocalStorageScope on Mac

sebastien.t said: 

PanagiotisCharalampous said: 

Hi there,

Can you share the complete cBot code you are using and screenshots of your log after executing the cBot?

Best regards,

Panagiotis

 

My code of the Cbot is definitly too long to share (and also don't want to share all my trading rules….). 

But here is my test at the very beginning of the code:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Security.Cryptography.X509Certificates;

using System.Text;

using cAlgo.API;

using cAlgo.API.Collections;

using cAlgo.API.Indicators;

using cAlgo.API.Internals;

using Microsoft.VisualBasic;



 

namespace cAlgo.Robots

{

[Robot(AccessRights = AccessRights.FullAccess)]


 

public class NewcBot : Robot

{


 

[Parameter(DefaultValue = 120)]

public int OfDepthCalculation { get; set; }

private TextBlock _DOFTextBlock, _H4OFTextBlock, _H1OFTextBlock, _TradeAllowTextBlock, _TradeAVailableTextBlock;

private Telegram telegram = new Telegram();

private Grid grid;

protected override void OnStart()

{

string messageLocalStorage = LocalStorage.GetString("Example-Message");

if (messageLocalStorage is not null)

{

MessageBox.Show(messageLocalStorage);

} else{

LocalStorage.SetString("Example-Message", "This is just an example message");

}

Screenshot of the log :

 

 

Thank you for your help

That s all good. I fixed my issue. It was some special character inside the key.


@sebastien.t