Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
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
1 registered members (rki), 405 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Bands dont build correctly Upper and Lower #467757
08/27/17 17:51
08/27/17 17:51
Joined: Aug 2017
Posts: 3
Q
qweqwe Offline OP
Guest
qweqwe  Offline OP
Guest
Q

Joined: Aug 2017
Posts: 3
Hi! I have a problem! Why BBands build Lower and Upper not properly?

This is my code

Click to reveal..

function run()
{
StartDate = 20170501;
EndDate = 20170502;
NumWFOCycles = 10;
DataSplit = 60; // activate WFO
NumCores = 4;
BarPeriod = 5;
set(BINARY);
Slippage = 0;
Spread = Commission = 0;
LifeTime = 1;

WinPayout = 75;
LossPayout = 0;

set(PARAMETERS);
int signal = optimize(20,5,30,1);
vars Close = series(priceClose());
var NbDevUp= optimize(2,1,4,0.5);
var NbDevDn =optimize(2,1,4,0.5);
BBands((series(priceClose())),signal,NbDevUp,NbDevDn,MAType_SMA);
vars upperBand = series(rRealUpperBand);
vars lowerBand = series(rRealLowerBand);

plot("Bollinger1",rRealUpperBand,BAND1,BLACK);
plot("Bollinger2",rRealLowerBand,BAND2,BLACK);
set(PLOTNOW);

if (crossOver(Close, upperBand))
enterShort(); //close short trades and open a long position
if (crossUnder(Close, lowerBand))
enterLong();

}

Attached Files
Untitled.png (14 downloads)
This
Re: Bands dont build correctly Upper and Lower [Re: qweqwe] #467797
09/01/17 13:32
09/01/17 13:32
Joined: Feb 2017
Posts: 24
sodiumchloride Offline
Newbie
sodiumchloride  Offline
Newbie

Joined: Feb 2017
Posts: 24
hey,
i changed your script little bit
- removed the optimization
- changed filling to grey (black filling = wtf??, but i guess u thought the color of the lower band is the color of the lower band grin it aint :D)
Code:
function run()
{
StartDate = 20170501;
EndDate = 20170502;
NumWFOCycles = 10;
DataSplit = 60; // activate WFO
NumCores = 4;
BarPeriod = 5;
set(BINARY);
Slippage = 0;
Spread = Commission = 0;
LifeTime = 1;

WinPayout = 75;
LossPayout = 0;


int signal = 30;
vars Close = series(priceClose());
var NbDevUp= 2;
var NbDevDn =2;
BBands((series(priceClose())),signal,NbDevUp,NbDevDn,MAType_SMA);
vars upperBand = series(rRealUpperBand);
vars lowerBand = series(rRealLowerBand);

plot("Bollinger1",rRealUpperBand,BAND1,BLACK);
plot("Bollinger2",rRealLowerBand,BAND2,GREY);
set(PLOTNOW);

if (crossOver(Close, upperBand))
enterShort(); //close short trades and open a long position
if (crossUnder(Close, lowerBand))
enterLong();

}


looks "normal" now. so, its about your optimized parameters?
have you entered the resulting parameters f.e. in metatrader 4? and then check is the BB "disappear" there too?
greetings

Re: Bands dont build correctly Upper and Lower [Re: sodiumchloride] #467801
09/01/17 16:45
09/01/17 16:45
Joined: Aug 2017
Posts: 3
Q
qweqwe Offline OP
Guest
qweqwe  Offline OP
Guest
Q

Joined: Aug 2017
Posts: 3
Thx! Yes, now its correct! But I would like to use it with optimization. It means my code is crearly? and Bands lag cause of optimization settings?

Re: Bands dont build correctly Upper and Lower [Re: qweqwe] #468058
09/15/17 06:17
09/15/17 06:17
Joined: Aug 2017
Posts: 40
J
johnnyp Offline
Newbie
johnnyp  Offline
Newbie
J

Joined: Aug 2017
Posts: 40
@sodiumchloride try again with signal = 20 instead of 30. The bands are certainly not normal.


Re: Bands dont build correctly Upper and Lower [Re: johnnyp] #468065
09/15/17 20:06
09/15/17 20:06
Joined: Aug 2017
Posts: 102
Spain
B
Brax Offline
Member
Brax  Offline
Member
B

Joined: Aug 2017
Posts: 102
Spain
Hi.

I´ve seen all your threads concerning BBands.

The problem is simple, BBands in TA-lib is buggy, especially for intraday ranges. The solution is here:

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=441209

If you use hourly or daily bars is unlikely for this error to appear.

Hope it helps.

Re: Bands dont build correctly Upper and Lower [Re: Brax] #468067
09/16/17 08:52
09/16/17 08:52
Joined: Aug 2017
Posts: 40
J
johnnyp Offline
Newbie
johnnyp  Offline
Newbie
J

Joined: Aug 2017
Posts: 40
Brilliant. Thanks.

It is a pity that the search function on this forum is limited to one year, otherwise I would have found it.

Re: Bands dont build correctly Upper and Lower [Re: johnnyp] #468069
09/16/17 11:41
09/16/17 11:41
Joined: Aug 2017
Posts: 102
Spain
B
Brax Offline
Member
Brax  Offline
Member
B

Joined: Aug 2017
Posts: 102
Spain
Yes, the search function shouldn´t be restricted.

I think i found it googling "bbands plot zorro" or something similar...

Glad it worked.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1