PureBytes Links
Trading Reference Links
|
dorzfn,
I've used a percentage range, this is easy to change if need be.
function UpsideBreakFromRange ( Period, DesiredRange )
{
/*
Function returns True if an upside breakout occured during
the specified PERIOD and the calculated percentage range is
less than or equal too the desired percentage range.
Input Parameters:
Period - Represents the number of bars prior to the current bar.
DesiredRange - The maximum allowable percentage range.
Output Parameters:
The function returns True if a breakout has occured within the
specified period and range, otherwise false is returned.
*/
Breakout = False;
HighestHigh = Ref( HHV( High, Period ), -1 );
LowestLow = Ref( LLV( Low, Period ), -1 );
CalcRange = ( ( HighestHigh - LowestLow ) / HighestHigh ) * 100;
Breakout = IIf( H > HighestHigh , True, False ) AND
IIf( CalcRange <= DesiredRange, True, False );
return Breakout;
}
// Buy if the price has broken out from a 3%
// 14 period trading range.
Buy = UpsideBreakFromRange( 14, 3 ) == True;
Regards,
William Peters
www.amitools.com
Wednesday, June 30, 2004, 9:07:10 AM, you wrote:
dyc> hello,
dyc> im hoping someone can help me write code for a scan i would like to
dyc> do . I'm trying to capture,in a scan, a trading rage market ,that
dyc> later breaks out to the upside. how would you write the code to
dyc> scan for the trading range part ? An example would be , in the last
dyc> 14 days the stock has moved basically sideways in say at or near a 3
dyc> pt. range. Then broke out to a new high , which i have written out
dyc> below , the breakout part of the code..
dyc> thank you in advance, phil
dyc> //tradingrange would be 7 bars back ,with in a 3 pt trading range
dyc> tradingrange = ????
breakout = High >> Ref(HHV(High,7),-1);
dyc> Buy = breakout and tradingrange ;
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|