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

RE: [amibroker] Re: Remember This?



PureBytes Links

Trading Reference Links





Ken,
 
I have attached it as a .txt file...just copy and paste into Indicator builder....
 
Anthony 
-------Original Message-------
 

From: amibroker@xxxxxxxxxxxxxxx
Date: Friday, May 23, 2003 7:45:42 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Remember This?
 Anthony: I would really like to investigate the code you put in thismessage. Unfottunately, word wrap has introduced so many errors that Iam not able to debug them all.  Can you please repost your message withthe AFL file as an attachment?  I would appreciate it.Thanks,Ken-----Original Message-----From: Anthony Faragasso [mailto:ajf1111@xxxxxxxx] Sent: Thursday, May 22, 2003 11:42 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] Re: Remember This?/*Adaptive Zones OB/OS OSCILLATOR*//*Automatically Adjusts the overbought and oversold levels based on pastperformance*//*Interpreted and coded by Anthony Faragasso*//*Can be used with PrePackagedindicators,RSI,CCI,STOCHK,STOCHD,MFI,ULTIMATE*//*For ROC add the Close. ex.ROC(C,pds);*/MaxGraph=20;/*Input */Lookback=60;PerCent=95;Pds =8;/****Dimitri Code***********//*N-Day RSI of MACD()*/ //t=14; Replaced with pds= statementVar=MACD(); Up=IIf(Var>Ref(Var,-1),abs(Var-Ref(Var,-1)),0); Dn=IIf(Var<Ref(Var,-1),abs(Var-Ref(Var,-1)),0); Ut=Wilders(Up,Pds); Dt=Wilders(Dn,Pds);RSIt=100*(Ut/(Ut+Dt)); /************End Code*************************//********Add Custom Formulas Here******///PsychIndexLookBack2=60;UpDay= IIf(Close > Ref(Close,-1), 1, 0);PsychIndex= Sum(UpDay,LookBack2) / LookBack2 * 100;//****Beta***********************/ Mkt="^NDX";/*Base Market: must be enclosed with "..."*/P=Foreign(Mkt,"c");periods=21;//Periods of ObservationBeta=(( Periods * Sum(ROC( C,1) * ROC(P,1),Periods )) - (Sum(ROC(C,1)Periods) * Sum(ROC( P,1),Periods))) / ((Periods * Sum((ROC(P,1)^2 )Periods)) - (Sum(ROC(P,1 ),Periods)^2 ));/*********************************///ATRAverageTrueRange=ATR(pds);/*************************************///Trend intensity indexx=10;//Set this to desired Variable.MA1=MA(C,2*x);sdp=Sum(IIf(C-MA1 > 0, C-MA1,0),x);sdm=Sum(IIf(MA1-C > 0, MA1-C,0),x);TII=(sdp/(sdp + sdm))*100;/********************************///Ease of MovementMM=((H+L)/2)-((Ref(H,-1)+Ref(L,-1))/2);Box_ratio=(V/10000)/(H-L);EVM=EMA((MM/box_ratio),pds);/************************************///% RR = ((HHV(H,pds) - C) /(HHV (H,pds) -LLV (L,pds))) *-100;/************************************///Balance Of Power - BOPThL1=IIf(H-L==0,.00001,H-L);//{Reward Based on the Open}BuRBoO=(H-O)/(ThL1);BeRBoO=(O-L)/(ThL1);//{Reward Based on the Close}BuRBoC=(C-L)/(ThL1);BeRBoC=(H-C)/(ThL1);//{Reward Based on the Open-Close}BuRBoOC=IIf(C>O,(C-O)/(ThL1),0);BeRBoOC=IIf(C>O,0,(O-C)/(ThL1));BOP=(BuRBoO+BuRBoC+BuRBoOC)/3 - (BeRBoO+BeRBoC+BeRBoOC)/3;BOP=EMA(BOP,pds);/**********************************///CandleCode IIBdy=abs(O-C);Lshd=IIf(C>=O,O-L,C-L);Ushd=IIf(C>=O,H-C,H-O);ThBotB=BBandBot(Bdy,55,0.5);ThTopB=BBandTop(Bdy,55,0.5);ThBotL=BBandBot(Lshd,55,0.5);ThTopL=BBandTop(Lshd,55,0.5);ThBotU=BBandBot(Ushd,55,0.5);ThTopU=BBandTop(Ushd,55,0.5);CCode=IIf(C==O,1,0) *IIf(Ushd>=Lshd,64,48)+IIf(C==O,0,1)*(IIf(C>O,10)*(IIf(Bdy<=ThBotB,80,0)+IIf(Bdy>ThBotB AND Bdy<=ThTopB,96,0)+IIf(Bdy>ThTopB,112,0)) +IIf(C<O,1,0)*(IIf(Bdy<=ThBotB,32,0)+IIf(Bdy>ThBotBAND Bdy<=ThTopB,16,0)))+(IIf(Lshd==0,3,0)+ IIf(Lshd<ThBotL ANDLshd>0,2,0)+IIf(Lshd>ThBotL AND Lshd<=ThTopL AND Lshd>0,1,0))+(IIf(Ushd>0 ANDUshd=ThBotU,4,0)+IIf(Ushd>ThbotU ANDUshd<=ThTopU,8,0)+IIf(Ushd>ThTopU,120));/***********************************************///Candle Strength Index/*Pds input suggested is: 2 to 13 pds.*/Candle_Strength_Index=MA(MA(MA(Ccode,Pds),Pds),Pds);/*********************************///Chaiken Oscillator//The periods are fixed.Chaiken_Oscillator=EMA(AccDist(),3)-EMA(AccDist(),10);/*********************************///Chaiken Volatility Oscillator//10 is recommended for both periodsperiod=10;Chaiken_Volatility=ROC(MA((H-L),period),period);/**********************************//*******Variables******************/A1=RSIt;//Dimitri RSI of MACDB2=RSI(pds); C3=CCI(pds); D4=StochK(pds); E5=StochD(pds);F6=MFI(pds); G7=Ultimate(pds); H8=ROC(C,pds);I9=PsychIndex;//PsychIndexJ10=Beta;//BetaK11=AverageTrueRange;//AtrL12=TII;//Trend intensity IndexM13=EVM;//Ease of MovementN14=R;//Williams %RO15=BOP;//Balance of PowerP16=OBV();//ON Balance VolumeQ17=CCode;//Candle Code IIR18=Candle_Strength_Index;S19=PVI();//Positive Volume IndexT20=NVI();//Negative Volume IndexU21=PVI()-NVI();V22=AccDist();//Accumulation/DistributionW23=Chaiken_Oscillator;X24=Chaiken_Volatility;/****************************************/Osc=x24; /*insert variable by Identifier*/ /****************************************//*Value of Osc*/Value1 = Osc;/*Highest AND Lowest Values of Osc during Lookback Period*/Value2 = HHV(Value1,Lookback);Value3 = LLV(Value1,Lookback);/*Range of Osc during Lookback Period*/Value4 = Value2 - Value3;/*Define PerCent of Range to determine OB AND OS levels*/Value5 = Value4 * (PerCent / 100);/*Calculate OB AND OS levels*/Value6 = Value3 + Value5;Value7 = Value2 - Value5;baseline=(value2 + value3)/2; Header=WriteIf(Osc==A1," RSI Of MACD",WriteIf(Osc==b2,"RSI",WriteIf(Osc==C3"CCI",WriteIf(Osc==D4,"STOCHK",WriteIf(Osc==E5,"STOCHD",WriteIf(Osc==F6,"MONEY FLOW INDEX",WriteIf(Osc==G7," ULTIMATE",WriteIf(Osc==H8,"ROC(CLOSE)"WriteIf(Osc==I9," PsychIndex ",WriteIf(Osc==j10,"Beta",WriteIf(Osc==K11,ATR"+"("+WriteVal(pds,1)+")",WriteIf(Osc==L12,"Trend_Intensity_Index"+"(+WriteVal(x,1)+")",WriteIf(Osc==M13,"Ease_Of_Movement"+"("+WriteVal(pds,1)+)",WriteIf(Osc==N14,"Williams%R"+"("+WriteVal(pds,1)+")",WriteIf(Osc==O15,Balance_Of_Power"+"("+WriteVal(pds,1)+")",WriteIf(Osc==P16,On_Balance_Volume",WriteIf(Osc==Q17,"Candle_Code II",WriteIf(Osc==R18,Candle_Strength_Index"+"("+WriteVal(pds,1)+")",WriteIf(Osc==S19,Positive_Volume_Index",WriteIf(Osc==T20,"Negative_Volume_Index"WriteIf(Osc==U21,"PVI-NVI",WriteIf(Osc==V22,"Accumulation/Distribution"WriteIf(Osc==Chaiken_Oscillator,"Chaiken_Oscillator"WriteIf(Osc==Chaiken_Volatility,"Chaiken_Volatility"+"("+WriteVal(period,1)+)",""))))))))))))))))))))))));Plot(Value1, Header,6,1+4); /*BLUE*/Plot(Value6," O/B",4,1+4); /*RED -TOP(SELL)*/Plot(Value7," O/S",5,1+4); /*GREEN-BOT(BUY)*/Plot(Baseline," Baseline",7,1+4); /* yellow*/-------Original Message-------From: amibroker@xxxxxxxxxxxxxxxDate: Thursday, May 22, 2003 9:10:45 PMTo: amibroker@xxxxxxxxxxxxxxxCc: jeff davisSubject: Re: [amibroker] Re: Remember This?   Anthony, I would appreciate your posting it.  .  Ron D----- Original Message ----- From: Anthony Faragasso To: amibroker@xxxxxxxxxxxxxxx Sent: Thursday, May 22, 2003 5:03 PMSubject: Re: [amibroker] Re: Remember This?Jim,What are your specific questions concerning the Adaptive ZonesOscillator.....It does not only applyto built in Indicators....Your can create your own custom indicatorsandsubstitute it in the OSC= line.Check this....This version contains 24 indicators....If you or anyone isinterested I will post this version.A1=RSIt;//Dimitri RSI of MACDB2=RSI(pds); C3=CCI(pds); D4=StochK(pds); E5=StochD(pds);F6=MFI(pds); G7=Ultimate(pds); H8=ROC(C,pds);I9=PsychIndex;//PsychIndexJ10=Beta;//BetaK11=AverageTrueRange;//AtrL12=TII;//Trend intensity IndexM13=EVM;//Ease of MovementN14=R;//Williams %RO15=BOP;//Balance of PowerP16=OBV();//ON Balance VolumeQ17=CCode;//Candle Code IIR18=Candle_Strength_Index;S19=PVI();//Positive Volume IndexT20=NVI();//Negative Volume IndexU21=PVI()-NVI();V22=AccDist();//Accumulation/DistributionW23=Chaiken_Oscillator;X24=Chaiken_Volatility;Anthony-------Original Message-------From: amibroker@xxxxxxxxxxxxxxxDate: Thursday, May 22, 2003 4:17:40 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re: Remember This?I was looking at that just last night! How do you use it seeing as it applies to built in indicators, and it seems to apply to several of them???ThanksJim--- In amibroker@xxxxxxxxxxxxxxx, "MarkF2" <feierstein@xxxx> wrote:> Steve- Anthony posted an Adaptive Zones O/B & O/S Oscillator to the> AFL Library.  > > http://www.amibroker.com/library/detail.php?id=144> > Mark> > --- In amibroker@xxxxxxxxxxxxxxx, "Fred" <fctonetti@xxxx> wrote:> > Steve,> > > > Although I don't believe Rina makes products for AB, try looking here > > for general ideas at least ... > > http://www.rinafinancial.com/DynamicZonesAnalysisPack.asp > > > > --- In amibroker@xxxxxxxxxxxxxxx, "steve_almond" <steve@xxxx> wrote:> > > Whilst reading (thousands of) older messages a few weeks ago, I cam > > > across this system:> > > > > > use an oscillator, but instead of (for example) buying when the > > > oscillator crosses 60 and selling when it crosses below 40, the new > > > system had a variable trigger value.> > > > > > For some reason I remembered the word "Zone" connected with this > > > system, but a search for "Zone" found no leads.> > > > > > Can anyone help?> > > > > > Thanks,> > > > > > SteveYahoo! Groups SponsorSend BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at:http://groups.yahoo.com/group/amibroker/files/groupfaqhtml Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at:http://groups.yahoo.com/group/amibroker/files/groupfaqhtml Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. Yahoo! Groups SponsorADVERTISEMENTSend BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at:http://groups.yahoo.com/group/amibroker/files/groupfaqhtml Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at:http://groups.yahoo.com/group/amibroker/files/groupfaq.html Your use of Yahoo! Groups is subject tohttp://docs.yahoo.com/info/terms/ Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
 







