I'm developing an indicator that works in this way :
public class Indicator : IndicatorObject
private Function.M1 Funct1;
private Function.M2 Funct2;
protected override void Create() {
Funct1 = new Function.M1(this);
Funct2 = new Function.M2(this);
}
protected override void CalcBar(){
Funct2.c=Funct1.Value; ((The return of the function is passed from Funct1 to Funct2)
plot1.Set(Funct2.Value);
(the function funct2 processes the data transmitted over and plots the return value)
}
i ask you this question:
This way of trasmission parameters using class is fast(using Update on every tick) then a single indicator way?
i set my program in this way to organize it well
pass values between classes
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: pass values between classes
Hello shivax,
Addition calls always require some time. Whether execution time will be affected or not depends on how your code is designed. If it is designed efficiently then transmission of parameters using class
will take insignificant time, compared to single indicator way.
Addition calls always require some time. Whether execution time will be affected or not depends on how your code is designed. If it is designed efficiently then transmission of parameters using class
will take insignificant time, compared to single indicator way.
Re: pass values between classes
but if I create variables that need to be read and modified by all classes (M1 and M2 in the above example)
This is the best choice or is better to use global variables.
This is the best choice or is better to use global variables.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: pass values between classes
Both solutions are working. It is up to you to decide which one is more optimal for you.