NexusFi: Find Your Edge


Home Menu

 





Linear Regression with Tradestation


Discussion in Traders Hideout

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




 
Search this Thread
  #1 (permalink)
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---------------------


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
No book, only a stair: journaling fills where price move …
Cryptocurrency
I developed a free AI-powered (Kronos) forecasting indic …
The Elite Circle
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
My Rant with AMP Futures
Trading Reviews and Vendors
EA
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Would you consider buying or leasing an algo?
4 thanks
Big Mike in Ecuador
4 thanks
Trading Journal (Neural Network Production Pipeline Mode …
4 thanks
Trading psychology articles
4 thanks
The Scalpers Journey
2 thanks
  #3 (permalink)
 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.


Reply With Quote




Last Updated on May 7, 2019


© 2026 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 - Downloads - Top
no new posts