I wish to convert my favourite Ts2000i indicators over to your software, so I will have a few requests.
Please build a function called "linearRegValue", so this function can be used in other indicators ( type of smoothing tool).
Inputs : Price, length, BarsPlus
Outputs : one value, linearRegvalue
Your could chart the output, but will need the function to go into another indicator.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I wish to convert my favourite Ts2000i indicators over to your software, so I will have a few requests.
Please build a function called "linearRegValue", so this function can be used in other indicators ( type of smoothing tool).
Inputs : Price, length, BarsPlus
Outputs : one value, linearRegvalue
Your could chart the output, but will need the function to go into another indicator.
Ts2000i Code ( Omega Tradestation ) ELA :
Inputs: Price(NumericSeries), Len(NumericSimple), TargetB(NumericSimple);
Variables: X(0), Num1(0), Num2(0), SumBars(0), SumSqrBars(0), SumY(0), Sum1(0), Sum2(0), Slope(0), Intercept(0);
If Len = 0 Then
LinearRegValue = 0;
SumBars = 0;
SumSqrBars = 0;
SumY = 0;
Sum1 = 0;
Sum2 = 0;
SumY = Summation(Price, Len);
SumBars = Len * (Len - 1) * .5;
SumSqrBars = (Len - 1) * Len * (2 * Len - 1) / 6;
For X = 0 To Len - 1 Begin
Sum1 = Sum1 + X * Price[X];
End;
Sum2 = SumBars * SumY;
Num1 = Len * Sum1 - Sum2;
Num2 = SumBars * SumBars - Len * SumSqrBars;
If Num2 <> 0 Then
Slope = Num1 / Num2
Else
Slope = 0;
Intercept = (SumY - Slope * SumBars) / Len;
LinearRegValue = Intercept + Slope * (Len - 1 + CurrentBar - BarNumber - TargetB);