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

RE: [amibroker] Re: #Pragma NoCache



PureBytes Links

Trading Reference Links




Try putting your 
LineArray & Plot calls in a for loop after you've calculated the x,y arrays 
and after you've plotted the price histogram.
I've changed the 
'extend' so it's dependent on how close to the right edge 
you are.
If you have 
'extend' = 1 all the time the indicator becomes unreadable because old plot 
lines extend far above & below the price chart.<FONT 
color=#008000>
 
/* JOHN CLAYBURG BASED 
SUPPORT/RESISTANCE LINES
  Coded by GBS May 
2004
/* CATEGORY 3 SUPPORT 
BREAKOUT TRIGGER FOR SHORTS: */
 
LL_3_6 = 
Ref(L,-6) > Ref(L,-3);
LL_3_5 = 
Ref(L,-5) > Ref(L,-3);
LL_3_4 = 
Ref(L,-4) > Ref(L,-3); 
LL_3_2 = 
Ref(L,-2) > Ref(L,-3);
LL_3_1 = 
Ref(L,-1) > Ref(L,-3);
LL_3_0 = L > 
Ref(L,-3);
 
Cat3Sup = LL_3_6 
AND LL_3_5 AND LL_3_4 AND LL_3_2 AND LL_3_1 
AND LL_3_0;
 
/* SUPPORT LINE ("SC") */
 
Cat3 = 
ValueWhen(Cat3Sup,BarIndex(),1)-3;
<FONT face=Arial color=#000000 
size=2>y0=ValueWhen(Cat3Sup,Ref(L,-3),2); 
<FONT face=Arial color=#000000 
size=2>y1=ValueWhen(Cat3Sup,Ref(L,-3),1); 
<FONT face=Arial color=#000000 
size=2>x0=ValueWhen(Cat3Sup,BarIndex(),2)-3;
<FONT face=Arial color=#000000 
size=2>x1=ValueWhen(Cat3Sup,BarIndex(),1)-3;
 
Plot(y0, 
"Trendline Bot y0", 
colorDefault,styleNoLine+styleOwnScale);
Plot<FONT 
face=Arial>(y1, "Trendline Bot y1", 
colorBlue,styleNoLine+styleOwnScale);<FONT 
color=#0000ff>
<FONT face=Arial 
size=2>Plot<FONT 
size=2>(x0,"x0",colorDefault,styleNoLine+styleOwnScale); 
//test only to check for correct bar 
value
<FONT face=Arial 
size=2>Plot<FONT 
size=2>(x1,"x1",colorDarkGrey,styleNoLine+styleOwnScale); 
//test only to check for correct bar 
value
<FONT face=Arial 
size=2>Plot<FONT 
size=2>(BarIndex(),"BarIndex()",colorDefault,styleNoLine+styleOwnScale); 
//test only to check for correct bar 
value
<FONT face=Arial 
color=#000000 size=2><FONT face=Arial color=#000000 
size=2><FONT face=Arial 
size=2> 
Plot<FONT 
face=Arial>(C,"C", colorRed, styleCandle); 

<FONT face=Arial color=#000000 
size=2><FONT face=Arial color=#000000 
size=2><FONT face=Arial color=#000000 
size=2><FONT face=Arial 
size=2> 
<FONT face=Arial 
size=2>for ( i = 7 ; i < 
BarCount ; i++ ) {
  if 
( x0[i] != x0[i-1] ) {
<FONT 
color=#000000>    if ( i > BarCount - 50 ) 

<FONT 
color=#000000>      extend = 
1;
<FONT face=Arial color=#000000 
size=2>    else
<FONT 
color=#000000>      extend = 
0;
<FONT 
color=#000000>    Line = LineArray( 
x0[i], y0[i], x1[i], y1[i],extend,True); 

<FONT 
color=#000000>    Plot(Line,"Cat3Sup 
Line",colorDefault,styleLine);
  
}
<FONT face=Arial color=#000000 
size=2>}
----- Original Message ----- 
<BLOCKQUOTE dir=ltr 
>
  <DIV 
  >From: 
  Gordon 
  Sutherland 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Saturday, May 22, 2004 2:27 
