Topics
07 Feb 2024, 02:24
 338
 4
Replies

ctid4921325
05 Nov 2024, 16:04

RE: me too

shishio6249 said: 

I started facing the exact problem today with price alerts after updating to the latest version. It was working fine before the update. 

Thanks for letting me know. do you know if there's a correct way to report this bug?


@ctid4921325

ctid4921325
05 Nov 2024, 16:04

RE: me too

shishio6249 said: 

I started facing the exact problem today with price alerts after updating to the latest version. It was working fine before the update. 

Thanks for letting me know. do you know if there's a correct way to report this bug?


@ctid4921325

ctid4921325
05 Nov 2024, 15:59

RE: Unable to set price alerts

RazorTrading said: 

It happened to me too, I had to restart cTrader and then it worked. This new version seems quite unstable and I constantly need to restart it.

yeah, sometimes restarting solves it, and sometimes not. Thanks for the responses, glad to know im not going mad


@ctid4921325

ctid4921325
16 Apr 2024, 00:09

RE: RE: RE: RE: RE: RE: RE: RE: Converting to deposit currency

PanagiotisCharalampous said: 

ctid4921325 said: 

PanagiotisCharalampous said: 

ctid4921325 said: 

PanagiotisCharalampous said: 

ctid4921325 said: 

In the meantime, does any one know the easiest way to get the exchange rate between quote currency and deposit currency so I can do my own calc and not get blocked by asset converter?

 

 

Hi there,

The issue was reproduced and will be fixed in an upcoming update.

Best regards,

Panagiotis

spectacular, thanks so much!  Is there away i can work around this in the mean time?

Unfortunately there is no easy workaround

fair enough, do you have an idea how far out the update is?

Unfortunately I do not have an ETA for the update

Hi Panagiotis,  just checking back in and see if there's any sign of this update been released soon, or if you know when? 

 

thanks, Glenn


@ctid4921325

ctid4921325
22 Mar 2024, 09:20

RE: RE: RE: RE: "Memory management" in cbots

ctid4921325 said: 

firemyst said: 

ctid4921325 said: 

firemyst said: 

Most of the newbies I've helped, their memory issues stem from having a lot of Print statements in their code. Printing lots of information to the logs will suck up memory since there's no automated way to clear it.

The other big problem is if your indicators/bots draw A LOT of chart objects. cTrader cannot easily handle hundreds and hundreds of custom chart objects being drawn on charts. For instance, if you draw your own custom TrendLine objects, once you hit about 1,000 objects, performance will degrade noticeably. So you have to have your own built in methods to clean up objects, or limit the number you draw on any chart continuously. Example: if you use TrendLines to draw your own Heikin Ashi candles on a chart overlaying normal candles on say an M1 chart, you'll easily end up with over 500 HA bars on top of the regular M! bars. So what you need to do is limit it so your indicator/bot only draws the most recent 500 HA bars, removing the previous ones on each new bar drawn. 

And for such drawings, you only want it to happen “OnBar” and not “OnTick” where possible – redrawing everything on every tick is very resource intensive, especially if you have multiple indicators/bots doing it at the same time.

Ahah.. fantastic thanks firemyst.. yes, I am outputing hundreds of lines of print.  I have the print wrapped in a method called Debug, which skips or pints based parameters, but it is on. I will turn those off and see what happens.

I do a little bit of drawing, but i'm not approaching 100 objects let alone 1000, and I've moved almost everything to OnBar out of ontick.

Thanks for the tip, I'll turnon/reduce my prints and we'll see what that does.

 

Thanks again.

Keep us posted please.

In my bots/indicators, I have a “debug” flag as a parameter that I can set when I run them. Of course, if true it will print out lots of info to the log; when false it doesn't print anything from the code. I've found this to be a great approach.

yeah thats exactly what i've done, I also allow it to override inside a function so that only debug from selected functions prints out, though that was for clutter in the log, not for performance reasons.   Testing now… will let you know what i learn.

Right on the money Firemyst… things are running much smoother, and there's been no noticable growth in memory foot print.  Thanks so much.


@ctid4921325

ctid4921325
22 Mar 2024, 08:03

RE: RE: RE: "Memory management" in cbots

firemyst said: 

ctid4921325 said: 

firemyst said: 

