help with afl

mrm

New Member
#1
I'm not programmer many times I'm lucky and able to copy and paste together some afl's. I'm reading Connors book and came across bollinger system.Look like would be easy to co but I'm stuck
rules are
price close above 200ma
%b must close bellow>2 for 3days
buy on close
this what I hve done so far but is not working .Can anybody help me to corecte and finish this afl

_SECTION_BEGIN("bb%2");
Graph0 = (Close - BBandBot (Close, 20, 2))
/ ((BBandTop (Close, 20, 2) - BBandBot (Close, 20, 2)));

Plot( Graph0, "%b indicator", colorYellow );
bb=(Close - BBandBot (Close, 20, 2))/ ((BBandTop (Close, 20, 2) - BBandBot (Close, 20, 2)));
Buy=Close < Ref(bb,.20)AND Ref(C,-1)< Ref(bb,.2)-1 AND Ref(C,-2)< Ref(bb,.2)-2;
Sell=Close>Ref(bb,.80);

_SECTION_END();
Your help is very appreciated
Thank you
 

KelvinHand

Well-Known Member
#2
Buy=Close < Ref(bb,.20)AND Ref(C,-1)< Ref(bb,.2)-1 AND Ref(C,-2)< Ref(bb,.2)-2;
Sell=Close>Ref(bb,.80);

Thank you
These are the problems.
Close < Ref(bb,.20) ???
Close>Ref(bb,.80); ???

Look at the help for Ref( ARRAY, period ) , period must be integer, reference to past and future bars.
cannot accept .2, .8
 

mrm

New Member
#3
Thank you for reply

how do I write formula i did this
Buy=Close < bb.20 AND Ref(C,-1)< (bb,.2) AND Ref(C,-2)< (bb,.2);
Sell=Close> (bb,.80);
this have errors in formula . what i trying to write buy on close if stock close bellow .20 on bollinger band for for three days
 

Similar threads