____________________________________________________  IncrediMail - Email has finally evolved - Click Here
/*Adaptive Zones OB/OS OSCILLATOR*/
/*Automatically Adjusts the overbought and oversold levels based on past performance*/
/*Interpreted and coded by Anthony Faragasso*/
/*Can be used with PrePackaged indicators,RSI,CCI,STOCHK,STOCHD,MFI,ULTIMATE,*/
/*For ROC add the Close. ex.ROC(C,pds);*/

MaxGraph=20;
/*Input */
Lookback=60;
PerCent=100;
Pds =8;

/****Dimitri Code***********/
/*N-Day RSI of MACD()*/ 
//t=14; Replaced with pds= statement
Var=MACD(); 
Up=IIf(Var>Ref(Var,-1),abs(Var-Ref(Var,-1)),0); 
Dn=IIf(Var<Ref(Var,-1),abs(Var-Ref(Var,-1)),0); 
Ut=Wilders(Up,Pds); 
Dt=Wilders(Dn,Pds);
RSIt=100*(Ut/(Ut+Dt)); 
/************End Code*************************/

/********Add Custom Formulas Here******/
//PsychIndex
LookBack2=60;
UpDay= IIf(Close > Ref(Close,-1), 1, 0);
PsychIndex= Sum(UpDay,LookBack2) / LookBack2 * 100;

