A question on data blocks and errors

Created at 03 Nov 2019, 20:12
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CA

calgodemo

Joined 28.05.2019

A question on data blocks and errors
03 Nov 2019, 20:12


Hi all,

In my bot I have a variable "StopLoss" which stores the value of the stoploss for a particular trade. It is global to the bot. 

If I have two instances of the bot running, EURUSD and say GBPJPY, and a Stop Loss value is stored for a trade in each instance, I assume the global variable points to different data blocks and won't overwrite itself?

Secondly, if I could get a clearer explanation of "cross reference exception". My indicator uses marketseries from multiple timeframes and occasionally this one pops up. Any info on what it is and why it is thrown would be great!

 

As always, thanks for your time!

CaD


@calgodemo
Replies

PanagiotisCharalampous
04 Nov 2019, 09:09

Hi calgodemo,

We will need more information in order to address your questions

1) What do you mean when you "global variable"?  Please provide us with a code sample to give you a definite answer.

2) Can you give us more information about this exception, like the indicator's code and some screenshots of where do you get this exception?

 Best Regards,

Panagiotis


@PanagiotisCharalampous

calgodemo
15 Nov 2019, 21:57

Panagiotis, 

 

2) sorry cannot do that, it usually happens in debugging but I cannot reproduce it at will, no idea how to make it trigger - but I assumed since spotware created the code that throws the exception in the first place they could tell me more about what it is thrown for... if the question could be asked of the developers that'd be great.

1) Global meaning it's scope is not limited to a method, function, or other bracketed code. Inside the bot class it's accessible anywhere.

 

CaD


@calgodemo

PanagiotisCharalampous
18 Nov 2019, 08:26

Hi calgodemo,

1) Probably this is a .Net exception, not a Spotware exception, this is why I need more information.

2) It is still not clear what do you mean global variable. Do you mean a static variable? If you have a static variable then it will be accessible by all instances of the cBot.

 Best Regards,

Panagiotis


@PanagiotisCharalampous