I am having trouble reading ATC fields "V" and "1" at several places in my code. The other fields work OK.
I am creating data for number of issues greater than their Moving Average and storing in ATCs.
Iam doing this for sectors, Industry groups and Industries ... same issue with all.
MA200 = MA( Close, 200 );
MA100 = MA( Close, 100 );
MA50 = MA( Close, 50 );
MA20 = MA( Close, 20 );
PB200 = Close > MA200;
PB100 = Close > MA100;
PB50 = Close > MA50;
PB20 = Close > MA20;
PBavg = (PB200 + PB100 + PB50) / 3;
ATCname = "~Ind-" + Industry + "-PBull";
//
AddToComposite( Close, ATCname, "C", atcFlagDefaults ); // Normalization not required.
AddToComposite( PB200, ATCname, "H", atcFlagDefaults ); // PB100
AddToComposite( PB100, ATCname, "O", atcFlagDefaults ); // PB200
AddToComposite( PB50, ATCname, "L", atcFlagDefaults ); // PB50
AddToComposite( PB20, ATCname, "V", atcFlagDefaults ); // PB20
AddToComposite( PBavg, ATCname, "1", atcFlagDefaults ); // PBaverage (200+100+50) / 3
AddToComposite( issue_count, ATCname, "I", atcFlagDefaults );ype or paste code here
when I read the ATC using the code below, field "V" has seemingly random numbers
//File: ATCread Test
//Issue: Field "V"
//
Sector = StrLeft(GICSID(0),2);
_N( ATCname = "~Sec-" + Sector + "-PBull" );
Sec_PB200_0 = Foreign( ATCname, "H" ); // Raw data
Sec_PB100_0 = Foreign( ATCname, "O" );
Sec_PB50_0 = Foreign( ATCname, "L" );
Sec_PB20_0 = Foreign( ATCname, "V" );
Sec_PBavg_0 = Foreign( ATCname, "1" ); // PBavg (200 + 100 + 50) / 3
Sec_PB_Count = Foreign( ATCname, "I" );
Sec_PB200_1 = Sec_PB200_0 / Sec_PB_Count * 100; // Normalized to percentages
Sec_PB100_1 = Sec_PB100_0 / Sec_PB_Count * 100;
Sec_PB50_1 = Sec_PB50_0 / Sec_PB_Count * 100;
Sec_PB20_1 = Sec_PB20_0 / Sec_PB_Count * 100;
Sec_PBavg_1 = Sec_PBavg_0 / Sec_PB_Count * 100;
//
printf("PB20_0 - Sector " + sector + " Count " + Sec_PB_Count + " PB20_0 " + Sec_PB20_0 + " PB200_0 " + Sec_PB200_0 + "\n");
printf("PB20_1 - Sector " + sector + " Count " + Sec_PB_Count + " PB20_1 " + Sec_PB20_1 + " PB200_0 " + Sec_PB200_1 + "\n");
//printf("PB20 - Sector " + sector + " Count " + Sec_PB_Count + " PB20 " + Sec_PB20 + " PB200 " + Sec_PB200 + "\n");
for (i=1; i <BarCount; i++)
{
_TRACE("Update Pbull-PB1 - i " + WriteVal(i,1.0) + " COunt " + writeval(Sec_PB_Count,1.0) + " PB20_0 " + writeval(Sec_PB20_0[i],1.0) + " PB20_1 " + writeval(Sec_PB20_1[i],1.0));
_TRACE("Update Pbull-PB2 - i " + WriteVal(i,1.0) + " COunt " + writeval(Sec_PB_Count,1.0) + " PB200_0 " + writeval(Sec_PB200_0[i],1.0) + " PB200_1 " + writeval(Sec_PB200_1[i],1.0));
}
//
//
Plot(Sec_PB200_1,"Sec_PB200",coloryellow,styleThick);
Plot(Sec_PB100_1,"Sec_PB100",colorblue,styleThick);
Plot(Sec_PB50_1, "Sec_PB50", colorred,styleThick);
Plot(Sec_PB20_1, "Sec_PB20", colorviolet,styleThick);
Plot(Sec_PBavg_1,"Sec_PBavg",colorwhite,styleThick);
Plot(50,"",colorblack,styleLine|stylenolabel); type or paste code here
The plot results below. The yellow, blue and red lines are OK. The purple line (field "V") is way above what it should be. The white line (field "1") is an average, also way too high.