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

[amibroker] The Virtual Close and its Applications



PureBytes Links

Trading Reference Links




 
Here is my Virtual Close calculation/interpretation based on 
Siligardos method
 
The calculation of the Virtual Close 
a. INTRODUCTION
The RevEngRsi indicator, as described by Giorgos Siligardos in 
June 2003 TASC issue,returns the price Value required for the RSI to move to 
a certain level on the next bar. When the individual RSI is lower [higher] 
than the MeanRSI, then the stock underperforms [outperforms] the market.If 
we replace the individual RSI with the MeanRSI, then RevEngRSI will return the 
Virtual Close, as if the stock was Equalweighted to the market.
Then we may easily calculate the underperformance 
[outperformance] % for each stock.
 
b. CALCULATION
Value=Foreign("~SUMRSI","C")/Foreign("~Count","V");// this is 
the MeanRSIWildPer = 14;ExpPer = 2 * WildPer - 1;AUC = EMA( Max( C - 
Ref( C, -1 ), 0 ), ExpPer );ADC = EMA( Max( Ref( C, -1 ) - C, 0 ), ExpPer 
);x = (WildPer - 1) * ( ADC * Value / (100-Value) - AUC);RevEngRSI = 
IIf( x >= 0, C + x, C + x * (100-Value)/Value 
);VirtualClose=RevEngRSI;
 
c. EXAMPLE
 
If we try a quantitative description, we will frequently come 
to absurd results:Suppose June6, 2003 when MSFT RSI is 35.53 and the MeanRSI 
is 62.40. This relation would give that MSFT underperforms the market by 
100*(-1+62.40/35.53)=75% which is not that realistic.The Virtual MSFT 
close for the same day is calculated 26.57 and MSFT actual Close [23.67] 
underperforms the market by 100*(-1+26.57/23.67)=12% which is much more 
descriptive and makes sense : 
MSFT needs a +12% rally to catch the market 
phase.
 
d. APPLICATIONS
Since underperformance [outperformance] is expressed in 
VirtualClose-Close terms, we may easily get interesting statistical results for 
the past behavior of each stock.
a. MSFT last Close underperforms the N100 market by 
12.27%b. MSFT underperforms the market the last 41 barsc. The max 
underperformance % in MSFT history was 23%d. The  max MSFT 
underperformance period was 50 bars, back on June2000e. The historical 
OUTper/UNDERper ratio of outperformance/underperformancetiming of the stock 
: MSFT outperformed the N100 market the 43.63% of the last 41 
months
 
Dimitris Tsokakis
 
PS
After creating the MeanRSI with
AddToComposite(RSI(),"~SUMRSI","C");
AddToComposite(1,"~COUNT","V");
Buy=0;
then paste in an Indicator builder window 
the
 
// Vitrual Close, by D. Tsokakis, June 2003
// based on Siligardos method, TASC June 2003 
issue
Value=Foreign("~SUMRSI","C")/Foreign("~Count","V");WildPer 
= 14;ExpPer = 2 * WildPer - 1;AUC = EMA( Max( C - Ref( C, -1 ), 0 ), ExpPer 
);ADC = EMA( Max( Ref( C, -1 ) - C, 0 ), ExpPer );x = (WildPer - 1) * ( 
ADC * Value / (100-Value) - AUC);RevEngRSI = IIf( x >= 0, C + x, C + x * 
(100-Value)/Value );VirtualClose=RevEngRSI;Plot( 
VirtualClose,"",4,4);ratio=IIf(revengrsi<C,100*(-1+C/revengrsi),100*(-1+revengrsi/C));Hratio=LastValue(Highest(100*(-1+C/revengrsi)));Lratio=LastValue(Highest(100*(-1+revengrsi/C)));Hcond=Hratio==100*(-1+C/revengrsi);Lcond=Lratio==100*(-1+revengrsi/C);underbars=BarsSince(RevEngRSI<C);Outbars=BarsSince(RevEngRSI>C);Maxunder=Highest(underbars);tMuY=ValueWhen(Maxunder==underbars,Year());tMuM=ValueWhen(Maxunder==underbars,Month());Maxout=Highest(Outbars);tMoY=ValueWhen(Maxout==outbars,Year());tMoM=ValueWhen(Maxout==outbars,Month());Plot( 
Close, "" , Hcond*4+Lcond*3+1, 64);Title=Name()+" Close 
"+WriteIf(RevEngRSI>C," underperforms [the last 
"+WriteVal(underbars,1.0)+" bars] the market by "+WriteVal(ratio,1.2)+" 
% [max "+WriteVal(Lratio,1.0)+" %]. Max Underperform period was 
"+WriteVal(Maxunder,1.0)+" bars, back on 
"+WriteVal(tmuM,1.0)+"/"+WriteVal(tmuY,1.0)," outperforms [the last 
"+WriteVal(Outbars,1.0)+" bars] the market by "+WriteVal(ratio,1.2)+" % 
[max "+WriteVal(Hratio,1.0)+" %]. Max outperform period was 
"+WriteVal(Maxout,1.0)+" bars, back on 
"+WriteVal(tmoM,1.0)+"/"+WriteVal(tmoY,1.0));
 
and the complementary
 
// Underperformance/Outperformance past behavior
Value=Foreign("~SUMRSI","C")/Foreign("~Count","V");WildPer 
= 14;ExpPer = 2 * WildPer - 1;AUC = EMA( Max( C - Ref( C, -1 ), 0 ), ExpPer 
);ADC = EMA( Max( Ref( C, -1 ) - C, 0 ), ExpPer );x = (WildPer - 1) * ( 
ADC * Value / (100-Value) - AUC);RevEngRSI = IIf( x >= 0, C + x, C + x * 
(100-Value)/Value 
);Plot(1,"",(C<=RevEngRSI)*4+(C>RevEngRSI)*5,2);Plot(0,"",1,1);Title=Name()+" 
outperforms the market the 
"+WriteVal(100*Cum(C>RevEngRSI)/Cum(IsTrue(RevEngRSI)),1.2)+" % of the 
last "+WriteVal(Cum(Month()!=Ref(Month(),-1)),1.0)+" months";
 






Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send 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.



Attachment:
underOUT.gif

Attachment: Description: "Description: GIF image"