[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] simplest way to detect a reversal of direction in an indicator



PureBytes Links

Trading Reference Links

hi CS, thanks for replying.

you're detecting crossings 4% down from the highest value occurring within
the last 14 periods, right? that makes some sense in this specific case,
since the indicator we're examining is MA(14), but I think not in the
general case.

we really want crossings 4% down from the highest value since the last
crossing in the opposite direction (4% above the lowest value since the last
downward crossing). you noticed the declining peaks issue, which is one
symptom that your idea is in the right direction, but not exactly right.

funny how this is so easy to see on a visual chart, but for the life of me
I'm not seeing any AFL approach besides iterating through every bar.

dave


> Lets say that I want to trigger a sell when a moving average (or any
> indicator) has fallen 4% from its recent peak...
>
> A1=MA(C,14);
> Z1=ValueWhen(Cross(HHV(A1,14),A1),A1);
> S1= Cross(Z1-(Z1*0.04),A1);
> Plot(C,"Close",colorBlue,1);
> Plot(A1,"MA",colorRed,1);//our indicator
> Plot(S1,"S1",colorGreen,1|styleOwnScale);//4% fall Trigger Signal
> Plot(Z1,"last peak",colorLightBlue,1);//shows where our last peak was at
>
> This isn't the only way and this way has problems if there is a series of
> declining peaks.
>
> -CS
>
> what's the simplest way to detect a change of direction in some
> indicator by
> more than a certain amount? it's easy to see on a chart, you just look for
> peaks, and find the places where the indicator has moved the
> required amount from there.
>
> I have a working version that requires crossing an absolute level first,
> before the change in direction will be honored. that's doable because you
> can use HighestSince(AbsoluteLevelCrossed), but I can't see how to build a
> similar thing without that absolute level crossover. what you
> really mean is
> HighestSince(CrossoverInTheOppositeDirection), but that makes the
> level your
> looking for dependant on the crossovers that came before it.
>
> you could step through the indicator array one bar at a time to
> do this, but it seems like there's got to be a better way.


------------------------ 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/