NexusFi: Find Your Edge


Home Menu

 





Linear Regression with Tradestation


Discussion in Traders Hideout

Updated
    1. trending_up 2,090 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
 

Linear Regression with Tradestation

 
rca131psu
Fort Mill
 
Posts: 1 since Jan 2019
Thanks Given: 0
Thanks Received: 0

Hello All - I have looked through a few threads but have not found anything that helps in my understanding of the current problem I am running into. I use the tradestation platform. I am trying to understand how the linear regression function works.

To create my first test, I am attempting to regress the last 30 bars of SP 500 Emini (dependent; data1 feed) versus the Russel (independent; data4 feed). I used the resources on the tradestation website to help construct the code below. However, when looking at the output variables, the numbers do not make sense. I pulled them all into a print file and calculated the regression manually in excel. I tried to troubleshoot but cannot figure out what I am doing wrong.

Any suggestions are appreciated.

Thank you!


----------------Start Code: My Failed Attempt------------------
Inputs:
RegArrayLength(30);

Var:
x(0), oLRSlope(0), oLRAngle(0), oLRIntercept(0), oLRValueRaw(0);

Array: ES_PrevCloses[30](0), RUS_PrevCloses[30](0);

For x = 1 to RegArrayLength begin

ES_PrevCloses[x] = Close[x] of data1;
RUS_PrevCloses[x] = Close[x] of data4;

End;


Value1 = LinRegArray2(RUS_PrevCloses, ES_PrevCloses, RegArrayLength, 0, oLRSlope, oLRAngle, oLRIntercept, oLRValueRaw);

Value2 = oLRSlope;

Value3 = oLRAngle;

Value4 = oLRIntercept;

Value5 = oLRValueRaw;

Value6 = Value4 + ((close[1] of data4)* Value2);

---------------------END Code---------------------


Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 thanks
 
 centaurer 
south africa
 
Posts: 169 since Dec 2018


I don't know easy language but part of the problem is easy language is just outdated. Python is an easier language than easy language.
If you have your prices in X and Y

from sklearn.linear_model import LinearRegression
ln = LinearRegression()
ln.fit(X,Y)

I just don't think it is worth the time to learn easy language in 2019.


 



Last Updated on May 7, 2019


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts