
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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);