Can someone help me with this code? I am not really good in programming.
It's from this site
http://traders.com/Documentation/FEEDbk ... sTips.html
It compiled with error as shown. See attached.
Code: Select all
{ TASC Article, June 2013 }
{ "The 1-2-3 Wave Count" }
{ Sylvain Vervoort }
using elsystem ;
inputs:
double ZZPercent( 5 ), { 0 = no influence; enter
in percentage points; for 1% enter 1, Not 0.01 }
int ATRPeriod( 5 ), { number of bars for ATRCalc
calc }
double ATRFactor( 1.5 ), { 0 = no ATR influence }
int ZigZagColor( Cyan ), { trendline color }
int LineWidth( 1 ) ; { trendline thickeness }
variables:
double ATRCalc( 0 ),
intrabarpersist int trend( 1 ), { confirmed trend
of current zigzag, 1 = up, -1 = down (assume
trend is up at the start) }
int LHBDate( 0 ),
int LHBTime( 0 ),
intrabarpersist int uplineid( 0 ),
int LLBDate( 0 ),
int LLBTime( 0 ),
intrabarpersist int downlineid( 0 ),
intrabarpersist double HH( 0 ),
intrabarpersist double LL( 0 ),
intrabarpersist double HLPivot( 0 ) ;
method void DrawUpLine()
begin
uplineid = TL_New( LLBDate, LLBTime, LL, LHBDate,
LHBTime, HH ) ;
FormatTL( uplineid ) ;
end ;
Method void DrawDnLine()
begin
downlineid = TL_New( LHBDate, LHBTime, HH,
LLBDate, LLBTime, LL ) ;
FormatTL( downlineid ) ;
end ;
method void FormatTL( int TLID )
begin
TL_SetColor( TLID, ZigZagColor ) ;
TL_SetSize( TLID, LineWidth ) ;
end ;
once
begin
if ATRPeriod <= 0 then
RaiseRuntimeError( "ATRPeriod input must " +
"be greater than 0." ) ;
LLBDate = Date ;
LLBTime = Time ;
LHBDate = Date ;
LHBTime = Time ;
LL = Low ;
HH = High ;
end ;
ATRCalc = AvgTrueRange( ATRPeriod ) ;
if ATRFactor = 0 then { only use percent setting }
HLPivot = ZZPercent * 0.01
else if ZZPercent = 0 then { only use ATR }
HLPivot = ATRCalc / Close * ATRFactor
else { use ATR and ZZPercent }
HLPivot = ZZPercent * 0.01 + ATRCalc / Close *
ATRFactor ;
{ look for swing points and draw lines }
if trend > 0 then { trend is up, look for new swing
low }
begin
if High >= HH then { new higher high detected }
begin
HH = High ;
LHBDate = Date ;
LHBTime = Time ;
if uplineid <> 0 then
TL_Delete( uplineid ) ;
DrawUpLine() ;
end
else if Low < HH - HH * HLPivot then { found a
swing low }
begin
LL = Low ;
LLBDate = Date ;
LLBTime = Time ;
trend = -1 ;
DrawDnLine() ;
end ;
end
else { trend is down, look for new swing high }
begin
if Low <= LL then { new lower low detected }
begin
LL = Low ;
LLBDate = Date ;
LLBTime = Time ;
if downlineid > 0 then
TL_Delete( downlineid ) ;
DrawDnLine() ;
end
else if High > LL + LL * HLPivot then { found a
swing high }
begin
HH = High ;
LHBDate = Date ;
LHBTime = Time ;
trend = 1 ;
DrawUpLine() ;
end ;
end ;