Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 508 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Moving average range filter #481973
11/29/20 09:56
11/29/20 09:56
Joined: Feb 2017
Posts: 5
S
SPIRIT777 Offline OP
Newbie
SPIRIT777  Offline OP
Newbie
S

Joined: Feb 2017
Posts: 5
Dear All,

Please help with code for calculation of range between 2 emas (8 and 21 EMAs), I have the following code below, but it seems doesn't work.
Please comment. Thanks a lot!


//Filter MA range

vars close = series(priceClose());

vars EMAF = series(EMA(close,8));
vars EMAM = series(EMA(close,21));
vars EMAS = series(EMA(close,34));


// MA range
vars rangeMA = series(EMAF[1]-EMAM[1]); // calculate range between ema 8 and 21 (for previous 1 bar)
vars rangeMA2 = series(EMAM[1] - EMAS[1]); // calculate range between ema 21 and 34 (for previous 1 bar)

vars ruleMAR = (abs(rangeMA[1]) >= 7*PIP); // filter range more than 7 pips between ema 8 and 21 (previous 1 bar)
vars ruleMAR2 = (abs(rangeMA2[1]) >= 7*PIP); // filter range more than 7 pips between ema 21 and 34 (previous 1 bar)

Re: Moving average range filter [Re: SPIRIT777] #481977
11/29/20 23:13
11/29/20 23:13
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Not an expert but
vars ruleMAR = (abs(rangeMA[1]) >= 7*PIP); // filter range more than 7 pips between ema 8 and 21 (previous 1 bar)
vars ruleMAR2 = (abs(rangeMA2[1]) >= 7*PIP); // filter range more than 7 pips between ema 21 and 34 (previous 1 bar)

Are not vars, but var.

ciao

Re: Moving average range filter [Re: MatPed] #481980
11/30/20 07:22
11/30/20 07:22
Joined: Feb 2017
Posts: 5
S
SPIRIT777 Offline OP
Newbie
SPIRIT777  Offline OP
Newbie
S

Joined: Feb 2017
Posts: 5
Thanks a lot for the comment!

But when I changed to var it generates error and code doesnt works.

How to debug the formula and see the result of it? is there some kind of debugging instrument.

Many thanks.

Re: Moving average range filter [Re: SPIRIT777] #481981
11/30/20 14:38
11/30/20 14:38
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
sorry I missed a piece of the previous comment, it is a comparison they are bool or int. Not var. The test wil result in a 0 or 1


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1