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

RE: [amibroker] Stepping backwards in loop



PureBytes Links

Trading Reference Links

Thanks Steve, sorry have not responded before now, it is taking me some time
to go through your code and see if I can adapt it.



Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia
-----Original Message-----
From: Steve Dugas [mailto:sjdugas@xxxxxxxxxxx] 
Sent: Wednesday, 24 September 2003 2:17 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Stepping backwards in loop


Ok, here's the last one - the previous version contained some unused code
which I forgot to remove - here is the cleaned up version.

Steve


// Identifies last X higher highs and lower lows

// user-definable params
X = 3;
BackgroundColor = colorCustom1;
HighColor = colorWhite;
LowColor = colorBlue;

// rest of the code
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 < 3;
--CurrentBar )
{
 ColorHighs[CurrentBar] = colorWhite;
 if ( High[CurrentBar] > LastValue( CurrentHigh ) )
 {
  Plot( High[CurrentBar], "Higher Highs", ColorHighs, styleDots );
  CurrentHigh = High[CurrentBar];
  HighCount = HighCount + 1;
 }
}

CurrentLow = Low;
LowCount = 0;
for ( CurrentBar = BarCount - 2; CurrentBar >= 0 AND LowCount < 3;
--CurrentBar )
{
 ColorLows[CurrentBar] = colorBlue;
 if ( Low[CurrentBar] < LastValue( CurrentLow ) )
 {
  Plot( Low[CurrentBar], "Lower Lows", ColorLows, styleDots );
  CurrentLow = Low[CurrentBar];
  LowCount = LowCount + 1;
 }
}
----- Original Message ----- 
From: Graham 
To: amibroker@xxxxxxxxxxxxxxx 
Sent: Tuesday, September 23, 2003 1:08 AM
Subject: RE: [amibroker] Stepping backwards in loop


Steve
It basically looks for the previous bar with higher high, or lower low than
the current bar, and progresses back till you have the required number of
highs/lows. Eg In my example I am looking for the 3 day CBL, ie the 3rd
higher high, or lower low from the selected bar. 
Here are some web refences for it
http://trader.online.pl/MSZ/e-w-Countback_line.html
http://www.guppytraders.com/gup18.htm




Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia
-----Original Message-----
From: Steve Dugas [mailto:sjdugas@xxxxxxxxxxx] 
Sent: Tuesday, 23 September 2003 12:07 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Stepping backwards in loop


Graham,

I have heard the term Countback Line but I dont know what it does. If you
want to try describing how it works, I could maybe take a stab at it.

Steve
----- Original Message ----- 
From: Graham 
To: amibroker@xxxxxxxxxxxxxxx 
Sent: Monday, September 22, 2003 11:39 PM
Subject: RE: [amibroker] Stepping backwards in loop


Steve
Inititally it was for the 3 day count back line, but I am endeavouring to
expand on this for finding short term peaks and troughs and some other
thoughts I have for some systems once I get it working. 
When I plot it the lines start at the first occurrence of the particular low
(or high) price. Here is the whole picture of the formula I am using at the
moment as I try to get it working the way I am wanting.

// INDICATOR 
//Count Back Line 
//by Graham Kavanagh 22 Sep 2003
//
Plot(C, "Close", colorBlack, styleBar+styleNoLabel);

period = 3;
Bar = SelectedValue(BarIndex());
LastBar = LastValue(BarIndex());
start = Lastbar-bar;

LowerLow[0] = SelectedValue(L);
for ( j=1; j<=period; j++ )
{
for ( i=1 ; i < Lastbar ; i++ )
{
  if ( L[i] < LowerLow[j-1] )
  {
   LowerLow[j] = L[i];
  }
}
}
Lowerline = SelectedValue(LowerLow[period]);
BarL   = ValueWhen( L==Lowerline, BarIndex(), 1 );
CBLow  = IIf( BarIndex()>=BarL, Lowerline, Null );
Plot(CBLow, EncodeColor(colorRed)+ "3 day CB Low", colorRed, styleDots);

//Plot(SelectedValue(L), EncodeColor(colorRed)+ "Bar Low", colorRed,
styleLine);


HigherHigh[0] = SelectedValue(H);
for ( j=1; j<=period; j++ )
{
for ( i=1; i <Bar ; i++ )
{
  if ( H[i] > HigherHigh[j-1] )
  {
   HigherHigh[j] = H[i];
  }
}
}


Higherline = SelectedValue(HigherHigh[period]);
BarH   = ValueWhen( H==Higherline, BarIndex(), 1 );
CBHigh  = IIf( BarIndex()>=BarH, Higherline, Null );


//Plot(SelectedValue(H), EncodeColor(colorGreen)+ "Bar high", colorGreen,
styleLine);
Plot(CBHigh, EncodeColor(colorGreen)+ "3 day CB High", colorGreen,
styleDots);

Title = Name() + " " + Date() + " / " + BarCount + " / " + bar + " / " +
Lastbar + " ? "+ L[0] + " ? ";



Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia
-----Original Message-----
From: Steve Dugas [mailto:sjdugas@xxxxxxxxxxx] 
Sent: Tuesday, 23 September 2003 9:59 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Stepping backwards in loop


Hi Graham,

Can you tell me what you are trying to do? From looking at your code, it
appears that the only elements of LowerLow that can ever get changed are 1,
2 and 3.

Steve
----- Original Message ----- 
From: Graham 
To: AB yahoo group 
Sent: Monday, September 22, 2003 8:58 PM
Subject: [amibroker] Stepping backwards in loop


I have this formula in a loop but it steps through the values from the
beginning of the data rather than from the end. 
I have tried reversing the line " for ( i=1; i < bar ; i++ ) " to  " for (
i=bar; i > 0 ; i-- ) " but stills seems to check the bars in the forward
direction. 
All I want to do is go back from the selected (or last) bar. 
Help appreciated. 

period = 3;
Bar = SelectedValue(BarIndex());
LastBar = LastValue(BarIndex());
start = Lastbar-bar;

LowerLow[0] = SelectedValue(L);
for ( j=1; j<=period; j++ )
{
for ( i=1; i < bar ; i++ )
{
  if ( L[i] < LowerLow[j-1] )
  {
   LowerLow[j] = L[i];
  }
}
}

Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia



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 the Yahoo! Terms of Service. 


Yahoo! Groups Sponsor
ADVERTISEMENT




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 the Yahoo! Terms of Service. 



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 the Yahoo! Terms of Service. 


Yahoo! Groups Sponsor
ADVERTISEMENT




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 the Yahoo! Terms of Service. 



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 the Yahoo! Terms of Service. 


Yahoo! Groups Sponsor
ADVERTISEMENT




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 the Yahoo! Terms of Service. 


------------------------ 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/mOAaAA/3exGAA/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/