LinRegArray Function

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
wall richard
Posts: 60
Joined: 28 Dec 2007
Has thanked: 9 times
Been thanked: 1 time

LinRegArray Function

Postby wall richard » 17 Jun 2012

MC has a function capable of taking array data and preforming a linear regulation on the data. It's name is LinRegArray. Unfortunately MC does not list a matching indicator for this function. I have unsuccessfully tried to code an indicator. I cannot find any MC information on how to code this indicator.

Anyone familiar with an indicator for this function or know how to locate one?

Thanks,

Richard

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: LinRegArray Function

Postby Henry MultiСharts » 19 Jun 2012

This question has been already answered during the live chat session. Richard, you can post your study here if you would like to share it with the community.

wall richard
Posts: 60
Joined: 28 Dec 2007
Has thanked: 9 times
Been thanked: 1 time

Re: LinRegArray Function

Postby wall richard » 19 Jun 2012

Katrin furnished the solution.

------------------------------------------------------------------------------------------------------

Input: PriceValueArray(100), Size(10) , TgtPos(0), OLRSlope(0), OLRAngle(0), OLRIntercept(0), OLRValueRaw(0);

Var: X(0), var0( 0 ), var1( 0 ), var2( 0 ), var3( 0 ), var4(0), var5(0) , var6(0);

Array: ARR[100](0);

For X = 20 downto 1 begin
Arr[X] = C[X-1];
End;

Value1 = LinRegArray(ARR, Size, TgtPos, var3,var4,var5,var6);

Plot1[0](var6,"");

--------------------------------------------------------------------------------------------------------------

The advantage is being able to manipulate data in an array then plot your results. You cannot manipulate data in a variable the same way. Example: In MyVariable[1] you cannot go back and change the value. In arrays you can change the value of any element anywhere at any time.

Richard


Return to “User Contributed Studies and Indicator Library”