//****Beta***********************/ 
Mkt="^NDX";/*Base Market: must be enclosed with "..."*/
P=Foreign(Mkt,"c");

periods=21;//Periods of Observation

Beta=(( Periods * Sum(ROC( C,1) * ROC(P,1),Periods )) - (Sum(ROC(C,1),Periods) * Sum(ROC( P,1),Periods))) / ((Periods * Sum((ROC(P,1)^2 ),Periods)) - (Sum(ROC(P,1 ),Periods)^2 ));
/*********************************/
//ATR
AverageTrueRange=ATR(pds);

/*************************************/
//Trend intensity  index

x=10;//Set this to desired Variable.
MA1=MA(C,2*x);
sdp=Sum(IIf(C-MA1 > 0, C-MA1,0),x);
sdm=Sum(IIf(MA1-C > 0, MA1-C,0),x);
TII=(sdp/(sdp + sdm))*100;
/********************************/
//Ease of Movement

MM=((H+L)/2)-((Ref(H,-1)+Ref(L,-1))/2);
Box_ratio=(V/10000)/(H-L);
EVM=EMA((MM/box_ratio),pds);
/************************************/
//% R
R = ((HHV(H,pds) - C) /(HHV (H,pds) -LLV (L,pds))) *-100;
/************************************/
//Balance Of Power - BOP

