Code #1 is working ok on my end when pasted from your post. This is 
browser/Yahoo related and you have to get used to checking the code syntax line 
by line after pasting from the website. Most of the time it's related to 
improper text wrapping. When you see the error message check the line number 
and paste just that line. You will often find basic wrapping errors like this 
one:

// this is example of
incorrect wrapping

Of course it must all be in one line:

// this is example of incorrect wrapping

Code #2 pastes ok but it compresses the price plot. It looks like you got it 
from the second link that I posted and I can confirm that it doesn't work 
properly. Here it is again. It's from my own library so it has a few extras 
(tooltips, colours, etc.) that you might want to remove:

CORRECT CODE #2:

/*** START ***/

// Price in selected time range
// Third party AFL plugin used: deDateTime.dll
// The code is modified to make sure that Close Line is plotted even if there 
is no bar present at Close Time
// Ref: http://finance.groups.yahoo.com/group/amibroker/message/106487

// Title and candles
dyn_col = IIf(C>Ref(C,-1),34,IIf(C<Ref(C,-1),32,37)); // Net colour in the Title
net_chg = NumToStr(C-Ref(C,-1),1.3); // Net value in the Title

Title = "\\c11"+Interval(2)+" "+Date()+"\\c-1  O="+O+" H="+H+" L="+L+"\\c26 
C="+C+
"\\c11  "+FullName()+EncodeColor(SelectedValue(dyn_col))+"  N="+net_chg;

t_t = ToolTip="O = "+O+"\n"+ToolTip="H = "+H+"\n"+ToolTip="L = 
"+L+"\n"+ToolTip="C = "+C+
"\n\n"+ToolTip="V = "+NumToStr(V,1.0)+"\n"+ToolTip="T = "+NumToStr(OI,1.0);

Plot(C, t_t, 26, 64);

// High and Low in a specified time frame
startTime = 093000;
endTime   = 103000;
exitTime  = 145500;

// add-on plugin functions
hgh = deTimeRangeHHV (H, startTime, endTime);
lwl = deTimeRangeLLV (L, startTime, endTime);

// special code for Close Line
tt = IIf(TimeNum() >= startTime AND TimeNum() <= endTime, 1, 0);
dtt = tt - Ref(tt, -1);

H_plot = IIf(TimeNum()>=endTime AND TimeNum()<=exitTime, hgh, Null);
L_plot = IIf(TimeNum()>=endTime AND TimeNum()<=exitTime, lwl, Null);
C_Plot = IIf(!tt, ValueWhen(Ref(dtt,1) == -1, C), Null);

Plot(H_plot, "", colorLightBlue, styleLine);
Plot(L_plot, "", colorOrange,    styleLine);
Plot(C_plot, "", colorTan,       styleLine);

SetChartOptions(0, chartShowDates);
GraphXSpace = 3;

// Help plots to show tt and dtt
// Plot(tt, "",34,1);
// Plot(dtt,"",32,1);
// Title = "\\c34tt="+tt+"\\c32 dtt="+dtt;

/*** END ***/


Reply via email to