[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Plotting issues with the LinearRegAngle function



PureBytes Links

Trading Reference Links

Hi guys,

When I plot the LinearRegAngle function in TS8.3, I get it plotting the
angle in degrees on the @ES, but on a US stock like HAL for example, it
doesn?t convert properly and plots the arctangent value.  I do not
understand why the same indicator plots degrees on one market and arctangent
values on another.  Are others able to replicate this? I had some code
suggested to me on the Tradestation forum, which fixed the problem on HAL,
but when applied to @ES it simply messed up what was initially correct.  Any
ideas would be helpful.

Plot1(LinearRegAngle(Average(C,21),3),"");

The suggested alteration:

input: price(average(c,21)), len(3); 
var: LRA(0), rescaledPrice(0), rescalingFactor(9), rescaledLRA(0); 

LRA=linearRegAngle(price,len); 
rescaledPrice=price*rescalingFactor; 
rescaledLRA=linearRegAngle(rescaledPrice,len); 

plot1(LRA,"LRA"); 
plot2(rescaledLRA,"rescaledLRA");


Ultimately I am after something that gives me the angle of a line, but also
trying to have  it normalised over all markets and timeframes.  So adjusting
the code to reflect tick changes via  (Price2 - Price1) *
(pricescale/minmove). Is something I weould implement as well.

Thanks

24/05/2008
8:56 AM