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

Re: [amibroker] Re: Tomasz Gartley 222 code help-Challenge



PureBytes Links

Trading Reference Links

Hello,

Why don't you want to use Stephane DLL ?
Also trend line drawing could be implemented as show in the newsletter
http://www.amibroker.com/newsletter/04-2000.html

Third option is to use AmiBroker's user-definable funcitons,
an example of DrawLine( startbar, starty, endbar, endy )
funciton is given below:

SetBarsRequired( 10000, 10000 );

procedure DrawLine( startbar, starty, endbar, endy, Color )
{
  Line = Null; //initialize

  for( i = startbar; i <= endbar && i < BarCount; i++ )
  {
   Line[ i ] = starty + ( i - startbar ) * ( endy - starty )/(endbar - startbar );
  }

  Plot( Line, "", Color );
}

Plot( Close, "Price", colorBlack, styleCandle );
DrawLine( 4, Low[ 4 ], 50, High[ 50 ], colorBlue ); // plots line from Low of bar 4 to High of bar 50



Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "aff392" <aff392@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, July 25, 2003 10:05 PM
Subject: [amibroker] Re: Tomasz Gartley 222 code help-Challenge


>
> Tomasz,
>
> Not sure if you read Active Trader or not but could AmiBroker
> be coded as discussed in the August issue article for Gartley 222
> patterns with charting capability.  Seems that the only feature
> missing is some kind of Line Drawing function similar to Stephane
> scTrendline DLL.  Are their any functions that are available or
> comming soon that provide a drawline function that was used in the
> Wealth-Lab code as shown at
> http://www.activetradermag.com/code.htm#aug03
>
> I Would like to program the Gartley code via AmiBroker.
>
> Should I Submit suggestion at Amibroker Home page?
>
> Thanks for any consideration or direction.
>
> Art Fitz
>
> --- In amibroker@xxxxxxxxxxxxxxx, "aff392" <aff392@xxxx> wrote:
> > In the August Issue of Active Trader (p.38) Arron Behle and Mark
> > Conway quantify the makeup of a Gartley 222 pattern and provide a
> > trading system with charting capability via
> > Wealth-lab and Tradestation code at
> > http://www.activetradermag.com/code.htm#aug03
> >
> > I've been trying to convert the wealthlab version into AB code
> > without much success (I am not a programmer).  I removed or
> > commented out the buy, sell etc portions from the code to make it
> > easier to convert just the Indicator portion into AmiBroker code
> and
> > am at a stand still with the following:
> >
> > Has anyone else tried to convert this code to AB or provide any
> help
> > to finish/correct what I've started/massacred.
> >
> > TIA.
> > Art Fitz
> >
> > // conversion TRY starts here
> > GraphXSpace=5;
> > VPFactor=Param("VPFactor",2.0,1,10,1);
> > Tolerance=Param("Tolerance",0.1,0.1,2,0.1);
> > Lookback=Param("Lookback",20,10,40,1);
> > HoldBars=Param("HoldBars",7,1,20,1);
> > VolMin=Param("VolMin",100000,50000,1000000,25000);
> >
> > //Fibonacci Constants
> > F1= 0.618;
> > F2= 0.786;
> > F3= 1.27;
> > F4= 1.618;
> >
> > Bar=Param("Bar",10,0,1000,1);
> > ATRValue = ATR(Lookback);
> > VP = 100 * ATRValue / Ref(C,-Bar);
> >
> > //Find peaks AND troughs
> >
> > P1=Peak( High,Bar, 1);
> > P1Bar=PeakBars(High,Bar,1);
> > P2=Peak( High,Bar, 2);
> > P2Bar=PeakBars(High,Bar,2);
> > T1=Trough(Low,5,1);
> > T1Bar=TroughBars(Close,5,1);
> > T2=Trough(Low,5,2);
> > T2Bar=TroughBars(Close,5,2);
> >
> > //Test for a bullish 222}
> > //Trough X is T2}
> > //Peak A is P2}
> > //Trough B is T1}
> > //Peak C is P1}
> > //D is the Buy zone}
> > D = Ref(L,-Bar);
> > PTValid = (P1Bar > T1Bar) AND (T1Bar > P2Bar) AND (P2Bar > T2Bar);
> > HLValid = (P1 < P2) AND (T1 > T2) AND (P1 > T1);
> > InZone = (D < T1) AND (D > T2);
> >
> > //if (MarketPosition = 0) AND
> > //(SMA(Bar, #Volume, Lookback) >= VolMin) AND
> > //(PTValid) AND (HLValid) AND (InZone) then
> > //begin
> > XA = P2 - T2;
> > AB = P2 - T1;
> > BC = P1 - T1;
> > XD = P2 - (F2 * XA);
> > CD = P1 - XD;
> > AD = P2 - XD;
> > ABdXA = AB / XA; //AB should be 61.8% of XA}
> > C1 = (ABdXA > F1 - Tolerance) AND (ABdXA < F1 + Tolerance);
> > BCdAB = BC / AB; //BC should be 61.8-78.6% of AB}
> > C2 = (BCdAB > F1 - Tolerance) AND (BCdAB < F2 + Tolerance);
> > CDdBC = CD / BC; //CD should be 127-161.8% of BC}
> > C3 = (CDdBC > F3 - Tolerance) AND (CDdBC < F4 + Tolerance);
> > ADdXA = AD / XA; //AD should be 78.6% of XA}
> > C4 = (ADdXA > F2 - Tolerance) AND (ADdXA < F2 + Tolerance);
> >
> > Plot(C,"", colorBlack,styleCandle+styleNoLabel);
> >
> > /* HOW TO CONVERT SOMETHING LIKE THIS:
> > if C1 and C2 and C3 and C4 then
> > begin
> > DrawLine(P2Bar, P2, T2Bar, T2, 0, #Blue, #Solid);
> > DrawLine(T1Bar, T1, P2Bar, P2, 0, #Blue, #Solid);
> > DrawLine(P1Bar, P1, T1Bar, T1, 0, #Blue, #Solid);
> > DrawLine(Bar, D, P1Bar, P1, 0, #Blue, #Solid);
> > DrawLine(Bar, D, T1Bar, T1, 0, #Blue, #Dotted);
> > DrawLine(Bar, D, T2Bar, T2, 0, #Blue, #Dotted);
> >
> > */
> > //TO SOMETHING LIKE THIS FOR EACH LINE OF GARTLEY 222:
> > IIf((C1 AND C2 AND C3 AND C4 AND (PTValid) AND (HLValid) AND
> > (InZone)),Plot(scTrendLine(P2,T2,P2Bar,T2Bar),"",4),0);
> >
> >
> >
> >
> > //Test for a bearish 222}
> > //Peak X is P2}
> > //Trough A is T2}
> > //Peak B is P1}
> > //Trough C is T1}
> > //D is the Short zone}
> > D = Ref(H,-Bar);
> > PTValid = (T1Bar > P1Bar) AND (P1Bar > T2Bar) AND (T2Bar > P2Bar);
> > HLValid = (T1 > T2) AND (P1 < P2) AND (T1 < P1);
> > InZone = (D > P1) AND (D < P2);
> > //if (MarketPosition = 0) AND
> > //(PriceClose( Bar ) >= 5) AND
> > //(SMA(Bar, #Volume, Lookback) >= VolMin) AND
> > //(PTValid) AND (HLValid) AND (InZone) then
> > //begin
> > XA = P2 - T2;
> > AB = P1 - T2;
> > BC = P1 - T1;
> > XD = T2 + (F2 * XA);
> > CD = XD - T1;
> > AD = XD - T2;
> > ABdXA = AB / XA; //AB should be 61.8% of XA}
> > C1 = (ABdXA > F1 - Tolerance) AND (ABdXA < F1 + Tolerance);
> > BCdAB = BC / AB; //BC should be 61.8-78.6% of AB}
> > C2 = (BCdAB > F1 - Tolerance) AND (BCdAB < F2 + Tolerance);
> > CDdBC = CD / BC; //CD should be 127-161.8% of BC}
> > C3 = (CDdBC > F3 - Tolerance) AND (CDdBC < F4 + Tolerance);
> > ADdXA = AD / XA; //AD should be 78.6% of XA}
> > C4 = (ADdXA > F2 - Tolerance) AND (ADdXA < F2 + Tolerance);
> >
> > /* HOW TO CONVERT SOMETHING LIKE THIS:
> > if C1 and C2 and C3 and C4 then
> > begin
> > DrawLine(T2Bar, T2, P2Bar, P2, 0, #Red, #Solid);
> > DrawLine(P1Bar, P1, T2Bar, T2, 0, #Red, #Solid);
> > DrawLine(T1Bar, T1, P1Bar, P1, 0, #Red, #Solid);
> > DrawLine(Bar, D, T1Bar, T1, 0, #Red, #Solid);
> > DrawLine(Bar, D, P1Bar, P1, 0, #Red, #Dotted);
> > DrawLine(Bar, D, P2Bar, P2, 0, #Red, #Dotted);
> >
> > */
> > //TO SOMETHING LIKE THIS FOR EACH LINE OF GARTLEY 222:
> > IIf((C1 AND C2 AND C3 AND C4 AND (PTValid) AND (HLValid) AND
> > (InZone)),Plot(scTrendLine(T2,P2,T2Bar,P2Bar),"",4),0);
>
>
>
> 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/
>
>
>


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges & Refill Kits for Your Epson at Myinks.com
Free shipping on orders $50 or more to the US and Canada.
http://www.c1tracking.com/l.asp?cid=5705&lp=home/epson.asp
http://us.click.yahoo.com/brYXfA/_xWGAA/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/