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

[amibroker] Wealth Lab to AMIBroker conversion



PureBytes Links

Trading Reference Links



Hello,

Can anyone help me?I'm newbie in Amibroker AFL.I have a indicator from
WL and I want to convert the formula into the Amibroker.Here is the
code:

function UnknownIndicatorSeries(Series: integer): integer;
begin
 var Name: string = 'UnknownIndicatorSeries1' + '(' +
GetDescription(Series) + ')';
 Result := FindNamedSeries(Name);
 if Result >= 0 then exit;
 Result := CreateNamedSeries(Name);

 var Hi: float = @Series[0];
 var Lo: float = @Series[0];
 var kr: integer = 0;
 var no: integer = 0;
 var Bar: integer;
 for Bar := 13 to BarCount - 1 do
 begin
   if @Series[Bar] > Hi + ATR(Bar, 14) then
   begin
     var kf: float = (@Series[Bar] - (Hi + ATR(Bar, 14))) / ATR(Bar,
14);
     var k: integer = trunc(kf);
     if k < kf then inc(k);
     Hi := @Series[Bar];
     Lo := @Series[Bar] - ATR(Bar, 14);
     kr := kr + k;
     no := 0;
   end;
   if @Series[Bar] < Lo - ATR(Bar, 14) then
   begin
     var kf: float = ((Lo - ATR(Bar, 14)) - @Series[Bar]) / ATR(Bar,
14);
     var k: integer = trunc(kf);
     if k < kf then inc(k);
     Hi := @Series[Bar] + ATR(Bar, 14);
     Lo := @Series[Bar];
     kr := 0;
     no := no - k;
   end;
   if no = 0 then @Result[Bar] := kr
             else @Result[Bar] := no;
 end;
end;

function UnknownIndicator(Bar, Series: integer): integer;
begin
 Result := trunc(GetSeriesValue(Bar, UnknownIndicatorSeries(Series)));
end;

HideVolume;
var p: integer = CreatePane(100, false, false);
PlotSeries(UnknownIndicatorSeries(#Close), p, #Blue, #Thick);
DrawHorzLine(0, p, #Black, #Dotted);

thanks for helping me.
regards
Jarro








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

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/