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

[amibroker] Re: writeif in functions ?



PureBytes Links

Trading Reference Links









<span
>Hi,

<span
> 

<span
>I am new to AB (Std Version 4.56 Beta) and
I am working on porting my custom indicators and systems over from my previous
software (AIQ and MetaStock). Not being very good at programming at the best of
times, I have spent several hours trying to get the coding right to Plot custom
Trendlines using John Clayburg&#8217;s Category 3 Support/Resistance Lines. For
the Line Array function in AB I have gotten as far as getting the y0/y1/x1 co-ordinates
coding sorted but the final hurdle of &#8216;x0&#8217; has got be beat. Any
help with my coding would be greatly appreciated. The code I have written so
far is:

<span
> 

<font size=2 color="#786538"
face="Courier New">/* JOHN CLAYBURG BASED CATEGORY 3
SUPPORT/RESISTANCE LINES

<font size=2 color="#786538"
face="Courier New">      as discussed in
his book "Four Steps To Trading Success"
/*      

<font size=2 color="#786538"
face="Courier New"> 

<font size=2 color="#786538"
face="Courier New">/* CATEGORY 3 SUPPORT LINE:   */

<font size=2 color=purple
face="Courier New">LL_3_6 = <span
lang=EN-NZ >Ref<font
size=2 color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">6<font
size=2 color=purple face="Courier New">) > <font size=2
color=blue face="Courier New">Ref<font size=2
color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">3<font
size=2 color=purple face="Courier New">);

<font size=2 color=purple
face="Courier New">LL_3_5 = <span
lang=EN-NZ >Ref<font
size=2 color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">5<font
size=2 color=purple face="Courier New">) > <font size=2
color=blue face="Courier New">Ref<font size=2
color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">3<font
size=2 color=purple face="Courier New">);

<font size=2 color=purple
face="Courier New">LL_3_4 = <span
lang=EN-NZ >Ref<font
size=2 color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">4<font
size=2 color=purple face="Courier New">) > <font size=2
color=blue face="Courier New">Ref<font size=2
color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">3<font
size=2 color=purple face="Courier New">); 

<font size=2 color=purple
face="Courier New">LL_3_2 = <span
lang=EN-NZ >Ref<font
size=2 color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">2<font
size=2 color=purple face="Courier New">) > <font size=2
color=blue face="Courier New">Ref<font size=2
color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">3<font
size=2 color=purple face="Courier New">);

<font size=2 color=purple
face="Courier New">LL_3_1 = <span
lang=EN-NZ >Ref<font
size=2 color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">1<font
size=2 color=purple face="Courier New">) > <font size=2
color=blue face="Courier New">Ref<font size=2
color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">3<font
size=2 color=purple face="Courier New">);

<font size=2 color=purple
face="Courier New">LL_3_0 =     <font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">     > <font
size=2 color=blue face="Courier New">Ref<font size=2
color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">3<font
size=2 color=purple face="Courier New">);

<font size=2 color=purple
face="Courier New">Cat3Sup = LL_3_6 <font size=2 color="#009300"
face="Courier New">AND<font size=2 color=purple
face="Courier New"> LL_3_5 <font size=2 color="#009300"
face="Courier New">AND<font size=2 color=purple
face="Courier New"> LL_3_4 <font size=2 color="#009300"
face="Courier New">AND<font size=2 color=purple
face="Courier New"> LL_3_2 <font size=2 color="#009300"
face="Courier New">AND<font size=2 color=purple
face="Courier New"> LL_3_1 <font size=2 color="#009300"
face="Courier New">AND<font size=2 color=purple
face="Courier New"> LL_3_0;

<font size=2 color=purple
face="Courier New"> 

<font size=2 color="#786538"
face="Courier New">/* SUPPORT LINE ("SC")  */

<font size=2 color=purple
face="Courier New">Cat3 = <span
lang=EN-NZ >BarsSince<font
size=2 color=purple face="Courier New">(Cat3Sup)+<font
size=2 color=fuchsia face="Courier New">3<font
size=2 color=purple face="Courier New">;

