Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 770 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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