TJ
I want to take the family average of a watchlist and then plot the 
family average and explore the results. I'm using the following AFL.

// Hedge_Only.afl

// 1. (Task == 1)  In AA point to Watchlist to Hedge and Scan with n 
= 1 
// 2. (Task == 2)  Set to current symbol for plot and explore

Task = Param("Task",1,1,2,1); 

if(Task == 1) // point to watchlist for fam average to hedge, set 
range n = 1, and Scan
{
Buy = 1; Sell = Short = Cover = 0;// need for scan
Change = ROC(C,1)/100;
AddToComposite(Change,"~Change","X");
AddToComposite(1 , "~Counter","X"); // No of Stks
} // end of Task == 1

if(Task == 2) // Hedge and Plot and Explore
{
FamChange = Foreign("~Change","X");
NoStks = Foreign("~Counter","X");
NoStks = IIf(NoStks > 0,NoStks,1);
AvgChange = FamChange/NoStks ;
CumSum =Cum(log(AvgChange + 1));
FamAvgL = exp(CumSum); // fam avg of long watchlist for hedging

Plot(FamAvgL, "BH FamAvg",colorBlack,styleLine|styleThick );

Filter = 1;
AddColumn(FamAvgL,"BH ");

} // end of Task == 2

After scanning the watchlist using task == 1, I switch to Task == 2
and explore.
The problem is the plot changes when I change the current symbol.
WHY?
How am I suppose to do this?
Dan


Reply via email to