You can 
strip the UI UPI code from this and make your own exploration routine that 
doesn't depend on BUY/SELL or the equity curve. 
Best regards
JOE 
// *************************** Function Section to calculate Risk Free Fixed 
Rate *********
function
 
Irate(interest_rate)
{
// This gets the log of the daily rate
logbarfactor = log(1 + interest_rate / 100) / 252;
// Force the first bar to 0
logvect = IIf(BarIndex() == 0, 0, logbarfactor);
// Sum the log of the daily gain factors and
// convert back to get equity
return
(exp(Cum(logvect)));
}
// General Section
period = 22; // 
22 trading days a month
MPT_Period = Param("MPT Period", 252,125,500,5); 
IndexSym = ParamStr("Russell 2000 Index Symbol","!rut"); 
// ------------------------------------MPT 
Section--------------------------
----------
Index = Foreign(IndexSym,"Close"); 
rfFund = Foreign("FDRXX","C"); 
riskfree = ((rffund/ Ref(rfFund,-MPT_Period)))^(252); 
// Correlation coefficient of Equity to the Index 
Corr = 100*Correlation(ROC(C,1),ROC(Index,1),MPT_Period);
SDF = StDev(ROC(Close, 1),MPT_Period);
SDI = StDev(ROC(Index, 1),MPT_Period);
RelStDev = SDF/SDI; 
// Calculation of Beta - 
Beta = Corr * RelStDev/100; // volatily relative to benchmark 
NCAlpha = MA(ROC(Close,1),MPT_Period) 
- RelStDev*MA(ROC(Index,1),MPT_Period); // noncorrelated Alpha
Alpha = MA(ROC(Close,1),MPT_Period) 
- Beta*MA(ROC(Index,1),MPT_Period); // 
textbook definition 
// SHARPE PERFORMANCE INDEX a risk adjusted measure of the 
performance of an equity compared to the risk free benchmark standard rate of 
return = 5%
SHARPE = ( MA(ROC(C,1),MPT_Period) - 
MA(ROC(irate(2.2),1),MPT_Period) )/(SDF); 
// ----------------------------------- UPI Code 
----------------------------------
-----
// Retracements from the Highest High Current Draw Down Here using Monthly 
Period to cal these numbers.
Cdd = (HHV(C,MPT_Period) - 
C)/HHV(C,MPT_Period);
// Max draw down
MaxDD = HHV(CDD,MPT_Period); 
// Sum of all retracements squared - 
R2 = (Sum(Cdd*Cdd,MPT_Period))/(MPT_Period-1);
// Ulcer Index -Cumulative downside volatility of an equity
UI = sqrt(R2);
// Annual compound percentage rate of return
TR = Close/Ref(Close,-MPT_Period); // Total 
Return for 1 year
ANN = (exp(log(TR))-1); // Annual compounded rate of return 
// Ulcer performance index - risk adjusted performance of an 
investment.
UPI = (ANN - irate(2.2)/100)/UI;     // I have 2.2% here, early 
analysts used 5.4% 
// ----------------------------- Performance 
Calculation
 
----------------------------
EndV = ValueWhen(DateNum()==DateNum(),C); 
// Today's Close
// hardcoded for 
2005 
BegV = ValueWhen(DateNum()==1050103,Close); // Starts year 
with Jan 3, 2005 Closing Value
YTD = 100*(EndV-BegV)/BegV;
// --------------------------- Calculate RSI / Stochastics - Exploration 
--------------------------------------
slow=LLV(C,21);
shigh=HHV(C,21);
faststoc=EMA(100*(C-slow)/(shigh-slow),13)/2 + RSI(14)/2;
momentum=faststoc-Ref(faststoc,-6); // as used in Cheese3 and 
FT
momentumchg=((faststoc-Ref(faststoc,-6))/Ref(faststoc,-6))*100; //as used in 
Cheese3 and FT
// ---------------------------- Test 
Section --------------------------
xbar = MA(ROC(C,1),MPT_Period);
SumR2 = Sum((ROC(C,1)-xbar)^2,MPT_Period);
Sigma = (SumR2/(MPT_Period-1))^.5;
 
Filter =1;
AddTextColumn
(FullName(),"Name",1.2);
AddColumn
(Corr,"Cor Coeff");
AddColumn
(Alpha,"Alpha");
AddColumn
(NCAlpha,"NCAlpha");
AddColumn
(Beta,"Beta");
AddColumn
(SDF,"Std Dev");
AddColumn
(RelStDev,"RelSD");
AddColumn
(Sharpe,"Sharpe");
AddColumn
(100*Ann,"ANN");
AddColumn
(100*MaxDD,"MDD %"); 
AddColumn
(100*UI,"UI");
AddColumn
(UPI,"UPI");
AddColumn
(faststoc,"Stoch/RSI",1.2);
AddColumn
(momentum,"Mom",1.2);
AddColumn
(momentumchg,"Mom-Chg%",1.2);
AddColumn
(ROC(C,Period)," 1 
mnth");
AddColumn
(YTD," 
YTD");
AddColumn
(ROC(C,MPT_Period)," 1 yr 
");