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

[amibroker] Re: TD Lines - Clarification



PureBytes Links

Trading Reference Links

Hi,

Iam getting this error, please help !


Purshotam K 




Line 58, Column 11:
 j = j - 1;

 }

 dLine = IIf(CountLo<2 OR pplo[j]>plo[i],Null,

 LineArray(
----------^

Error 23.
Syntax error













--- In amibroker@xxxxxxxxxxxxxxx, "epintoem" <epintoem@xxxx> wrote:
> --- In amibroker@xxxxxxxxxxxxxxx, "Bill Barnard" <wbarnard@xxxx> 
> wrote:
> > Martin,
> > 
> > Thanks for starting this topic. I have been following the work 
you 
> > and other have been doing on the TD lines with great interest. 
It 
> > prompted me to reread DeMark (about six times on the first 
> chapter). 
> > I have concluded that the requirement that a line be questioned 
or 
> > invalidated if the close following the pivot violates the line 
> > pertains more to his technique of projecting price peaks or 
valleys 
> > after a break of the line than to generating timely buy or sell 
> > signals. It appears to me that incorporating that condition 
delays 
> > the signals, so I have not included it in my version of the 
code. I 
> > have added several things to the code you and others have 
posted; 
> > particularly, a lot of loops designed to generate all the 
signals 
> > needed for back testing. Following is my code.
> > 
> > Bill
> > 
> > //---------------------------------------------------------------
> > 
> >    /*  DeMark's Demand and Supply Line Trading System - 
> >        Original code by marmal417, Johsun, Dimitris Tsokakis 
> >        with variations by Bill Barnard, 2/18/04.  
> >        The numerous loops make for a slow calculation
> >        when the stock of interest has more than two
> >        or three years of data. Suggest making short-lived 
> >        duplicates of stocks to be studied.	
> >        Colors set for use with black background    */
> > 
> > // Following line allows changing the number of days which
> > // must preceed a pivot. "equal" allows a pivot which is 
> > // equal in value to the preceeding day.
> > rules 	  = Param("1-1day, 2-Equal, 3-3day", 2,1,3,1);
> > // Following line allows the use of DeMark's three
> > // qualifiers for a legitimate breakout.
> > Q_On 	  = Param("Use Qualifier", 0,0,1,1); 
> > extension = 20;
> > 
> > Plot(C,"",colorWhite,styleCandle);
> > 
> > prevLow      = IIf(Ref(L,-1)<Ref(C,-2), Ref(L,-1), Ref(C,-2));
> > prevHigh     = IIf(Ref(H,-1)>Ref(C,-2), Ref(H,-1), Ref(C,-2));
> > 
> > pivothigh    = IIf(rules==1, prevHigh<H AND H>Ref(H,1), 
> > 	        IIf(rules==2, prevHigh<=H AND H>Ref(H,1),
> > 		IIf(rules==3, Ref(C,-3)<H AND Ref(H,-2)<H AND 
> > 		Ref(H,-1)<H AND H>=Ref(H,1), 0)));
> > pivotlow     = IIf(rules==1, prevLow>L AND L<Ref(L,1), 
> > 		IIf(rules==2, prevLow>=L AND L<Ref(L,1),
> > 		IIf(rules==3, Ref(C,-3)>L AND Ref(L,-2)>L AND 
> > 		Ref(L,-1)>L AND L<=Ref(L,1), 0)));
> > 
> > // Following section loops through the data to develop 
> > // all the buy/sell points for back testing purposes
> > pLo 	= IIf(pivotLow==1, L, 1000000);
> > pHi 	= IIf(pivotHigh==1, H, 0);
> > By = 0; Sel = 0;
> > CountHi = 0; CountLo = 0; 
> > 
> > for (i=3; i<BarCount; i++) 
> > {
> >    if (plo[i]<1000000) 
> >    {
> >       CountLo = CountLo + 1;
> >       j = i;
> >       while (plo[j-0]>=plo[i] AND j>2)
> >       {
> >          pplo[j-1] = plo[j-1];
> >          j = j - 1;
> >       }
> >       dLine  = IIf(CountLo<2 OR pplo[j]>plo[i],Null,
> > 		LineArray(j,pplo[j],i,plo[i],1));
> >       exit = 0;
> >       for (k = i+2; exit==0 AND k<BarCount; k++) 
> >       {
> >          SellQualifier = IIf(Q_On, C[k-1]>C[k-2] OR (2*C[k-1] - 
> > 			 IIf(H[k-1]<C[k-2], C[k-2], H[k-1])) > 
> > 			 dLine[k-1] OR O[k] < dLine[k], 1);
> > 	 if (L[k]<dLine[k] AND SellQualifier) 
> >          {
> >             Sel[k] = 1;
> >             exit = 1;
> >             for (m=k+1; m<BarCount; m++)    
> >             {
> >                Sel[m] = 0;
> >             }
> >          }
> >       }
> >    }
> > 
> >    if (phi[i]>0) 
> >    {
> >       CountHi = CountHi + 1;
> >       j = i;
> >       while (phi[j-0]<=phi[i] AND j>2)
> >       {
> >          pphi[j-1] = phi[j-1];
> >          j = j - 1;
> >       }
> >       sLine = IIf(CountHi<2 OR pphi[j]<phi[i],Null,
> > 		LineArray(j,pphi[j],i,phi[i],1));
> >       exit = 0;
> >       for (k = i+2; exit==0 AND k<BarCount; k++) 
> >       {
> >          BuyQualifier = IIf(Q_On, C[k-1]<C[k-2] OR (2*C[k-1] - 
> > 			IIf(L[k-1]>C[k-2], C[k-2], L[k-1])) < 
> > 			sLine[k-1] OR O[k] > sLine[k], 1);
> >          if (H[k]>sLine[k] AND BuyQualifier)
> >          {
> >             By[k] = 1;
> >             exit = 1;
> >             for (m=k+1; m<BarCount; m++)    
> >             {
> >                By[m] = 0;
> >             }
> >          }
> >       }
> >    } 
> > }
> > 
> > Buy  = ExRem(By, Sel);
> > Sell = ExRem(Sel, By);
> > 
> > // Following section constructs the plots of the demand and
> > // supply lines at the area of selection with the pole
> > x1=SelectedValue(ValueWhen(pivotlow,BarIndex(),1));
> > y1=SelectedValue(ValueWhen(pivotlow,L,1));
> > x0=SelectedValue(ValueWhen(pivotlow AND L<y1,BarIndex(),1));
> > y0=SelectedValue(ValueWhen(pivotlow AND L<y1,L,1));
> > x3=SelectedValue(ValueWhen(pivothigh,BarIndex(),1));
> > y3=SelectedValue(ValueWhen(pivothigh,H,1));
> > x2=SelectedValue(ValueWhen(pivothigh AND H>y3,BarIndex(),1));
> > y2=SelectedValue(ValueWhen(pivothigh AND H>y3,H,1));
> > 
> > demandLine =IIf(x0==0,Null,LineArray(x0,y0,x1,y1,1));
> > supplyLine =IIf(x2==0,Null,LineArray(x2,y2,x3,y3,1));
> > 
> > Plot(IIf(Cum(1)<x3+extension, supplyLine, Null),"",colorWhite,
> > 	styleLine|styleThick|styleNoRescale|styleNoLabel);
> > Plot(IIf(Cum(1)<x1+extension, demandLine, Null),"",colorWhite,
> > 	styleLine|styleThick|styleNoRescale|styleNoLabel);
> > 
> > By = Cross(Cum(H>supplyline AND BarIndex()-1>x3 AND 
> > 	BuyQualifier),0);
> > Sel = Cross(Cum(L<demandLine AND BarIndex()-1>x1 AND 
> > 	SellQualifier),0);
> > 
> > PlotShapes((BarIndex()==x0 OR BarIndex()==x1)*
> > 		shapeSmallCircle,colorWhite,0,L, -8);
> > PlotShapes(Sell*shapeDownArrow,colorRed,0,H);
> > PlotShapes(Sel*shapeDownArrow,colorLightOrange,0,H,-25);
> > 
> > PlotShapes((BarIndex()==x2 OR BarIndex()==x3)*
> > 		shapeSmallCircle,colorWhite,0,H,8);
> > PlotShapes(Buy*shapeUpArrow,colorBrightGreen,0,L);
> > PlotShapes(By*shapeUpArrow,colorAqua,0,L, -25);
> > 
> > Title= Name()+"    "+Date()+EncodeColor(colorWhite) +
> > "    Open  "+WriteVal(Open, 1.3)+"     Hi  "+WriteVal(High,1.3)+
> > "     Lo  "+WriteVal(Low,1.3)+"     Close  "+WriteVal(Close,1.3)
+ 
> > EncodeColor(colorRed)+"     Sell =,"+WriteVal((y1-y0)/(x1-x0)+
> > SelectedValue(DEMAndline),1.3)+EncodeColor(colorBrightGreen)+
> > "    Buy =,"+WriteVal((y3-y2)/(x3-x2)+
> > SelectedValue(supplyline),1.3 )+
> > "\n\\c03 Param Select Qualifiers and Days";
> > 
> > GraphXSpace=14;
> > 
> > //---------------------------------------------------------------
--



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 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:
     http://docs.yahoo.com/info/terms/