Looking for confirmation: static variables accessible across all bot instances?
Looking for confirmation: static variables accessible across all bot instances?
04 Oct 2019, 10:31
Hello Team Spotware:
Just wanted to confirm support that static variables declared as public in cbots are visible/accessible under every instance for a particular cBot?
So I have a bot with a DataSeries declared as:
private DataSeries _closeLongSeries;
Instead of having this variable sucking up memory for every instance, I'd like to declare it as:
public static DataSeries _closeLongSeries;
so there's only 1 instance of it across the 21 bot instances instead of 1 for each bot instance since it will be the same.
Is this supported in cAlgo with bots?
This question was also posed in this thread ( #8 ), but never answered:
https://ctrader.com/forum/cbot-support/11907
Thank you.
PanagiotisCharalampous
04 Oct 2019, 10:43
Hi FireMyst,
Yes this should be the case. You can check it with the example below
Best Regards,
Panagiotis
@PanagiotisCharalampous