Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Nymphodora, AndrewAMD, TipmyPip, Quad, Imhotep), 847 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 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