Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by jcl. 04/20/24 08:52
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (7th_zorro, Aku_Aku, henrybane, flink, 1 invisible), 712 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Calculating Slope #487289
03/05/23 16:56
03/05/23 16:56
Joined: Feb 2023
Posts: 14
D
DonDiego Offline OP
Newbie
DonDiego  Offline OP
Newbie
D

Joined: Feb 2023
Posts: 14
Comming from Easylanguage calculating a slope of, ie, a MovingAverage was as simple

MASlope = MA - MA[1];

In C (or lite-C, haven't figured out the difference yet) I tried

vars Prices = series(priceC());
vars MA = series(MovingAverage(Prices,20,MAType_SMA));

vars MASlope = series(MA- MA[1],300)); //300 is the Lookback
or why not MASlope = MA - MA[1]; ?

Appreciate a hint.
Thank you

Re: Calculating Slope [Re: DonDiego] #487290
03/05/23 19:36
03/05/23 19:36
Joined: Feb 2016
Posts: 15
Russia
nsg Offline
Newbie
nsg  Offline
Newbie

Joined: Feb 2016
Posts: 15
Russia
Not sure I fully get it, but anyway:
Code
function run()
{
	set(PLOTNOW);

	LookBack = 300;

	vars Prices = series(priceC());
	vars MA = series(SMA(Prices,20));
	vars MASlope = series(MA[0]-MA[1]);

	plot("MA Slope",MASlope,NEW,RED);
}

Re: Calculating Slope [Re: DonDiego] #487291
03/05/23 21:58
03/05/23 21:58
Joined: Feb 2023
Posts: 14
D
DonDiego Offline OP
Newbie
DonDiego  Offline OP
Newbie
D

Joined: Feb 2023
Posts: 14
@nsg, I love you! That worked. Thanks a lot!

Where can I turn to, when I have syntax issues, so that I don't have post ervery tiny problem into the forum?

Re: Calculating Slope [Re: DonDiego] #487295
03/06/23 11:07
03/06/23 11:07
Joined: Feb 2016
Posts: 15
Russia
nsg Offline
Newbie
nsg  Offline
Newbie

Joined: Feb 2016
Posts: 15
Russia
It's a pleasure.

I'm afraid, there aren't many options: paid ticket-based support by oP group or trying your luck here on the forum for free. Maybe find yourself a mentor (like me, ha-ha). I'm not aware of any vibrant Zorro communities elsewhere.

Re: Calculating Slope [Re: DonDiego] #487296
03/06/23 12:55
03/06/23 12:55
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
By first reading the manual (code examples!), then the financial hacker website or by searching this forum for keywords.

Re: Calculating Slope [Re: Grant] #487297
03/06/23 17:11
03/06/23 17:11
Joined: Feb 2023
Posts: 14
D
DonDiego Offline OP
Newbie
DonDiego  Offline OP
Newbie
D

Joined: Feb 2023
Posts: 14
Originally Posted by Grant
By first reading the manual (code examples!), then the financial hacker website or by searching this forum for keywords.


I read the manual, which is very good btw, and work with it as good as I can.
I'm aware of Financial Hacker website, which is also very interesting but probably not so much of a help as a "junior-Zorro". :-)
Before I post, of course I use the search function.

The thing is, I'm fairly proficient in EasyLanguage and stumbling over the most basic code syntax makes me feel like an idiot, is time consuming and a bit frustrating. But I accept that in order to work with a more flexible and intelligent (or at least different) tool than Tradestation. So I guess I just have to be patient and hang in there...

Anyway, I appreciate the support I get in this Forum - thank you.

Re: Calculating Slope [Re: DonDiego] #487300
03/06/23 19:39
03/06/23 19:39
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Good to hear that you take those steps. By doing so you will really learn things. Too often I see impatient people over here asking for things that are clearly explained in the manual (oh crap, that includes me during the beginning blush ).

Yeah, EL is completely different. My advice is to start with short and simple code, test it, add/change a few lines, test it again and so on.

Best of luck!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1