Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (vicknick, AndrewAMD), 1,292 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Trend Lines #414271
12/28/12 04:35
12/28/12 04:35
Joined: Dec 2012
Posts: 14
P
Pipinator Offline OP
Newbie
Pipinator  Offline OP
Newbie
P

Joined: Dec 2012
Posts: 14
JCL

Does Zorro have any provision for trendlines?
Or do I have to do the old y=mx+b myself?

Pip

Re: Trend Lines [Re: Pipinator] #414280
12/28/12 09:01
12/28/12 09:01
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
If you mean linear regression: You can either use the "polyfit" function, or the standard "LinearReg" indicators in the ta-lib.

Re: Trend Lines [Re: jcl] #414297
12/28/12 13:41
12/28/12 13:41
Joined: Dec 2012
Posts: 14
P
Pipinator Offline OP
Newbie
Pipinator  Offline OP
Newbie
P

Joined: Dec 2012
Posts: 14
What I am looking for is a way to generate a trend line array that I can compare a breakout against. So I'm thinking if I have two points I determined for a trend line priceHigh(5), priceHigh(2) I could feed the points in to

trendArray = TrendLine()
I could compare (and plot)

if (price > trendArray[0] && price > priceHigh{1))
enterLong();


I don't understand what Linearreg is returning. b+m*(TimePeroid-1) is that the next value?

How do I call it?
LinearReg(var* Data, int TimePeriod): var
var *Data = priceHigh[0..5];

nextTrendValue = LinearReg(Data,60);??

Thanks!

Pipinator
Edit --------------
I've tried the following:
var nextValue = LinearReg(priceHigh,5);
printf("nextValue: %2.4f, priceHigh:%2.4f\n",(double)nextValue, (double) priceHigh);

The log file shows values like:
nextValue: 991021190119434640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000, priceHigh:4211680.0000Bar:150
nextValue: 991021190119434640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000, priceHigh:4211680.0000Bar:151

Last edited by Pipinator; 12/28/12 14:20.
Re: Trend Lines [Re: Pipinator] #414317
12/28/12 17:55
12/28/12 17:55
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
How to call a function is explained in the tutorial. The LinearReg function and most other TA functions are called in exactly the same way as the LowPass function in workshop 4. If you are not sure what an indicator does, plot a line from it - then it normally becomes clear.

However, you're right - the LinearReg function doesn't make much sense to me either. Better use the LinearRegSlope function, which calculates the m value, the projected price change per bar.

Re: Trend Lines [Re: jcl] #414319
12/28/12 18:27
12/28/12 18:27
Joined: Dec 2012
Posts: 14
P
Pipinator Offline OP
Newbie
Pipinator  Offline OP
Newbie
P

Joined: Dec 2012
Posts: 14
Jcl.. thanks I will try that. But solve the mystery of printf for me. I tried printing out price priceHigh values with %f and it is coming up 0's or when I cast it to double, as an overflow number. How do I get the values to print in the log?

Pipinator

Re: Trend Lines [Re: Pipinator] #414351
12/30/12 09:59
12/30/12 09:59
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
printf("\nMy price is: %f",priceHigh());


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1