I tried to verify the code in TradeStation to see what it
would take to turn into an AFL for AmiBroker. The code would not verify as
there were variables that were not defined. I suspect that there are some
functions associated with the variables. Without these functions for such
thinks as HC, BC, CC, OC, it would be very difficult to convert into an AFL for
AmiBroker.
Ed
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Roberto Martinez
Sent: Saturday, August 26, 2006 7:52 AM
To: [email protected]
Subject: [amibroker] Translation
I need help for translate easylanguage into amibroker for the following formula : SUPERTREND (coming from an excellent futures french trader)
INPUT: HBKTypPrxCentr(1),HBKTypPrxSort(2),HBKintrvp(1),kl argeurSup( 1.8),klargeurInf(-1.8),HBKLisp(10);
var: HBKPrxCentr(C),HBKPrxSort(C),HBKPlusH(0),HBKPlusB( 0),HB(0),AmplitudVrGIntHBK(0),HBKAtr(0),
HBKMoy(0),HBKH(0),HBKB(0),HBKHMoy(0),HBKBMoy(0),HB Ktendance(0),
HBKLisIntrvp(HBKLisp*HBKintrvp),Maxccant(HBKLisInt rvp);
HBKPlusH=HighestFC(HC,HBKintrvp);
HBKPlusB=LowestFC(BC,HBKintrvp);
if HBKTypPrxCentr =1 then HBKPrxCentr=cc;
if HBKTypPrxCentr =2 then HBKPrxCentr=(HBKPlusH+HBKPlusB)*0.5;
if HBKTypPrxCentr =3 then HBKPrxCentr=(HBKPlusH+HBKPlusB+cc)/3;
if HBKTypPrxCentr =4 then HBKPrxCentr=(HBKPlusH+HBKPlusB+cc+OC[HBKintrvp-1]) *0.25;
if HBKTypPrxCentr =5 then HBKPrxCentr=(HBKPlusH+HBKPlusB+cc[HBKintrvp])/3;
if HBKTypPrxCentr =6 then HBKPrxCentr=(HBKPlusH+HBKPlusB+cc[HBKintrvp]+OC[HB Kintrvp-1])* 0.25;
if HBKTypPrxSort =1 then HBKPrxSort=cc;
if HBKTypPrxSort =2 then HBKPrxSort=(HBKPlusH+HBKPlusB)*0.5;
if HBKTypPrxSort =3 then HBKPrxSort=(HBKPlusH+HBKPlusB+cc)/3;
if HBKTypPrxSort =4 then HBKPrxSort=(HBKPlusH+HBKPlusB+cc+OC[HBKintrvp-1])* 0.25;
if HBKTypPrxSort =5 then HBKPrxSort=(HBKPlusH+HBKPlusB+cc[HBKintrvp])/3;
if HBKTypPrxSort =6 then HBKPrxSort=(HBKPlusH+HBKPlusB+cc[HBKintrvp]+OC[HBK intrvp-1])*0.25;
AmplitudVrGIntHBK=(maxlist(HBKPlusH,CC[HBKintrvp]) -minlist(HBKPlusB,CC[HBKintrvp]))* 0.5;
Input:typeCalcul(6),GrafInfOuSup(1);
if HBKLisp>1 then begin
if typeCalcul=1 then begin
HBKMoy=average(HBKPrxCentr,HBKLisIntrvp);
HBKAtr=average(AmplitudVrGIntHBK,HBKLisIntrvp);
HBKHMoy=HBkmoy+klargeurSup*HBKAtr;
HBKBMoy=HBkmoy+klargeurInf*HBKAtr;
end;
if typeCalcul=2 then begin
HBKMoy=average(HBKPrxCentr,HBKLisIntrvp);
HBKAtr=average(AmplitudVrGIntHBK,HBKLisIntrvp);
HBKHMoy=HBkmoy+klargeurSup*HBKAtr;IF HBKTendance=-1 then HBKHmoy=minlist(HBKHmoy,HBKHmoy[1]);
HBKBMoy=HBkmoy+klargeurInf*HBKAtr;;IF HBKTendance=1 then HBKBmoy=maxlist(HBKBmoy,HBKBmoy[1]);
end;
if typeCalcul=3 then begin
HBKMoy=xaverage(HBKPrxCentr,HBKLisIntrvp);
HBKAtr=xaverage(AmplitudVrGIntHBK,HBKLisIntrvp);
HBKHMoy=HBkmoy+klargeurSup*HBKAtr;
HBKBMoy=HBkmoy+klargeurInf*HBKAtr;
end;
if typeCalcul=4 then begin
HBKMoy=Xaverage(HBKPrxCentr,HBKLisIntrvp);
HBKAtr=Xaverage(AmplitudVrGIntHBK,HBKLisIntrvp);
HBKHMoy=HBkmoy+klargeurSup*HBKAtr;IF HBKTendance=-1 then HBKHmoy=minlist(HBKHmoy,HBKHmoy[1]);
HBKBMoy=HBkmoy+klargeurInf*HBKAtr;;IF HBKTendance=1 then HBKBmoy=maxlist(HBKBmoy,HBKBmoy[1]);
end;
if typeCalcul=5 then begin
HBKMoy=Waverage(HBKPrxCentr,HBKLisIntrvp);
HBKAtr=Waverage(AmplitudVrGIntHBK,HBKLisIntrvp);
HBKHMoy=HBkmoy+klargeurSup*HBKAtr;
HBKBMoy=HBkmoy+klargeurInf*HBKAtr;
end;
if typeCalcul=6 then begin
HBKMoy=average(HBKPrxCentr,HBKLisIntrvp);
HBKAtr=Waverage(AmplitudVrGIntHBK,HBKLisIntrvp);
HBKHMoy=HBkmoy+klargeurSup*HBKAtr;IF HBKTendance=-1 then HBKHmoy=minlist(HBKHmoy,HBKHmoy[1]);
HBKBMoy=HBkmoy+klargeurInf*HBKAtr;;IF HBKTendance=1 then HBKBmoy=maxlist(HBKBmoy,HBKBmoy[1]);
end;
end else begin
HBKH=HBKPrxCentr+klargeurSup*AmplitudVrGIntHBK;
HBKB=HBKPrxCentr+klargeurInf*AmplitudVrGIntHBK;
HBKMoy=HBKPrxCentr;
HBKHMoy=HBKH;
HBKBMoy=HBKB;
end;
if HBKPrxSort>HBKHMoy then HBKtendance=1;
if HBKPrxSort<HBKBMoy then HBKtendance=-1;
if GrafInfouSup=1 then begin
Plot1(HBKMoy+GapJcumu,"Moy HB");
if klargeurSup>0 then begin
Plot2(HBKHMoy+GapJcumu,"Bande Sup");
if HBKtendance>0 then setplotcolor(3,yellow);
end;
if klargeuriNF<0 then begin
if HBKtendance<0 then setplotcolor(2,yellow);
end;
Plot3(HBKBMoy+GapJcumu,"Bande Inf");
if GrafInfouSup=3 then
Plot4(oC,"Ouverture",yellow);
end else begin
if HBKtendance>0 then begin
Plot2(HBKHMoy-HBKMoy,"Bande Sup");
setplotcolor(2,BLACK);
end;
if HBKtendance<0 then begin
Plot2(HBKBMoy-HBKMoy,"Bande Sup");
setplotcolor(2,red);
end;
pLOT1(0,"Moy HB",blue);
if GrafInfouSup=2 then
Plot4(oC-HBKMoy,"Ouverture",yellow);
end;
Thanks to help me.
--
No virus found in this incoming message.
Checked by AVG
Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date:
8/25/2006
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
| Software support | Small business finance | Business finance online |
| Business finance training | Business finance course |
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date: 8/25/2006
