I want to initiate some variables at the beginning but I found I cannot put the code in Create() or StartCalc() because if I change time frame, the code in create() or in StartCalc() don't run again but I want the variables to be initiated again if there is time frame change. Because that's for the initiation of the variables, the code needs to be run once only and doesn't need to be run at each bar. How can I do it?
Thanks.
How to make some code to run only once at the beginning?
- Polly MultiCharts
- Posts: 207
- Joined: 20 Jul 2022
- Has thanked: 1 time
- Been thanked: 57 times
Re: How to make some code to run only once at the beginning?
Hello r41866,
You need to do that in StartCalc().
If StartCalc() doesn’t work as expected in your setup, please send us a simplified code, the workspace where the issue is reproduced and step-by-step instructions on how to reproduce the issue to our support email, so that we could check it on our end.
You need to do that in StartCalc().
If StartCalc() doesn’t work as expected in your setup, please send us a simplified code, the workspace where the issue is reproduced and step-by-step instructions on how to reproduce the issue to our support email, so that we could check it on our end.
-
- Posts: 87
- Joined: 10 Feb 2022
- Has thanked: 53 times
- Been thanked: 11 times
Re: How to make some code to run only once at the beginning?
look at chapter 4
- Attachments
-
- MultiCharts.NET-ProgrammingGuide-v1.2.pdf
- (1.77 MiB) Downloaded 25 times