Most of the newbies I've helped, their memory issues stem from having a lot of Print statements in their code. Printing lots of information to the logs will suck up memory since there's no automated way to clear it.

The other big problem is if your indicators/bots draw A LOT of chart objects. cTrader cannot easily handle hundreds and hundreds of custom chart objects being drawn on charts. For instance, if you draw your own custom TrendLine objects, once you hit about 1,000 objects, performance will degrade noticeably. So you have to have your own built in methods to clean up objects, or limit the number you draw on any chart continuously. Example: if you use TrendLines to draw your own Heikin Ashi candles on a chart overlaying normal candles on say an M1 chart, you'll easily end up with over 500 HA bars on top of the regular M! bars. So what you need to do is limit it so your indicator/bot only draws the most recent 500 HA bars, removing the previous ones on each new bar drawn. 

And for such drawings, you only want it to happen “OnBar” and not “OnTick” where possible – redrawing everything on every tick is very resource intensive, especially if you have multiple indicators/bots doing it at the same time.

Ahah.. fantastic thanks firemyst.. yes, I am outputing hundreds of lines of print.  I have the print wrapped in a method called Debug, which skips or pints based parameters, but it is on. I will turn those off and see what happens.

I do a little bit of drawing, but i'm not approaching 100 objects let alone 1000, and I've moved almost everything to OnBar out of ontick.

Thanks for the tip, I'll turnon/reduce my prints and we'll see what that does.

 

Thanks again.

Keep us posted please.

In my bots/indicators, I have a “debug” flag as a parameter that I can set when I run them. Of course, if true it will print out lots of info to the log; when false it doesn't print anything from the code. I've found this to be a great approach.

yeah thats exactly what i've done, I also allow it to override inside a function so that only debug from selected functions prints out, though that was for clutter in the log, not for performance reasons.   Testing now… will let you know what i learn.


@ctid4921325

ctid4921325
22 Mar 2024, 07:58

RE: "Memory management" in cbots

firemyst said: 

Most of the newbies I've helped, their memory issues stem from having a lot of Print statements in their code. Printing lots of information to the logs will suck up memory since there's no automated way to clear it.

The other big problem is if your indicators/bots draw A LOT of chart objects. cTrader cannot easily handle hundreds and hundreds of custom chart objects being drawn on charts. For instance, if you draw your own custom TrendLine objects, once you hit about 1,000 objects, performance will degrade noticeably. So you have to have your own built in methods to clean up objects, or limit the number you draw on any chart continuously. Example: if you use TrendLines to draw your own Heikin Ashi candles on a chart overlaying normal candles on say an M1 chart, you'll easily end up with over 500 HA bars on top of the regular M! bars. So what you need to do is limit it so your indicator/bot only draws the most recent 500 HA bars, removing the previous ones on each new bar drawn. 

And for such drawings, you only want it to happen “OnBar” and not “OnTick” where possible – redrawing everything on every tick is very resource intensive, especially if you have multiple indicators/bots doing it at the same time.

Ahah.. fantastic thanks firemyst.. yes, I am outputing hundreds of lines of print.  I have the print wrapped in a method called Debug, which skips or pints based parameters, but it is on. I will turn those off and see what happens.

I do a little bit of drawing, but i'm not approaching 100 objects let alone 1000, and I've moved almost everything to OnBar out of ontick.

Thanks for the tip, I'll turnon/reduce my prints and we'll see what that does.

 

Thanks again.


@ctid4921325

ctid4921325
12 Mar 2024, 03:04

RE: RE: RE: RE: RE: RE: Converting to deposit currency

PanagiotisCharalampous said: 

ctid4921325 said: 

PanagiotisCharalampous said: 

ctid4921325 said: 

In the meantime, does any one know the easiest way to get the exchange rate between quote currency and deposit currency so I can do my own calc and not get blocked by asset converter?

 

 

Hi there,

The issue was reproduced and will be fixed in an upcoming update.

Best regards,

Panagiotis

spectacular, thanks so much!  Is there away i can work around this in the mean time?

Unfortunately there is no easy workaround

fair enough, do you have an idea how far out the update is?


@ctid4921325

ctid4921325
11 Mar 2024, 03:28

RE: RE: RE: RE: Converting to deposit currency

PanagiotisCharalampous said: 

