PureBytes Links
Trading Reference Links
|
// Sample Percent Difference Code
function PctDiff(Var1, Var2)
{
Diff = Var1 - Var2;
PercentDiff = (Diff / Var1) * -1;
return(PercentDiff);
}
p = 30;
Filter = Status("LastBarInRange");
AddColumn(PctDiff(C, Ref(C, -p)), "PctDiff", 1.4);
Rgds
--- In amibroker@xxxxxxxxxxxxxxx, "chandrakant" <darshan_age@xxx> wrote:
>
> dear seniormembrs,
> i have problem in taking out change in % , i am using following
> formula,
> p=Param("past days",30,10,100,1);
> diffc=C-Ref(C,- p)/ Ref(C,-p)*100;
> pctc=(C-Ref(C,-p))/C ;
> Pct = int(diffc);
> PctChg = (C - Ref(C,-p)) / ROC(C,1)*100;
>
> Filter=diffc OR pctc OR pct OR pctchg;//1 AND NOT GroupID()==253;
> AddColumn(C,"Today close",1.4, textcolor=IIf(
> C>Ref(C,-1),colorGreen,colorRed)) ;
> AddColumn(Ref(C,- p),"Close at past ("+p+") bars ",1.4, textcolor=IIf(
> Ref(C,- p)>C,colorGreen,colorRed)) ;
> AddColumn(diffc,"% change",1.4, textcolor=IIf(diffc>65 AND
> diffc<75,colorGreen,IIf(diffc<25 AND diffc>10,colorRed,1)));
> AddColumn(pctc,"%pctc change",1.4, textcolor=IIf(diffC>65 AND
> diffC<75,colorGreen,IIf(diffC<25 AND diffC>10,colorRed,1))) ;
> AddColumn(pct,"%pct change",1.4, textcolor=IIf(diffC>65 AND
> diffC<75,colorGreen,IIf(diffC<25 AND diffC>10,colorRed,1))) ;
> AddColumn(PctChg,"PctChg",1.4);
>
> suppose if closing today is 100.00 and past closing(past 30)days is
> 145.00 answer should came = -31.03 [ this is the answer i am getting
> in calculator and excel sheet , but answer in explorer answer differs ..
>
> kindly help in sorting out this problem i have used above three
> calculations but none of them is matching according to my answer
> kindly advise what and where i am doing wrong * using amibroker 5.07
> beta
> ***AND i also want to add RANKING [ worst "0" & top "100"] ,
> according to % differance in explorer *********
>
> thanking you ...
>
------------------------------------
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|