Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 827 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
Is multiple timeframe stochastic calculation broken? #433591
12/03/13 11:26
12/03/13 11:26
Joined: Oct 2013
Posts: 3
EUR - Euro
M
mhson Offline OP
Guest
mhson  Offline OP
Guest
M

Joined: Oct 2013
Posts: 3
EUR - Euro
Hi,
I am trying to make a multiple timeframe system that includes the StochF/Stoch indicator. I am having a hard time to get it to calculate a higher time frame stochastic with the built in indicator.

I created my own version of StochF and that seems to work as expected.

Am I doing something wrong or did I stumble on a bug? It seems that StochF disregards the change of TimeFrame?

This is my script. It plots standard StochF for H1 and H4 (these are identical) and my version of StochF for H1 and H4 below.

Quote:

#define D1 (1440/BarPeriod)
#define H4 (240/BarPeriod)
#define H1 (60/BarPeriod)

function raw_stochF(var k_period, var d_period) {
var close = priceClose();
var highest = HH(k_period);
var lowest = LL(k_period);

return EMA(series(100*(close-lowest)/(highest-lowest)), d_period);
}

function run() {
set(PLOTNOW);
BarPeriod = 60;

StartDate = 20130501;
EndDate = 20130513;

TimeFrame = H4;

var stoch_H4= StochF(7,2, MAType_EMA);
var r_stF_H4 = raw_stochF(7, 2);

TimeFrame = H1;

var stoch_H1= StochF(7,2, MAType_EMA);
var r_stF_H1 = raw_stochF(7, 2);

plot("StochF_H1", stoch_H1, NEW, ORANGE);
plot("StochF_H4", stoch_H4, LINE, RED);
plot("80", 80, LINE, BLACK);
plot("20", 20, LINE, BLACK);

plot("raw_StochF_H1", r_stF_H1, NEW, ORANGE);
plot("raw_StochF_H4", r_stF_H4, LINE, RED);
plot("e80", 80, LINE, BLACK);
plot("e20", 20, LINE, BLACK);
}


Please advice.

Regards
Martin

Re: Is multiple timeframe stochastic calculation broken? [Re: mhson] #433594
12/03/13 11:43
12/03/13 11:43
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Setting TimeFrame affects the subsequent data series. But the StochF function does not take any data series as input. Thus TimeFrame will have no effect on that function.

For multiple timeframes better use the "Normalize" function instead of StochF - or use your own function.

Re: Is multiple timeframe stochastic calculation broken? [Re: jcl] #433606
12/03/13 12:59
12/03/13 12:59
Joined: Oct 2013
Posts: 3
EUR - Euro
M
mhson Offline OP
Guest
mhson  Offline OP
Guest
M

Joined: Oct 2013
Posts: 3
EUR - Euro
Ah, I see! Thanks for clearing that up.

Is there a reason why the internal price series used by indicators are not affected by the TimeFrame setting? To me it feels more logical that all indicators should conform to the current TimeFrame setting.

The behavior was just kind of unexpected for me.

/Martin

Re: Is multiple timeframe stochastic calculation broken? [Re: mhson] #433607
12/03/13 13:05
12/03/13 13:05
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Yes, that's understandable - I've just put an additional remark about that in the manual. The reason is that there are no internal price series. Those indicators directly access the raw prices that are unaffected by TimeFrame. Some indicators, such as ATR, come in two versions, one of them is for different time frames.

Re: Is multiple timeframe stochastic calculation broken? [Re: jcl] #433609
12/03/13 13:21
12/03/13 13:21
Joined: Oct 2013
Posts: 3
EUR - Euro
M
mhson Offline OP
Guest
mhson  Offline OP
Guest
M

Joined: Oct 2013
Posts: 3
EUR - Euro
Thats what I thought.

Not that I am affected, but does this mean that all the candle pattern detection functions (the CDLxxx() ) operates on the BarPeriod time frame and are more or less unusable in a multi timeframe system?

Thanks for the normalize tip.

/Martin


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1