Topics
07 Feb 2024, 02:24
 321
 4
Replies

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

ctid4921325
14 Dec 2023, 16:37 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE: RE: RE: RE: my checkboxes are null references

PanagiotisCharalampous said: 

ctid4921325 said: 

PanagiotisCharalampous said: 

ctid4921325 said: 

PanagiotisCharalampous said: 

Hi there,

It's hard to tell what the problem is with just some samples of the code. You should share the complete cBot code so that we can reproduce the problem.

Best regards,

Panagiotis

also, to replicate.. you need to place some trades, then choose your checkbox options then “Move Stoploss”

 

Thanks

Hi there,

I tried for a while to reproduce it but with no luck. Can you provide more specific steps we need to follow to reproduce this?

Best regards,

Panagiotis

Hey Panagoitis, thanks for going to this effort. Simplest reproduction is

Step 1)
Place a trade


 

Step 2) Click the “Close selected trades” button, Feel free to toggle any of the checkboxes, results are the same.

Step 3) See "Crashed in Click event with NullReferenceException: Object reference not set to an instance of an object.

 

Thanks!

Hi there,

Unfortunately the code you have shared has less parameters and displays nothing on the chart. So we are probably not running the same code

Best regards,

Panagiotis

not sure i follow, what i've got here is the same with some unrelated changes.. but i'll repost the full current version, there's the updated version used to create the error with “Close selected trades” button on the above images:
> https://gist.github.com/glenndavy/1e15326378b01bd43deb9fe171d55564
 


@ctid4921325

ctid4921325
14 Dec 2023, 16:37 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE: RE: RE: RE: my checkboxes are null references

PanagiotisCharalampous said: 

ctid4921325 said: 

PanagiotisCharalampous said: 

ctid4921325 said: 

PanagiotisCharalampous said: 

Hi there,

It's hard to tell what the problem is with just some samples of the code. You should share the complete cBot code so that we can reproduce the problem.

Best regards,

Panagiotis

also, to replicate.. you need to place some trades, then choose your checkbox options then “Move Stoploss”

 

Thanks

Hi there,

I tried for a while to reproduce it but with no luck. Can you provide more specific steps we need to follow to reproduce this?

Best regards,

Panagiotis

Hey Panagoitis, thanks for going to this effort. Simplest reproduction is

Step 1)
Place a trade


 

Step 2) Click the “Close selected trades” button, Feel free to toggle any of the checkboxes, results are the same.

Step 3) See "Crashed in Click event with NullReferenceException: Object reference not set to an instance of an object.

 

Thanks!

Hi there,

Unfortunately the code you have shared has less parameters and displays nothing on the chart. So we are probably not running the same code

Best regards,

Panagiotis

not sure i follow, what i've got here is the same with some unrelated changes.. but i'll repost the full current version, there's the updated version used to create the error with “Close selected trades” button on the above images:
> https://gist.github.com/glenndavy/1e15326378b01bd43deb9fe171d55564
 


@ctid4921325

ctid4921325
14 Dec 2023, 07:45 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE: RE: my checkboxes are null references

PanagiotisCharalampous said: 

ctid4921325 said: 

PanagiotisCharalampous said: 

Hi there,

It's hard to tell what the problem is with just some samples of the code. You should share the complete cBot code so that we can reproduce the problem.

Best regards,

Panagiotis

also, to replicate.. you need to place some trades, then choose your checkbox options then “Move Stoploss”

 

Thanks

Hi there,

I tried for a while to reproduce it but with no luck. Can you provide more specific steps we need to follow to reproduce this?

Best regards,

Panagiotis

Hey Panagoitis, thanks for going to this effort. Simplest reproduction is

Step 1)
Place a trade


 

Step 2) Click the “Close selected trades” button, Feel free to toggle any of the checkboxes, results are the same.

Step 3) See "Crashed in Click event with NullReferenceException: Object reference not set to an instance of an object.

 

Thanks!


@ctid4921325

ctid4921325
13 Dec 2023, 10:41 ( Updated at: 14 Dec 2023, 06:43 )

RE: my checkboxes are null references

PanagiotisCharalampous said: 

Hi there,

It's hard to tell what the problem is with just some samples of the code. You should share the complete cBot code so that we can reproduce the problem.

Best regards,

Panagiotis

also, to replicate.. you need to place some trades, then choose your checkbox options then “Move Stoploss”

 

Thanks


@ctid4921325

ctid4921325
13 Dec 2023, 10:39 ( Updated at: 14 Dec 2023, 06:43 )

RE: my checkboxes are null references

PanagiotisCharalampous said: 

Hi there,

It's hard to tell what the problem is with just some samples of the code. You should share the complete cBot code so that we can reproduce the problem.

Best regards,

Panagiotis

THanks Panagiotis, really appreciate that.. it was to big to paste here, but here's a link. I think its line 368 that hits the error. pls excuse the coding, its my first c# effort

https://gist.github.com/glenndavy/1e15326378b01bd43deb9fe171d55564


@ctid4921325

ctid4921325
02 Dec 2023, 10:13

RE: Logging during replay mode

PanagiotisCharalampous said: 

Hi there,

Unfortunately this is not possible at the moment. You can use backtesting for this instead.

Best regards,

Panagiotis

Thanks Panagiotis,  as far as I can see this is only available for cbots, not indicators, is that correct?


@ctid4921325

ctid4921325
02 Dec 2023, 10:13

RE: Logging during replay mode

PanagiotisCharalampous said: 

Hi there,

Unfortunately this is not possible at the moment. You can use backtesting for this instead.

Best regards,

Panagiotis

Thanks Panagiotis,  as far as I can see this is only available for cbots, not indicators, is that correct?


@ctid4921325

ctid4921325
02 Dec 2023, 08:51

RE: Confusion handling ChartObjects

PanagiotisCharalampous said: 

Hi Glenn,

Should this line return null if the horizontal line  named “Insight” can't be found and set the value of insightLine to null?:

Yes

Should I expect that  insightLine.IsAlive should now be False? (but insightLine is ≠ null)

Yes

insightLine should now be null?

Yes

What I get is, that remove object doesn't seem to change the IsAlive property to false, and once it exists FindObject never seems to return a null, mostly as established with DrawStaticText, but I thought I should clarify whats actually expected behaviour.

Works fine for me. See my code below

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{    [Indicator(AccessRights = AccessRights.None, IsOverlay = true)]    public class NewIndicator : Indicator    {        [Parameter(DefaultValue = "Hello world!")]        public string Message { get; set; }        [Output("Main")]        public IndicatorDataSeries Result { get; set; }                ChartHorizontalLine insightLine;        protected override void Initialize()        {              insightLine = Chart.DrawHorizontalLine("Insight", 1, Color.Red);              insightLine = Chart.FindObject("Insight") as ChartHorizontalLine;              Print(insightLine.IsAlive);              Chart.RemoveObject("Insight");              Print(insightLine.IsAlive);        }        public override void Calculate(int index)        {                }    }}

Best regards,

Panagiotis

Awesome, thanks Panagiotis, now I know what should happen… :)


@ctid4921325

ctid4921325
20 Nov 2023, 20:03 ( Updated at: 21 Nov 2023, 13:40 )

RE: Reply to: chart objects not drawing

PanagiotisCharalampous said: 

Hi there,

We managed to reproduce the problem and it will be solved in an upcoming release of cTrader Desktop.

Best regards,

Panagiotis

awesome, thanks!


@ctid4921325