ThL1=IIf(H-L==0,.00001,H-L);//{Reward Based on the Open}
 BuRBoO=(H-O)/(ThL1);
 BeRBoO=(O-L)/(ThL1);//{Reward Based on the Close}
  BuRBoC=(C-L)/(ThL1);
  BeRBoC=(H-C)/(ThL1);//{Reward Based on the Open-Close}
   BuRBoOC=IIf(C>O,(C-O)/(ThL1),0);
   BeRBoOC=IIf(C>O,0,(O-C)/(ThL1));

BOP=(BuRBoO+BuRBoC+BuRBoOC)/3 - (BeRBoO+BeRBoC+BeRBoOC)/3;
BOP=EMA(BOP,pds);
/**********************************/

//CandleCode II
Bdy=abs(O-C);
Lshd=IIf(C>=O,O-L,C-L);
Ushd=IIf(C>=O,H-C,H-O);
ThBotB=BBandBot(Bdy,55,0.5);
ThTopB=BBandTop(Bdy,55,0.5);
ThBotL=BBandBot(Lshd,55,0.5);
ThTopL=BBandTop(Lshd,55,0.5);
ThBotU=BBandBot(Ushd,55,0.5);
ThTopU=BBandTop(Ushd,55,0.5);
CCode=IIf(C==O,1,0) *IIf(Ushd>=Lshd,64,48)+IIf(C==O,0,1)*(IIf(C>O,1,0)*(IIf(Bdy<=ThBotB,80,0)+IIf(Bdy>ThBotB AND Bdy<=ThTopB,96,0)+ IIf(Bdy>ThTopB,112,0)) + IIf(C<O,1,0)*(IIf(Bdy<=ThBotB,32,0)+IIf(Bdy>ThBotB AND Bdy<=ThTopB,16,0)))+(IIf(Lshd==0,3,0)+ IIf(Lshd<ThBotL AND Lshd>0,2,0)+ IIf(Lshd>ThBotL AND Lshd<=ThTopL AND Lshd>0,1,0))+(IIf(Ushd>0 AND Ushd=ThBotU,4,0)+IIf(Ushd>ThbotU AND Ushd<=ThTopU,8,0)+IIf(Ushd>ThTopU,12,0));
    
