Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Platinum Customer
Joined: 2/24/2013 Posts: 16
|
Hello,
I want to call the value of a linear regression slope of indicator that is a child of a 200 exponential moving average of price. Is there any way to call this value in Real Code. I can't seem to figure out how to call it and the math would be quite complex to do manually best as I can figure.
Thank you,
Connor
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You should be able to just drag and drop the Linear Regression Slope of Indicator indicator into the RealCode Editor to create a reference you can use. The line beginning '# LRS was created this way.
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Charted Indicator Example
'|******************************************************************
'# LRS = chart.LinearRegressionSlope.3
Plot = LRS.Value
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 2/24/2013 Posts: 16
|
Oh I did not know that was possible. Thank you... that opens a lot of doors for me.
Honestly thank you so much!
|
|
Platinum Customer
Joined: 2/24/2013 Posts: 16
|
Ok new problem. >.<
My condition doesn't seem to refer to historical data correctly.
For example:
'# LRS = chart.LinearRegressionSlope.3
If LRS.value(0) > LRS.value(1) Then
Pass
End If
This code causes the condition to return true somewhat randomly. It never shows pass when it shouldn't but it is missing a lot of bars where it should show pass.
The actual condition I'm writing is more complex but this is the first issue I'm up against in getting it to work.
Can you call historical data from an imported indicator? Is my syntax wrong?
Thank you,
Connor
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
I'm seeing correct results on this end. What period are you using for the LRS?
|
|
Platinum Customer
Joined: 2/24/2013 Posts: 16
|
The period is 14. Its odd it just shows up sporadically. Always correct but is missing lots of bars that should be correct too.
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
OK, can you send a screenshot to support@tc2000.com?
|
|
Platinum Customer
Joined: 2/24/2013 Posts: 16
|
Will do.
|
|
Platinum Customer
Joined: 2/24/2013 Posts: 16
|
End result was that the linear regression was rounding to the hundredths place (0.00) in the calculations concerning the condition. The solution was to open the block diagram from the edit menu of the condition and insert a "Multiply by Value" block and set it to a big enough number to bring the value of the LR into a range where rounding didn't cause issues. In my case I had to use 1000-10000 for the two LRs in my condition.
|
|
Guest-1 |