ctid4921325 said: 

In the meantime, does any one know the easiest way to get the exchange rate between quote currency and deposit currency so I can do my own calc and not get blocked by asset converter?

 

 

Hi there,

The issue was reproduced and will be fixed in an upcoming update.

Best regards,

Panagiotis

spectacular, thanks so much!  Is there away i can work around this in the mean time?


@ctid4921325

ctid4921325
08 Mar 2024, 04:10

RE: RE: Converting to deposit currency

In the meantime, does any one know the easiest way to get the exchange rate between quote currency and deposit currency so I can do my own calc and not get blocked by asset converter?

 

 


@ctid4921325

ctid4921325
06 Mar 2024, 06:24

RE: Converting to deposit currency

PanagiotisCharalampous said: 

Hi there,

Can you let us know the broker and share the code that reproduces the problem?

Best regards,

Panagiotis

HI Panagiotis, Thanks for responding.  The broker is blackbull nz,  after more playing today, it seems that the pairs are their prime JPY pairs, i.e. *JPY.P (USDJPY.P, GBPJPY.P etc). 

The code  method involved is:



        public double AmountAsDepositCurrency(double amount)
        {   bool debug=false;
           Debug($"Converting deposit currency",debug);
           var qAsset=Symbol.QuoteAsset.ToString();
           var qa=Assets.GetAsset(qAsset);
           Debug($"quote asset: {qAsset}",debug);
           var baseAsset=Account.Asset.Name;
           var ba=Assets.GetAsset(baseAsset);
           
           Debug($"base asset: {baseAsset}",debug);
           return AssetConverter.Convert(amount, qa, ba);
        }

The debugging I have around this shows that, when I'm having trouble I don't return from this method.

I don't know if its helpful or not. Most days, I can get around it, but starting up with their regular non-prime USDJPY, then stopping the bot, switching asset,  and trying again and repeating till it works (and to be honest I have no idea if that ritual solves the problem or its just random).  Other days like today, I just have to not trade JPY.P pairs.


@ctid4921325

ctid4921325
23 Feb 2024, 11:27 ( Updated at: 24 Feb 2024, 07:36 )

RE: Asynchronously move SL and TP or close trades

PanagiotisCharalampous said: 

Hi there

ModifyPositionAsync should do the job

Best regards,

Panagiotis

Thank you Panagiotis,  That seems to do the trick.


@ctid4921325

ctid4921325
13 Feb 2024, 08:06

RE: Using 2 instances of cTrader

PanagiotisCharalampous said: 

Hi there,

The question is very broad and it all depends on what do you want to do. If you make it more specific, we can provide more specific suggestions.

Best regards,

Panagiotis

Hi Panagiotis, all I’m wanting to do is trade to different accounts at the same time In 2 instances of ctrader on the one machine.  Im just wondering If im running the bot in each Instance if theres anything I need to do to ensure they’re isolated from each other or anything else to be mindful of


@ctid4921325

ctid4921325
07 Feb 2024, 11:50

RE: Symbol locks up bot

PanagiotisCharalampous said: 

Hi there,

What do you mean when you say “locks up”? How can we reproduce this behavior?

Best regards,

Panagiotis 

Hi again, this is working fine now. I don't know what caused it or why it went away (or if it will come back).  If you have theories, i'd be delighted to hear, but otherwise don't want to waste more of your time on it. 

Thanks again.


@ctid4921325

ctid4921325
07 Feb 2024, 09:30

RE: Symbol locks up bot

PanagiotisCharalampous said: 

Hi there,

What do you mean when you say “locks up”? How can we reproduce this behavior?

Best regards,

Panagiotis 

Hi Panagiotis

By ‘lockedup' I mean the bot (which is a UI for managing trades) becomes unresponsive.