/***********************************************/
//Candle Strength Index
/*Pds input suggested is: 2 to 13 pds.*/

Candle_Strength_Index=MA(MA(MA(Ccode,Pds),Pds),Pds);

/*********************************/
//Chaiken Oscillator
//The periods are fixed.
Chaiken_Oscillator=EMA(AccDist(),3)-EMA(AccDist(),10);
/*********************************/
//Chaiken Volatility Oscillator
//10 is recommended for both periods
period=10;
Chaiken_Volatility=ROC(MA((H-L),period),period);
/**********************************/
/*******Variables******************/

A1=RSIt;//Dimitri RSI of MACD
B2=RSI(pds); 
C3=CCI(pds); 
D4=StochK(pds); 
E5=StochD(pds);
F6=MFI(pds); 
G7=Ultimate(pds); 
H8=ROC(C,pds);
I9=PsychIndex;//PsychIndex
J10=Beta;//Beta
K11=AverageTrueRange;//Atr
L12=TII;//Trend intensity Index
M13=EVM;//Ease of Movement
N14=R;//Williams %R
O15=BOP;//Balance of Power
P16=OBV();//ON Balance Volume
Q17=CCode;//Candle Code II
R18=Candle_Strength_Index;
S19=PVI();//Positive Volume Index
T20=NVI();//Negative Volume Index
U21=PVI()-NVI();
V22=AccDist();//Accumulation/Distribution
W23=Chaiken_Oscillator;
X24=Chaiken_Volatility;
/****************************************/

Osc=x24; /*insert variable by Identifier*/ 
/****************************************/
/*Value of Osc*/
Value1 = Osc;

/*Highest AND Lowest Values of Osc during Lookback Period*/
Value2 = HHV(Value1,Lookback);
Value3 = LLV(Value1,Lookback);

/*Range of Osc during Lookback Period*/
Value4 = Value2 - Value3;

/*Define PerCent of Range to determine OB AND OS levels*/
Value5 = Value4 * (PerCent / 100);

/*Calculate OB AND OS levels*/
Value6 = Value3 + Value5;
Value7 = Value2 - Value5;

baseline=(value2 + value3)/2; 

Header=WriteIf(Osc==A1," RSI Of MACD",WriteIf(Osc==b2," RSI",WriteIf(Osc==C3," CCI",WriteIf(Osc==D4,"STOCHK",WriteIf(Osc==E5,"STOCHD",WriteIf(Osc==F6," MONEY FLOW INDEX",WriteIf(Osc==G7," ULTIMATE",WriteIf(Osc==H8," ROC(CLOSE)",WriteIf(Osc==I9," PsychIndex ",WriteIf(Osc==j10," Beta",WriteIf(Osc==K11,"ATR"+"("+WriteVal(pds,1)+")",WriteIf(Osc==L12,"Trend_Intensity_Index"+"("+WriteVal(x,1)+")",WriteIf(Osc==M13,"Ease_Of_Movement"+"("+WriteVal(pds,1)+")",WriteIf(Osc==N14,"Williams %R"+"("+WriteVal(pds,1)+")",WriteIf(Osc==O15,"Balance_Of_Power"+"("+WriteVal(pds,1)+")",WriteIf(Osc==P16,"On_Balance_Volume",WriteIf(Osc==Q17,"Candle_Code II",WriteIf(Osc==R18,"Candle_Strength_Index"+"("+WriteVal(pds,1)+")",WriteIf(Osc==S19,"Positive_Volume_Index",WriteIf(Osc==T20,"Negative_Volume_Index",WriteIf(Osc==U21,"PVI-NVI",WriteIf(Osc==V22,"Accumulation/Distribution",WriteIf(Osc==Chaiken_Oscillator,"Chaiken_Oscillator",WriteIf(Osc==Chaiken_Volatility,"Chaiken_Volatility"+"("+WriteVal(period,1)+")",""))))))))))))))))))))))));

Plot(Value1, Header,6,1+4); /*BLUE*/
Plot(Value6," O/B",4,1+4);  /*RED -TOP(SELL)*/
Plot(Value7," O/S",5,1+4);  /*GREEN-BOT(BUY)*/

Attachment: Description: "Plot(Baseline," Baseline",7,1+4); /* yellow*/"