Gamestudio Links
Zorro Links
Newest Posts
Zorro version 3.0 prerelease!
by jcl. 02/12/26 14:05
MarginCost discrepancy?
by jcl. 02/12/26 14:02
Hedge on FXCM, 4 or 5?
by qin. 02/11/26 14:12
CMC MT4 CFD vs FX Active - what's better?
by mayarik. 02/11/26 11:00
print a "still alive" log
by qin. 02/10/26 12:16
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (TipmyPip), 7,786 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon, mayarik
19198 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Slope function. how? #482866
04/09/21 02:36
04/09/21 02:36
Joined: Mar 2021
Posts: 35
Ocean county, Florida
NewtraderX Offline OP
Newbie
NewtraderX  Offline OP
Newbie

Joined: Mar 2021
Posts: 35
Ocean county, Florida
Hello all,

This sample code is from the manual, it works fine just as it is.

var HighsDn[10] = { 1,1,1,2,1,1,1,3,1,1 }; // mind the reverse order
var LowsUp[10] = { 1,1,1,0.7,1,1,1,0.5,1,1 };

function main()
{
printf("\nSlope dn %.3f",slope(PEAK,HighsDn,10));
printf("\nSlope up %.3f",slope(VALLEY,LowsUp,10));
plot("DPO", HighsDn[10], LINE, BLUE);
plot("DPOd", LowsUp[10], LINE, RED);
}


However, when I use slope function on price series instead of HighsDn or LowsUp I don't get any values.

Do you have a sample for using slope function with price series?

Such as below:


function run()
{
BarPeriod=5;
LookBack = 100;
StartDate = 20210103;
EndDate = 20210104;

var* Price = series(price());

vars MM2 = series(SMA(Price,20));

printf("\n+");

printf("\nPEAK %.3f",slope(PEAK,MM2,5));
printf("\nVALLEY %.3f",slope(VALLEY,MM2,5));
}

zorro image that is result of running my script is below:
https://prnt.sc/117scg1

Thank you.

Re: Slope function. how? [Re: NewtraderX] #482870
04/09/21 13:40
04/09/21 13:40
Joined: Mar 2021
Posts: 35
Ocean county, Florida
NewtraderX Offline OP
Newbie
NewtraderX  Offline OP
Newbie

Joined: Mar 2021
Posts: 35
Ocean county, Florida
Can anyone find the problem with my script?

Re: Slope function. how? [Re: NewtraderX] #482873
04/09/21 18:31
04/09/21 18:31
Joined: Mar 2021
Posts: 35
Ocean county, Florida
NewtraderX Offline OP
Newbie
NewtraderX  Offline OP
Newbie

Joined: Mar 2021
Posts: 35
Ocean county, Florida
I have no clue on how to get this to work.
Can you guys point me to some a direction?

Re: Slope function. how? [Re: NewtraderX] #482885
04/13/21 06:19
04/13/21 06:19
Joined: Jul 2000
Posts: 28,072
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,072
Frankfurt
Look at your printf call. The slope is the price movement per bar. Are 3 decimals enough?

Re: Slope function. how? [Re: jcl] #482901
04/15/21 00:58
04/15/21 00:58
Joined: Mar 2021
Posts: 35
Ocean county, Florida
NewtraderX Offline OP
Newbie
NewtraderX  Offline OP
Newbie

Joined: Mar 2021
Posts: 35
Ocean county, Florida
Originally Posted by jcl
Look at your printf call. The slope is the price movement per bar. Are 3 decimals enough?

Thank you sir.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1