PureBytes Links
Trading Reference Links
|
As for the loopless AFL code, you may have in IB the
f=StochD();Plot(f,"f",1,8);
thresDown=10;
Cond1=Ref(f,-1)==HHV(f,3);Cond2=Ref(f,-1)==LLV(f,3);
x=ValueWhen(Ref(Cond1,1),f);
y=Cross(x-thresDown,f);
thresUp=20;
xx=ValueWhen(Ref(Cond2,1),f);
yy=Cross(f,xx+thresUp);
y=ExRem(y,yy);yy=ExRem(yy,y);
PlotShapes(shapeDownArrow*y,colorRed);
PlotShapes(shapeUpArrow*yy,colorBrightGreen);
It is closely connected to the last visible peak(trough).
If some previous peak(trough) failed to meet the requirement, it is
ignored, as soon as the next trough(peak) appears.
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
wrote:
> Dave,
> Now I see, you donīt need to be 10 below a conditional [ie
> significant] peak, you just want to be 10 below the nearest local
> [unconditional] peak.
> For conditional peaks/troughs you may see #17601.
> Dimitris Tsokakis
> --- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
> wrote:
> > thanks for looking; replies below.
> >
> > > a. You consider absolute threshold values. It is almost
useless,
> you
> > > should take percentage.
> > > A threshold = 10 would give hundreds of signals for NDX values
and
> > > rare signals for CSCO or no signal for a stock below 10$. NDX
> would
> > > need a threshold=100, which would never give any signal for
MSFT.
> >
> > I think you're assuming that the input to this function is a
stock
> price. I
> > was thinking it would be an indicator, something like MAM, RSI,
> RSIStoch,
> > CCI, MTI etc.. you're still correct that with some indicators, a
> percentage
> > change would make more sense, but some are more like linear. for
> instance,
> > you'd want to look for 10 unit changes in CCI, not a 10% change.
> >
> >
> > > b. In your
> > >
> > > tracking = 0; // last peak we're comparing to
> > > action = 0; // last action taken; +1 = up, -1 =
down
> > > > result[0] = 0;
> > > > for(i = 1; i < BarCount; i++)
> > > > {
> > > > result[i] = 0; // default output for this
bar if no
> > > move
> > > > if(action != 1) // looking for a rise
> > >
> > > you begin, in the second line, define action=0.
> > > Then, without any other "action" reference, you ask
> > > if(action != 1)
> > > But, of course "action" is still =0 from the 2nd line and is not
> > > equal to 1.
> >
> > notice the 'for' loop, which iterates for every bar. action gets
set
> > initially at the top of the function, outside the loop, meaning
> that no
> > action has taken place yet. then the loop goes through each bar,
> possibly
> > setting an action value if a threshold has been hit. the test
> you're talking
> > about is inside the loop, reacting to the last action set: if we
> last did an
> > up move, we're looking for a down move next; if we last went
down,
> we're
> > looking for an up.
> >
> > make sense? try running it with MAM as an input, for instance.
> >
> >
> > > From your description :"...single bar that's at least the
> threshold
> > > amount greater than the minimum value seen...", if we agree to
> > > change the "amount" with "percentage", I have a solution,
posted
> long
> > > time ago, the "realistic peak condition" and, instead of
> searching, I
> > > may repost it.
> > > I can detect the point which is 3% lower than the last "visible"
> > > peak. If it is what you search, please let me know and I will
> revert.
> > > Dimitris Tsokakis
> >
> > I'd say that both percentage and simple level conditions would be
> valuable,
> > so yes, please, point me at your realistic peak function.
> >
> > I'm still surprised that it seems difficult to build these kinds
of
> things
> > in AFL. I think my code does work, but I expected a simpler,
array
> function
> > version to have appeared by now.
> >
> > btw, that's not a criticism of you or anyone else here. every
> language has
> > things you can express really easily and quickly and ones you
> can't. I guess
> > this is one of those not-so-easy combinations.
> >
> > thanks again, keep in touch,
> >
> > dave
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|