AddTextColumn(WriteIf(Buy,"BUY","-"),"Buy?",1.2,colorWhite,colorGreen);
I thought using WriteIf() in the above was
legal, but it doesn't work. Can anyone
confirm or tell me if it's possible to get a
text column with WORDS in it instead of just 1 or 0? I am using 4.77 beta. I
also see Patrick has used the identical technique in "Efficient Stocks.afl"
(Van K Tharp
Efficient Stocks). This code does not work either
in 4.77 for the AddTextColumn portions where there is a WriteIf().
Here's some test code to try in
non beta version. Run an Explore.
"AddTextColumn Test";
SetChartOptions(1,chartShowDates);
/***************** CONSECUTIVE UP & DN DAYS *****************/
up = IIf(C >
Ref(C,-1),1,0);
dn = IIf(C <
Ref(C,-1),1,0);
runup = BarsSince(up == 0);
rundn = BarsSince(dn == 0);
ATRFast = ATR(20);
ATRSlow = ATR(100);
/********************** TRADE THE SYSTEM ************************/
Buy = dn AND
ATRFast > ATRSlow;
Sell = up;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
/********************** PLOTS ************************/
Plot(ATRFast,"ATRFast",colorRed);
Plot(ATRSlow,"ATRSlow",colorBlue);
/********************** EXPLORE ************************/
Filter = 1; //Buy OR Sell;
AddColumn(Buy,"BUY Value",1.0,colorGreen,colorWhite,75);
AddTextColumn(WriteIf(Buy,"BUY","-"),"Buy?",1.2,colorWhite,colorGreen);
AddColumn(Sell,"SELL Value",1.0,colorRed,colorWhite,75);
AddTextColumn(WriteIf(Sell,"SELL","-"),"Sell?",1.2,colorWhite,colorRed);
AddColumn(up,"Up",1.0,colorGreen,colorPaleGreen,75);
AddColumn(dn,"Dn",1.0,colorRed,colorPink,75);
AddColumn(ATRFast,"ATRFast",1.4,colorWhite,colorGreen);
AddColumn(ATRSlow,"ATRSlow",1.4,colorWhite,colorGreen);
AddTextColumn(WriteIf(ATRFast > ATRSlow,"ATR OK","ATR
Failed"),"ATR Check");
--
Terry