AM
  Subject: RE: [amibroker] Re: Help with 
  Line Array Coding for Clayburg
  <FONT 
  face=Arial size=2>
  
  <SPAN 
  >Hi Graham,
  <SPAN 
  > 
  <SPAN 
  >Thanks for prompt 
  response.
  <SPAN 
  > 
  <SPAN 
  >I have changed my code as per your 
  suggestions with the caveat that I have changed the “+3” to “-3” because you 
  are computing from the start rather than the end of the data. The values for 
  the four co-ordinates seem to be correct when I plot them before applying the 
  LineArray function. However, when I activate the LineArray function 
   (‘Line’)  then  a warning pops-up “Error 2. Bad Argument(s)”. 
  I have the QuickAFL™ switched on but it makes no difference if I turn this 
  feature off!
  <SPAN 
  > 
  <SPAN 
  >The revised code is submitted below. I 
  would appreciate any help as to what I am doing wrong that will not accept the 
  code for AutoPlot.
  <SPAN 
  > 
  <SPAN lang=EN-NZ 
  >/* JOHN CLAYBURG BASED 
  SUPPORT/RESISTANCE LINES
  <SPAN lang=EN-NZ 
  >      
         Coded by GBS May 2004
  <SPAN lang=EN-NZ 
  > 
  <SPAN lang=EN-NZ 
  >/* CATEGORY 3 SUPPORT 
  BREAKOUT TRIGGER FOR SHORTS:    */
  <SPAN lang=EN-NZ 
  >LL_3_6 = Ref(L,-6) > 
  Ref(L,-3);
  <SPAN lang=EN-NZ 
  >LL_3_5 = Ref(L,-5) > 
  Ref(L,-3);
  <SPAN lang=EN-NZ 
  >LL_3_4 = Ref(L,-4) > 
  Ref(L,-3); 
  <SPAN lang=EN-NZ 
  >LL_3_2 = Ref(L,-2) > 
  Ref(L,-3);
  <SPAN lang=EN-NZ 
  >LL_3_1 = Ref(L,-1) > 
  Ref(L,-3);
  <SPAN lang=EN-NZ 
  >LL_3_0 
  =     L     > 
  Ref(L,-3);
  <SPAN lang=EN-NZ 
  >Cat3Sup = LL_3_6 AND 
  LL_3_5 AND LL_3_4 AND LL_3_2 AND LL_3_1 AND LL_3_0;
  <SPAN lang=EN-NZ 
  > 
  <SPAN lang=EN-NZ 
  >/* SUPPORT LINE 
  ("SC")  */
  <SPAN lang=EN-NZ 
  >Cat3 = 
  ValueWhen(Cat3Sup,BarIndex(),1)-3;
  <SPAN lang=EN-NZ 
  >y0=ValueWhen(Cat3Sup,Ref(L,-3),2); 
  
  <SPAN lang=EN-NZ 
  >y1=ValueWhen(Cat3Sup,Ref(L,-3),1); 
  
  <SPAN lang=EN-NZ 
  >x0=ValueWhen(Cat3Sup,BarIndex(),2)-3;
  <SPAN lang=EN-NZ 
  >x1=ValueWhen(Cat3Sup,BarIndex(),1)-3;
  <SPAN lang=EN-NZ 
  >//Line = LineArray( x0, 
  y0, x1, y1, 1); // Warning comes up "Error 2 - Bad 
  Argument(s)"
  <SPAN lang=EN-NZ 
  >//Plot(Line,"Cat3Sup 
  Line",colorDefault,1);// Dependent on "Line = LineArray..." not 
  working
  <SPAN lang=EN-NZ 
  > 
  <SPAN lang=EN-NZ 
  >Plot(C,"C", colorRed, 
  styleCandle); 
  <SPAN lang=EN-NZ 
  >Plot(y0, "Trendline Bot 
  y0", colorDefault,16);
  <SPAN lang=EN-NZ 
  >Plot(y1, "Trendline Bot 
  y1", colorBlue,1+4);
  <SPAN lang=EN-NZ 
  >Plot(x0,"x0",colorDefault,16);      
  //test only to check for correct bar value
  <SPAN lang=EN-NZ 
  >Plot(x1,"x1",colorDarkGrey,16);  
  //test only to check for correct bar value
  <SPAN lang=EN-NZ 
  >Plot(BarIndex(),"BarIndex()",colorDefault,16); 
  //test only to check for correct bar value
  
  <SPAN 
  > 
  <SPAN 
  >Regards,
  <SPAN 
  ><FONT 
  color=green>Gordon 
  Sutherland
  <SPAN 
  > 
  <SPAN 
  >-----Original 
  Message-----From: Graham 
  [mailto:gkavanagh@xxxxxxxxxxxxx] <SPAN 
  >Sent: Saturday, 22 May 2004 4:27 
  p.m.To: 
  amibroker@xxxxxxxxxxxxxxx<SPAN 
  >Subject: RE: [amibroker] Re: Help with 
  Line Array Coding for Clayburg
  <FONT face="Times New Roman" 
  size=3> 
  <FONT face="Courier New" 
  size=2>Tired to sort out what you were doing, 
  does this help you at least<FONT face="Courier New" 
  size=2><FONT 
  face="Courier New">alternative way of doing it?<FONT 
  face="Courier New">Cat3 = 
  Valuewhen(Cat3Sup,barindex(),1)+3;<FONT 
  face="Courier New">x0 = 
  Valuewhen(Cat3Sup,barindex(),2)+3;<FONT 
  face="Courier New">Cheers,<FONT 
  face="Courier New">Graham<A 
  href="">http://e-wire.net.au/~eb_kavan/ 
  -----Original 
  Message-----From: Gordon 
  Sutherland [mailto:gosuth@xxxxxxxxxx] <FONT 
  face="Courier New">Sent: Saturday, May 22, 2004 12:09 
  PMTo: 
  amibroker@xxxxxxxxxxxxxxxSubject: 
  [amibroker] Re: Help with Line Array Coding for 
  Clayburg<FONT 
  face="Courier New">Hi,<FONT 
  face="Courier New"> I am new 
  to AB (Std Version 4.56 Beta) and I am working on porting my 
  customindicators and systems over 
  from my previous software (AIQ and MetaStock).<FONT 
  face="Courier New">Not being very good at programming at the best of times, I 
  have spentseveral hours trying to 
  get the coding right to Plot custom Trendlines using<FONT 
  face="Courier New">John Clayburg’s Category 3 Support/Resistance Lines. For 
  the Line Arrayfunction in AB I 
  have gotten as far as getting the y0/y1/x1 
  co-ordinatescoding sorted but the 
  final hurdle of ‘x0’ has got be beat. Any help with 
  mycoding would be greatly 
  appreciated. The code I have written so far is:<FONT 
  face="Courier New"> /* JOHN 
  CLAYBURG BASED CATEGORY 3 SUPPORT/RESISTANCE LINES<FONT 
  face="Courier New">      as discussed in his book 
  "Four Steps To Trading Success" /*      
   <FONT 
  face="Courier New">/* CATEGORY 3 SUPPORT LINE:   
  */LL_3_6 = Ref(L,-6) > 
  Ref(L,-3);LL_3_5 = Ref(L,-5) > 
  Ref(L,-3);LL_3_4 = Ref(L,-4) > 
  Ref(L,-3); LL_3_2 = Ref(L,-2) 
  > Ref(L,-3);LL_3_1 = Ref(L,-1) 
  > Ref(L,-3);LL_3_0 
  =     L     > 
  Ref(L,-3);Cat3Sup = LL_3_6 AND 
  LL_3_5 AND LL_3_4 AND LL_3_2 AND LL_3_1 AND LL_3_0;<FONT 
  face="Courier New"> /* 
  SUPPORT LINE ("SC")  */Cat3 
  = BarsSince(Cat3Sup)+3;//Fx0 = 
  BarCount - 1 - Cat3 - ValueWhen(Cat3Sup,BarsSince(Cat3Sup)+3,2); 
  //NOT WORKING 
  CORRECTLYFx1 = BarCount - 1 - 
  Cat3; /* This gives me my x0 co-ordinate */<FONT 
  face="Courier New">y0=ValueWhen(Cat3Sup,Ref(L,-3),2); 
  <FONT 
  face="Courier New">y1=ValueWhen(Cat3Sup,Ref(L,-3),1); 
  //x0=BarCount - 1 - 
  ValueWhen(Cat3Sup,Cat3,2); // NOT WORKING CORRECTLY<FONT 
  face="Courier New">x1=BarCount - 1 - Cat3;<FONT 
  face="Courier New">//Line = LineArray( x0, y0, x1, y1, 1 ); // Pending sorting 
  the x0 codingout 
  Plot(C,"C", colorRed, 
  styleCandle); Plot(y0, "Trendline 
  Bot y0", colorDefault,16);<FONT 
  face="Courier New">Plot(y1, "Trendline Bot y1", 
  colorBlue,1+4);<FONT 
  face="Courier New">//Plot(???,"",colorDefault,16);   // Dependent on 
  sorting Coding onco-ordinate 
  x0<FONT 
  face="Courier New">//Plot(Cat3,"",colorDarkGrey,16); // Working 
  OK <FONT 
  face="Courier New">TIA,<FONT 
  face="Courier New"> <FONT 
  face="Courier New">Regards,<FONT 
  face="Courier New">Gordon Sutherland<FONT 
  face="Courier New">Send BUG REPORTS to 
  bugs@xxxxxxxxxxxxxSend 
  SUGGESTIONS to suggest@xxxxxxxxxxxxx<FONT 
  face="Courier New">-----------------------------------------<FONT 
  face="Courier New">Post AmiQuote-related messages ONLY to: 
  amiquote@xxxxxxxxxxxxxxx (Web 
  page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
  face="Courier New">--------------------------------------------<FONT 
  face="Courier New">Check group FAQ at:<FONT 
  face="Courier New"><A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Yahoo! Groups 
  Sponsor<FONT 
  face="Courier New">ADVERTISEMENT<FONT 
  face="Courier New">Yahoo! Groups Links<FONT 
  face="Courier New">• To visit your group on the web, go 
  to:<A 
  href="">http://groups.yahoo.com/group/amibroker/<FONT 
  face="Courier New">  • To 
  unsubscribe from this group, send an email to:<FONT 
  face="Courier New">amibroker-unsubscribe@xxxxxxxxxxxxxxx<FONT 
  face="Courier New">  • Your 
  use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
  <FONT face="Courier New" 
  size=2>Send BUG REPORTS to 
  bugs@xxxxxxxxxxxxx<SPAN 
  ><FONT 
  face="Courier New">Send SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx<FONT 
  face="Courier New">-----------------------------------------<FONT 
  face="Courier New">Post AmiQuote-related messages ONLY to: 
  amiquote@xxxxxxxxxxxxxxx (Web 
  page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
  face="Courier New">--------------------------------------------<FONT 
  face="Courier New">Check group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 
  SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  


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








Yahoo! Groups Sponsor


  ADVERTISEMENT 












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