NexusFi: Find Your Edge


Home Menu

 





Linear Regression with Tradestation


Discussion in Traders Hideout

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




 
Search this Thread

Linear Regression with Tradestation

  #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?
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #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


© 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