I have debugs that show that it gets locked just stops when trying to access Symbol.PipSize.. for eg in the method below,  the last line that ‘logged’ was “Print($"{Symbol.PipSize}”)" Then everything stopped.
 

        private double TotalExposure()
        {.

            double result = 0;

            Print("Calculating total exposure");
            foreach (var position in Positions)
            {
                double stopLoss;
                Print($"position {position.Id}");
                if (position.StopLoss == null)
                {
                    stopLoss = 0;
                } else
                {
                  stopLoss = position.StopLoss.Value;
                 
                }
                double entry = position.EntryPrice;
                Print($"Stop loss: {stopLoss} {entry}");
                Print($"{position.VolumeInUnits}");
                Print($"{Symbol.PipSize} ");
                Print($"{Symbol.PipValue}");
                Print($"{position.VolumeInUnits} {Symbol.PipSize} {Symbol.PipValue}");
                result += position.VolumeInUnits * Symbol.PipSize * Symbol.PipValue * (position.TradeType == TradeType.Buy ? 1 : -1) * (entry - stopLoss);
                Print($"Volume in units: {position.VolumeInUnits}, pip value: {Symbol.PipValue} stoploss {stopLoss} result: {result}" );
            }
            Print($"Exposure: {result}");
            return result;
        }

I'm not sure how to reproduce it. When I originally posted, I could replicate it or fix it by just choosing the correct symbol.  Right now however, I can no longer replicate it. So i don't really understand what this might mean. 


@ctid4921325

ctid4921325
07 Feb 2024, 09:30

RE: Symbol locks up bot

PanagiotisCharalampous said: 

Hi there,

What do you mean when you say “locks up”? How can we reproduce this behavior?

Best regards,

Panagiotis 

Hi Panagiotis

By ‘lockedup' I mean the bot (which is a UI for managing trades) becomes unresponsive.

I have debugs that show that it gets locked just stops when trying to access Symbol.PipSize.. for eg in the method below,  the last line that ‘logged’ was “Print($"{Symbol.PipSize}”)" Then everything stopped.
 

        private double TotalExposure()
        {.

            double result = 0;

            Print("Calculating total exposure");
            foreach (var position in Positions)
            {
                double stopLoss;
                Print($"position {position.Id}");
                if (position.StopLoss == null)
                {
                    stopLoss = 0;
                } else
                {
                  stopLoss = position.StopLoss.Value;
                 
                }
                double entry = position.EntryPrice;
                Print($"Stop loss: {stopLoss} {entry}");
                Print($"{position.VolumeInUnits}");
                Print($"{Symbol.PipSize} ");
                Print($"{Symbol.PipValue}");
                Print($"{position.VolumeInUnits} {Symbol.PipSize} {Symbol.PipValue}");
                result += position.VolumeInUnits * Symbol.PipSize * Symbol.PipValue * (position.TradeType == TradeType.Buy ? 1 : -1) * (entry - stopLoss);
                Print($"Volume in units: {position.VolumeInUnits}, pip value: {Symbol.PipValue} stoploss {stopLoss} result: {result}" );
            }
            Print($"Exposure: {result}");
            return result;
        }

I'm not sure how to reproduce it. When I originally posted, I could replicate it or fix it by just choosing the correct symbol.  Right now however, I can no longer replicate it. So i don't really understand what this might mean. 


@ctid4921325

ctid4921325
07 Feb 2024, 02:24

Hi there

I'm using a broker who has 2 versions of each pair, for eg USDJPY and USDJPY.p  

I have a bot which uses `Symbol.PipSize` to calculate various things.

On the USDJPY.p symbol however locks up the bot when I reference its ‘Symbol.PipSize' .

How can I manage this?

Thanks


@ctid4921325

ctid4921325
07 Feb 2024, 02:24

Hi there

I'm using a broker who has 2 versions of each pair, for eg USDJPY and USDJPY.p  

I have a bot which uses `Symbol.PipSize` to calculate various things.

On the USDJPY.p symbol however locks up the bot when I reference its ‘Symbol.PipSize' .

How can I manage this?

Thanks


@ctid4921325

ctid4921325
17 Jan 2024, 00:06

awesome, thanks for that, problem solved


@ctid4921325

ctid4921325
15 Dec 2023, 06:21

RE: my checkboxes are null references

PanagiotisCharalampous said: 

Hi there,

Your problem is here

            var chkboxSells = new CheckBox
            {
                Text = "Sells",
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Center,
                IsChecked = false
            };
            var chkboxBuys  = new CheckBox
            {
                Text = "Buys",
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Center,
                IsChecked = false
             };

Remove the var keyword and the issue should be fixed.

Best regards,

Panagiotis

oh  embarrassing.. but , thanks so much… sorry brand new to c#… thanks again, your support is incredible.


@ctid4921325