Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 16,415 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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: 28,022
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,022
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