Gamestudio Links
Zorro Links
Newest Posts
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
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
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
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, howardR), 452 guests, and 5 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
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,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
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