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

[amibroker] CountBack Entry and Exit Charts in AFL Code



PureBytes Links

Trading Reference Links

Hi

The only reason I'm posting this is because I'm new at all this and 
would like some reaction as to its' usefulness, or whether I'm 
misguided!

I wanted to create Countback Entry, EntryMax and Exit lines based on 
a *selected* historical LOW or HIGH (respectively). The following 
code does it, but have I got it right?

I've learned a lot from everyone's contributions here so if it's good 
for you, take it as a thank you.

Mike

Graph #1
// Countback Entry lines

x = 1;								
CountofBars = BarCount;			
Def_bar = 1;						

Def_Low = SelectedValue(Low);			
SeekHigh = SelectedValue(High);		//grab selected values
Seek2High = SeekHigh;

BackgroundColor = colorCustom1;
HighColor = colorWhite;
LowColor = colorBlue;

// Plot the Basis price
Plot( Close, "Close", colorBlack, styleCandle );
ColorHighs = ColorLows = BackgroundColor;
ColorHighs[BarCount-1] = HighColor;
ColorLows[BarCount-1] = LowColor;


CurrentHigh = High;
HighCount = 0;
for ( CurrentBar = BarCount - 2; CurrentBar >= 0 AND HighCount < X;
--CurrentBar )
{
ColorHighs[CurrentBar] = colorWhite;
// Have we hit the next Bar with a higher axis?
if ( Low[CurrentBar] < SeekHigh AND High[CurrentBar] > SeekHigh)
{
Seek2High = High[CurrentBar];
Hold(seek2High,BarCount);
HighCount = HighCount + 1;
}
}

CurrentHigh = High;
HighCount = 0;
for ( CurrentBar = BarCount - 2; CurrentBar >= 0 AND HighCount < X;
--CurrentBar )
{
ColorHighs[CurrentBar] = colorWhite;
// Have we hit the next Bar with a higher axis?
if ( Low[CurrentBar] <= Seek2High AND High[CurrentBar] > Seek2High)
{
Plot( High[CurrentBar], "CountBack Entry", ColorHighs, styleDots );
Plot( (High[CurrentBar]+(High[CurrentBar]-Def_Low)), "CountBack Entry 
Max", ColorHighs, styleDots );
HighCount = HighCount + 1;
}
}
/*END*/


Graph #2
// Countback Exit lines

x = 1;								
CountofBars = BarCount;			
Def_bar = 1;						

SeekLow = SelectedValue(Low);			//
SeekHigh = SelectedValue(High);		//Grab Values from Chart at 
Selection
Seek2Low = SeekLow;

BackgroundColor = colorCustom1;
HighColor = colorWhite;
LowColor = colorDarkRed;

// Plot the Basis price
Plot( Close, "Close", colorBlack, styleCandle );
ColorHighs = ColorLows = BackgroundColor;
ColorHighs[BarCount-1] = HighColor;
ColorLows[BarCount-1] = LowColor;


CurrentHigh = High;
HighCount = 0;
for ( CurrentBar = BarCount - 2; CurrentBar >= 0 AND HighCount < X;
--CurrentBar )
{
ColorHighs[CurrentBar] = colorWhite;
// Have we hit the next Bar with a higher axis?
if ( Low[CurrentBar] < SeekLow AND High[CurrentBar] > SeekLow)
{
Seek2Low = Low[CurrentBar];
Hold(seek2Low,BarCount);
HighCount = HighCount + 1;
}
}

CurrentHigh = High;
HighCount = 0;
for ( CurrentBar = BarCount - 2; CurrentBar >= 0 AND HighCount < X;
--CurrentBar )
{
ColorHighs[CurrentBar] = colorWhite;
// Have we hit the next Bar with a higher axis?
if ( Low[CurrentBar] <= Seek2Low AND High[CurrentBar] > Seek2Low)
{
Plot( Low[CurrentBar], "CountBack Exit", ColorHighs, styleDots );
HighCount = HighCount + 1;
}
}


/*END*/



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/JYdFFC/XP.FAA/ySSFAA/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/