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 (TipmyPip, Ayumi), 773 guests, and 3 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
Use of indicator's result #450716
04/21/15 08:07
04/21/15 08:07
Joined: Feb 2015
Posts: 45
Italy
forexcoder Offline OP
Newbie
forexcoder  Offline OP
Newbie

Joined: Feb 2015
Posts: 45
Italy
Hi all. I have the following doubt:
if I use an indicator, for example the BBands, how can I use its resluts? For example, it is correct the following script:
Code:
vars PriceH1 = series(price());
vars TriggerLine = series(LowPass(PriceH1,optimize(7,5,9)));
BBands(PriceH1,20,2,2,MAType_SMA);
	
Stop = optimize(4,2,8) * ATR(60);
TakeProfit = optimize(4,2,8)*ATR(60);
	
if(crossOver(TriggerLine,rRealLowerBand)) 
		enterLong();
else if (crossUnder(TriggerLine,rRealUpperBand)) 
		enterShort();


or is correct this one:
Code:
vars PriceH1 = series(price());
	vars TriggerLine = series(LowPass(PriceH1,optimize(7,5,9)));
BBands(PriceH1,20,2,2,MAType_SMA);
vars upperBand = series(rRealUpperBand);
vars lowerBand = series(rRealLowerBand);
	vars middleBand = series(rRealMiddleBand);
Stop = optimize(4,2,8) * ATR(60);
TakeProfit = optimize(4,2,8)*ATR(60);
	
if(crossOver(TriggerLine,lowerBand )) 
		enterLong();
else if (crossUnder(TriggerLine,upperBand )) 
		enterShort();



in which I use series (lowerBand ecc.) instead of varables (rRealLowerBand ecc.).
Thanks.

Last edited by forexcoder; 04/21/15 08:10.
Re: Use of indicator's result [Re: forexcoder] #450717
04/21/15 09:56
04/21/15 09:56
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You need series. crossOver/Under works also with a constant threshold, so your first code is also formally correct, but can miss crossovers because the BBand borders are not a constant value.

Re: Use of indicator's result [Re: jcl] #450726
04/21/15 14:04
04/21/15 14:04
Joined: Feb 2015
Posts: 45
Italy
forexcoder Offline OP
Newbie
forexcoder  Offline OP
Newbie

Joined: Feb 2015
Posts: 45
Italy
So the correct version is the second one. Is it right?

Re: Use of indicator's result [Re: forexcoder] #450727
04/21/15 14:21
04/21/15 14:21
Joined: Feb 2015
Posts: 45
Italy
forexcoder Offline OP
Newbie
forexcoder  Offline OP
Newbie

Joined: Feb 2015
Posts: 45
Italy
I tried both verions and both work (no error). But the first one gives a much better result.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1