<font size=2 color="#786538"
face="Courier New">//Fx0 = BarCount - 1 - Cat3 -
ValueWhen(Cat3Sup,BarsSince(Cat3Sup)+3,2); // NOT WORKING CORRECTLY

<font size=2 color=purple
face="Courier New">Fx1 = <font size=2 color="#009300"
face="Courier New">BarCount<font size=2
color=purple face="Courier New"> - <font size=2
color=fuchsia face="Courier New">1<font
size=2 color=purple face="Courier New"> - Cat3; <font size=2
color="#786538" face="Courier New">/* This gives me my
x0 co-ordinate */

<font size=2 color=purple
face="Courier New">y0=<span
lang=EN-NZ >ValueWhen<font
size=2 color=purple face="Courier New">(Cat3Sup,<font size=2
color=blue face="Courier New">Ref<font size=2
color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">3<font
size=2 color=purple face="Courier New">),<font size=2
color=fuchsia face="Courier New">2<font
size=2 color=purple face="Courier New">); 

<font size=2 color=purple
face="Courier New">y1=<span
lang=EN-NZ >ValueWhen<font
size=2 color=purple face="Courier New">(Cat3Sup,<font size=2
color=blue face="Courier New">Ref<font size=2
color=purple face="Courier New">(<font size=2
color="#009300" face="Courier New">L<font
size=2 color=purple face="Courier New">,-<font size=2
color=fuchsia face="Courier New">3<font
size=2 color=purple face="Courier New">),<font size=2
color=fuchsia face="Courier New">1<font
size=2 color=purple face="Courier New">); 

<font size=2 color="#786538"
face="Courier New">//x0=BarCount - 1 - ValueWhen(Cat3Sup,Cat3,2);
// NOT WORKING CORRECTLY

<font size=2 color=purple
face="Courier New">x1=<font size=2 color="#009300"
face="Courier New">BarCount<font size=2
color=purple face="Courier New"> - <font size=2
color=fuchsia face="Courier New">1<font
size=2 color=purple face="Courier New"> - Cat3;

<font size=2 color="#786538"
face="Courier New">//Line = LineArray( x0, y0, x1, y1, 1 ); // Pending
sorting the x0 coding out 

<font size=2 color=blue
face="Courier New">Plot<span
lang=EN-NZ >(<font
size=2 color="#009300" face="Courier New">C<font
size=2 color=purple face="Courier New">,<font size=2
color=fuchsia face="Courier New">"C"<font
size=2 color=purple face="Courier New">, <font size=2
color="#009300" face="Courier New">colorRed<font
size=2 color=purple face="Courier New">, <font size=2
color="#009300" face="Courier New">styleCandle<font
size=2 color=purple face="Courier New">); 

<font size=2 color=blue
face="Courier New">Plot<span
lang=EN-NZ >(y0,
<span
lang=EN-NZ >"Trendline Bot y0"<font size=2
color=purple face="Courier New">, <font size=2
color="#009300" face="Courier New">colorDefault<font
size=2 color=purple face="Courier New">,<font size=2
color=fuchsia face="Courier New">16<font
size=2 color=purple face="Courier New">);

<font size=2 color=blue
face="Courier New">Plot<span
lang=EN-NZ >(y1,
<span
lang=EN-NZ >"Trendline Bot y1"<font size=2
color=purple face="Courier New">, <font size=2
color="#009300" face="Courier New">colorBlue<font
size=2 color=purple face="Courier New">,<font size=2
color=fuchsia face="Courier New">1<font
size=2 color=purple face="Courier New">+<font size=2
color=fuchsia face="Courier New">4<font
size=2 color=purple face="Courier New">);

<font size=2 color="#786538"
face="Courier New">//Plot(???,"",colorDefault,16);  
// Dependent on sorting Coding on co-ordinate x0

<span
lang=EN-NZ >//Plot(Cat3,"",colorDarkGrey,16); // Working OK

<span
lang=EN-NZ > 

<span
lang=EN-NZ >TIA,

<span
> 



<span
>Regards,

<span
>
Gordon Sutherland



<font size=2
color="#cccc00" face=Verdana><img width=600 height=10 id=ridImg
src="gif00109.gif" align=bottom>







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.







Attachment: Description: ""

Attachment: Description: ""