Sectorwise CSV Generator AFL For Amibroker

 Sectorwise CSV Generator AFL For Amibroker


Code:



////Sectoral CSV Genarator
fmkdir( "C:\\00 Sector Data" );
//frmdir( "C:\\00 Sector Data" );
_SECTION_BEGIN("BANK"); 
S1=Foreign("ABBANK","Open");
S2=Foreign("ALARABANK","Open");
S3=Foreign("BANKASIA","Open");
S4=Foreign("BRACBANK","Open");
S5=Foreign("CITYBANK","Open");
S6=Foreign("DHAKABANK","Open");
S7=Foreign("DUTCHBANGL","Open");
S8=Foreign("EBL","Open");
S9=Foreign("EXIMBANK","Open");
S10=Foreign("FIRSTSBANK","Open");
S11=Foreign("ICBIBANK","Open");
S12=Foreign("IFIC","Open");
S13=Foreign("ISLAMIBANK","Open");
S14=Foreign("JAMUNABANK","Open");
S15=Foreign("MERCANBANK","Open");
S16=Foreign("MTBL","Open");
S17=Foreign("NBL","Open");
S18=Foreign("NCCBANK","Open");
S19=Foreign("ONEBANKLTD","Open");
S20=Foreign("PREMIERBAN","Open");
S21=Foreign("PRIMEBANK","Open");
S22=Foreign("PUBALIBANK","Open");
S23=Foreign("RUPALIBANK","Open");
S24=Foreign("SHAHJABANK","Open");
S25=Foreign("SIBL","Open");
S26=Foreign("SOUTHEASTB","Open");
S27=Foreign("STANDBANKL","Open");
S28=Foreign("TRUSTBANK","Open");
S29=Foreign("UCBL","Open");
S30=Foreign("UTTARABANK","Open");
AvgOpen = (S1+S2+S3+S4+S5+S6+S7+S8+S9+S10+S11+S12+S13+S14+S15+S16+S17+S18+S19+S20+S22+S23+S24+S25+S26+S27+S28+S29+S30 )/30;
Open = AvgOpen;

S1=Foreign("ABBANK","High");
S2=Foreign("ALARABANK","High");
S3=Foreign("BANKASIA","High");
S4=Foreign("BRACBANK","High");
S5=Foreign("CITYBANK","High");
S6=Foreign("DHAKABANK","High");
S7=Foreign("DUTCHBANGL","High");
S8=Foreign("EBL","High");
S9=Foreign("EXIMBANK","High");
S10=Foreign("FIRSTSBANK","High");
S11=Foreign("ICBIBANK","High");
S12=Foreign("IFIC","High");
S13=Foreign("ISLAMIBANK","High");
S14=Foreign("JAMUNABANK","High");
S15=Foreign("MERCANBANK","High");
S16=Foreign("MTBL","High");
S17=Foreign("NBL","High");
S18=Foreign("NCCBANK","High");
S19=Foreign("ONEBANKLTD","High");
S20=Foreign("PREMIERBAN","High");
S21=Foreign("PRIMEBANK","High");
S22=Foreign("PUBALIBANK","High");
S23=Foreign("RUPALIBANK","High");
S24=Foreign("SHAHJABANK","High");
S25=Foreign("SIBL","High");
S26=Foreign("SOUTHEASTB","High");
S27=Foreign("STANDBANKL","High");
S28=Foreign("TRUSTBANK","High");
S29=Foreign("UCBL","High");
S30=Foreign("UTTARABANK","High");
AvgHigh = (S1+S2+S3+S4+S5+S6+S7+S8+S9+S10+S11+S12+S13+S14+S15+S16+S17+S18+S19+S20+S22+S23+S24+S25+S26+S27+S28+S29+S30)/30;
High = AvgHigh;

S1=Foreign("ABBANK","Low");
S2=Foreign("ALARABANK","Low");
S3=Foreign("BANKASIA","Low");
S4=Foreign("BRACBANK","Low");
S5=Foreign("CITYBANK","Low");
S6=Foreign("DHAKABANK","Low");
S7=Foreign("DUTCHBANGL","Low");
S8=Foreign("EBL","Low");
S9=Foreign("EXIMBANK","Low");
S10=Foreign("FIRSTSBANK","Low");
S11=Foreign("ICBIBANK","Low");
S12=Foreign("IFIC","Low");
S13=Foreign("ISLAMIBANK","Low");
S14=Foreign("JAMUNABANK","Low");
S15=Foreign("MERCANBANK","Low");
S16=Foreign("MTBL","Low");
S17=Foreign("NBL","Low");
S18=Foreign("NCCBANK","Low");
S19=Foreign("ONEBANKLTD","Low");
S20=Foreign("PREMIERBAN","Low");
S21=Foreign("PRIMEBANK","Low");
S22=Foreign("PUBALIBANK","Low");
S23=Foreign("RUPALIBANK","Low");
S24=Foreign("SHAHJABANK","Low");
S25=Foreign("SIBL","Low");
S26=Foreign("SOUTHEASTB","Low");
S27=Foreign("STANDBANKL","Low");
S28=Foreign("TRUSTBANK","Low");
S29=Foreign("UCBL","Low");
S30=Foreign("UTTARABANK","Low");
AvgLow = (S1+S2+S3+S4+S5+S6+S7+S8+S9+S10+S11+S12+S13+S14+S15+S16+S17+S18+S19+S20+S22+S23+S24+S25+S26+S27+S28+S29+S30)/30;
Low = AvgLow;

S1=Foreign("ABBANK","Close");
S2=Foreign("ALARABANK","Close");
S3=Foreign("BANKASIA","Close");
S4=Foreign("BRACBANK","Close");
S5=Foreign("CITYBANK","Close");
S6=Foreign("DHAKABANK","Close");
S7=Foreign("DUTCHBANGL","Close");
S8=Foreign("EBL","Close");
S9=Foreign("EXIMBANK","Close");
S10=Foreign("FIRSTSBANK","Close");
S11=Foreign("ICBIBANK","Close");
S12=Foreign("IFIC","Close");
S13=Foreign("ISLAMIBANK","Close");
S14=Foreign("JAMUNABANK","Close");
S15=Foreign("MERCANBANK","Close");
S16=Foreign("MTBL","Close");
S17=Foreign("NBL","Close");
S18=Foreign("NCCBANK","Close");
S19=Foreign("ONEBANKLTD","Close");
S20=Foreign("PREMIERBAN","Close");
S21=Foreign("PRIMEBANK","Close");
S22=Foreign("PUBALIBANK","Close");
S23=Foreign("RUPALIBANK","Close");
S24=Foreign("SHAHJABANK","Close");
S25=Foreign("SIBL","Close");
S26=Foreign("SOUTHEASTB","Close");
S27=Foreign("STANDBANKL","Close");
S28=Foreign("TRUSTBANK","Close");
S29=Foreign("UCBL","Close");
S30=Foreign("UTTARABANK","Close");
AvgClose = (S1+S2+S3+S4+S5+S6+S7+S8+S9+S10+S11+S12+S13+S14+S15+S16+S17+S18+S19+S20+S22+S23+S24+S25+S26+S27+S28+S29+S30)/30;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,AvgClose,"BK",color,ParamStyle("BANK",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );

S1=Foreign("ABBANK","Volume");
S2=Foreign("ALARABANK","Volume");
S3=Foreign("BANKASIA","Volume");
S4=Foreign("BRACBANK","Volume");
S5=Foreign("CITYBANK","Volume");
S6=Foreign("DHAKABANK","Volume");
S7=Foreign("DUTCHBANGL","Volume");
S8=Foreign("EBL","Volume");
S9=Foreign("EXIMBANK","Volume");
S10=Foreign("FIRSTSBANK","Volume");
S11=Foreign("ICBIBANK","Volume");
S12=Foreign("IFIC","Volume");
S13=Foreign("ISLAMIBANK","Volume");
S14=Foreign("JAMUNABANK","Volume");
S15=Foreign("MERCANBANK","Volume");
S16=Foreign("MTBL","Volume");
S17=Foreign("NBL","Volume");
S18=Foreign("NCCBANK","Volume");
S19=Foreign("ONEBANKLTD","Volume");
S20=Foreign("PREMIERBAN","Volume");
S21=Foreign("PRIMEBANK","Volume");
S22=Foreign("PUBALIBANK","Volume");
S23=Foreign("RUPALIBANK","Volume");
S24=Foreign("SHAHJABANK","Volume");
S25=Foreign("SIBL","Volume");
S26=Foreign("SOUTHEASTB","Volume");
S27=Foreign("STANDBANKL","Volume");
S28=Foreign("TRUSTBANK","Volume");
S29=Foreign("UCBL","Volume");
S30=Foreign("UTTARABANK","Volume");
AvgVolume= (S1+S2+S3+S4+S5+S6+S7+S8+S9+S10+S11+S12+S13+S14+S15+S16+S17+S18+S19+S20+S22+S23+S24+S25+S26+S27+S28+S29+S30)/30;
Volume = AvgVolume;
///////////////////////////////
OpenVolume=0;
CloseVolume=AvgVolume; 

bnupbar = AvgClose > Ref(AvgClose,-1); 
bndownbar = AvgClose< Ref(AvgClose,-1);
barcolor=IIf(bndownbar, colorRed, IIf(bnupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("BANK",styleCandle|styleOwnScale|Stylehidden,mask = maskAll),7);



fh = fopen( "C:\\00 Sector Data\\01_BANK.csv", "w"); 
if( fh ) 
fputs( "Symbols,Date,Open,High,Low,Close,Volume\n", fh );  
d = Day();  
m = Month();   
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "01_BANK" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh );  } fclose( fh ); } 
_SECTION_END();


_SECTION_BEGIN("NBFI");
f1=Foreign("BAYLEASING","Open");
f2=Foreign("BDFINANCE","Open");
f3=Foreign("BIFC","Open");
f4=Foreign("DBH","Open");
f5=Foreign("FASFIN","Open");
f6=Foreign("FLEASEINT","Open");
//f7=Foreign("GSPFINANCE","Open");
f8=Foreign("ICB","Open");
f9=Foreign("IDLC","Open");
f10=Foreign("ILFSL","Open");
f11=Foreign("IPDC","Open");
f12=Foreign("ISLAMICFIN","Open");
f13=Foreign("LANKABAFIN","Open");
f14=Foreign("MIDASFIN","Open");
f15=Foreign("NHFIL","Open");
f16=Foreign("PHOENIXFIN","Open");
f17=Foreign("PLFSL","Open");
f18=Foreign("PREMIERLEA","Open");
f19=Foreign("PRIMEFIN","Open");
f20=Foreign("ULC","Open");
f21=Foreign("UNIONCAP","Open");
f22=Foreign("UTTARAFIN","Open");
AvgOpen=(f1+f2+f3+f4+f5+f6+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18+f19+f20+f21+f22)/21;
Open = AvgOpen;

f1=Foreign("BAYLEASING","High");
f2=Foreign("BDFINANCE","High");
f3=Foreign("BIFC","High");
f4=Foreign("DBH","High");
f5=Foreign("FASFIN","High");
f6=Foreign("FLEASEINT","High");
//f7=Foreign("GSPFINANCE","High");
f8=Foreign("ICB","High");
f9=Foreign("IDLC","High");
f10=Foreign("ILFSL","High");
f11=Foreign("IPDC","High");
f12=Foreign("ISLAMICFIN","High");
f13=Foreign("LANKABAFIN","High");
f14=Foreign("MIDASFIN","High");
f15=Foreign("NHFIL","High");
f16=Foreign("PHOENIXFIN","High");
f17=Foreign("PLFSL","High");
f18=Foreign("PREMIERLEA","High");
f19=Foreign("PRIMEFIN","High");
f20=Foreign("ULC","High");
f21=Foreign("UNIONCAP","High");
f22=Foreign("UTTARAFIN","High");
AvgHigh=(f1+f2+f3+f4+f5+f6+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18+f19+f20+f21+f22)/21;
High = AvgHigh;

f1=Foreign("BAYLEASING","Low");
f2=Foreign("BDFINANCE","Low");
f3=Foreign("BIFC","Low");
f4=Foreign("DBH","Low");
f5=Foreign("FASFIN","Low");
f6=Foreign("FLEASEINT","Low");
//f7=Foreign("GSPFINANCE","Low");
f8=Foreign("ICB","Low");
f9=Foreign("IDLC","Low");
f10=Foreign("ILFSL","Low");
f11=Foreign("IPDC","Low");
f12=Foreign("ISLAMICFIN","Low");
f13=Foreign("LANKABAFIN","Low");
f14=Foreign("MIDASFIN","Low");
f15=Foreign("NHFIL","Low");
f16=Foreign("PHOENIXFIN","Low");
f17=Foreign("PLFSL","Low");
f18=Foreign("PREMIERLEA","Low");
f19=Foreign("PRIMEFIN","Low");
f20=Foreign("ULC","Low");
f21=Foreign("UNIONCAP","Low");
f22=Foreign("UTTARAFIN","Low");
AvgLow=(f1+f2+f3+f4+f5+f6+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18+f19+f20+f21+f22)/21;
Low = AvgLow;

f1=Foreign("BAYLEASING","Close");
f2=Foreign("BDFINANCE","Close");
f3=Foreign("BIFC","Close");
f4=Foreign("DBH","Close");
f5=Foreign("FASFIN","Close");
f6=Foreign("FLEASEINT","Close");
//f7=Foreign("GSPFINANCE","Close");
f8=Foreign("ICB","Close");
f9=Foreign("IDLC","Close");
f10=Foreign("ILFSL","Close");
f11=Foreign("IPDC","Close");
f12=Foreign("ISLAMICFIN","Close");
f13=Foreign("LANKABAFIN","Close");
f14=Foreign("MIDASFIN","Close");
f15=Foreign("NHFIL","Close");
f16=Foreign("PHOENIXFIN","Close");
f17=Foreign("PLFSL","Close");
f18=Foreign("PREMIERLEA","Close");
f19=Foreign("PRIMEFIN","Close");
f20=Foreign("ULC","Close");
f21=Foreign("UNIONCAP","Close");
f22=Foreign("UTTARAFIN","Close");
AvgClose=(f1+f2+f3+f4+f5+f6+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18+f19+f20+f21+f22)/21;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,AvgClose,"FN",color,ParamStyle("NBFI",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );

f1=Foreign("BAYLEASING","Volume");
f2=Foreign("BDFINANCE","Volume");
f3=Foreign("BIFC","Volume");
f4=Foreign("DBH","Volume");
f5=Foreign("FASFIN","Volume");
f6=Foreign("FLEASEINT","Volume");
//f7=Foreign("GSPFINANCE","Volume");
f8=Foreign("ICB","Volume");
f9=Foreign("IDLC","Volume");
f10=Foreign("ILFSL","Volume");
f11=Foreign("IPDC","Volume");
f12=Foreign("ISLAMICFIN","Volume");
f13=Foreign("LANKABAFIN","Volume");
f14=Foreign("MIDASFIN","Volume");
f15=Foreign("NHFIL","Volume");
f16=Foreign("PHOENIXFIN","Volume");
f17=Foreign("PLFSL","Volume");
f18=Foreign("PREMIERLEA","Volume");
f19=Foreign("PRIMEFIN","Volume");
f20=Foreign("ULC","Volume");
f21=Foreign("UNIONCAP","Volume");
f22=Foreign("UTTARAFIN","Volume");

AvgVolume=(f1+f2+f3+f4+f5+f6+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18+f19+f20+f21+f22)/21;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

fnupbar = AvgVolume > Ref(AvgVolume,-1); 
fndownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(fndownbar, colorRed, IIf(fnupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("NBFI",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\02_NBFI.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh ); 
d = Day(); 
m = Month();    
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "02_NBFI" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ],  Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
 O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
} fclose( fh ); 
_SECTION_END();


_SECTION_BEGIN("GENERAL INSURANCE");
in1 = Foreign( "AGRANINS", "Open" ) ;
in2 = Foreign( "ASIAPACINS", "Open" ) ;
in3 = Foreign( "BGIC", "Open" ) ;
in4 = Foreign( "CENTRALINS", "Open" ) ;
in5 = Foreign( "CITYGENINS", "Open" ) ;
in6 = Foreign( "CONTININS", "Open" ) ;
in7 = Foreign( "EASTERNINS", "Open" ) ;
in8 = Foreign( "EASTLAND", "Open" ) ;
in9= Foreign( "FEDERALINS", "Open" ) ;
in10= Foreign( "GLOBALINS", "Open" ) ;
in11 = Foreign( "GREENDELT", "Open" ) ;
in12 = Foreign( "JANATAINS", "Open" ) ;
in13 = Foreign( "KARNAPHULI", "Open" ) ;
in14 = Foreign( "MERCINS", "Open" ) ;
in15 = Foreign( "NITOLINS", "Open" ) ;
in16 = Foreign( "PARAMOUNT", "Open" ) ;
in17 = Foreign( "PEOPLESINS", "Open" ) ;
in18 = Foreign( "PHENIXINS", "Open" ) ;
in19 = Foreign( "PIONEERINS", "Open" ) ;
in20 = Foreign( "PRAGATIINS", "Open" ) ;
in21 = Foreign( "PRIMEINSUR", "Open" ) ;
in22 = Foreign( "PURABIGEN", "Open" ) ;
in23 = Foreign( "RELIANCINS", "Open" ) ;
in24 = Foreign( "RUPALIINS", "Open" ) ;
in25 = Foreign( "SONARBAINS", "Open" ) ;
in26 = Foreign( "UNITEDINS", "Open" ) ;
in27 = Foreign( "ASIAINS", "Open" ) ;
in28 = Foreign( "DHAKAINS", "Open" ) ;
in29 = Foreign( "UNITEDINS", "Open" ) ;
in30 = Foreign( "ISLAMIINS", "Open" ) ;
in31 = Foreign( "PROVATIINS", "Open" ) ;
in32 = Foreign( "REPUBLIC", "Open" ) ;
in33 = Foreign( "NORTHRNINS", "Open" ) ;
in34 = Foreign( "STANDARINS", "Open" ) ;
AvgOpen = (IN1+IN2+IN3+IN4+IN5+IN6+IN7+IN8+IN9+IN10+IN11+IN12+IN13+IN14+IN15+IN16+IN17+IN18+IN19+IN20+ IN21+IN22+IN23+IN24+IN25+IN26+IN27+IN28+IN29+IN30+IN31+IN32+IN33+IN34)/34;
Open = AvgOpen;

in1 = Foreign( "AGRANINS", "High" ) ;
in2 = Foreign( "ASIAPACINS", "High" ) ;
in3 = Foreign( "BGIC", "High" ) ;
in4 = Foreign( "CENTRALINS", "High" ) ;
in5 = Foreign( "CITYGENINS", "High" ) ;
in6 = Foreign( "CONTININS", "High" ) ;
in7 = Foreign( "EASTERNINS", "High" ) ;
in8 = Foreign( "EASTLAND", "High" ) ;
in9= Foreign( "FEDERALINS", "High" ) ;
in10= Foreign( "GLOBALINS", "High" ) ;
in11 = Foreign( "GREENDELT", "High" ) ;
in12 = Foreign( "JANATAINS", "High" ) ;
in13 = Foreign( "KARNAPHULI", "High" ) ;
in14 = Foreign( "MERCINS", "High" ) ;
in15 = Foreign( "NITOLINS", "High" ) ;
in16 = Foreign( "PARAMOUNT", "High" ) ;
in17 = Foreign( "PEOPLESINS", "High" ) ;
in18 = Foreign( "PHENIXINS", "High" ) ;
in19 = Foreign( "PIONEERINS", "High" ) ;
in20 = Foreign( "PRAGATIINS", "High" ) ;
in21 = Foreign( "PRIMEINSUR", "High" ) ;
in22 = Foreign( "PURABIGEN", "High" ) ;
in23 = Foreign( "RELIANCINS", "High" ) ;
in24 = Foreign( "RUPALIINS", "High" ) ;
in25 = Foreign( "SONARBAINS", "High" ) ;
in26 = Foreign( "UNITEDINS", "High" ) ;
in27 = Foreign( "ASIAINS", "High" ) ;
in28 = Foreign( "DHAKAINS", "High" ) ;
in29 = Foreign( "UNITEDINS", "High" ) ;
in30 = Foreign( "ISLAMIINS", "High" ) ;
in31 = Foreign( "PROVATIINS", "High" ) ;
in32 = Foreign( "REPUBLIC", "High" ) ;
in33 = Foreign( "NORTHRNINS", "High" ) ;
in34 = Foreign( "STANDARINS", "High" ) ;
AvgHigh = (IN1+IN2+IN3+IN4+IN5+IN6+IN7+IN8+IN9+IN10+IN11+IN12+IN13+IN14+IN15+IN16+IN17+IN18+IN19+IN20+ IN21+IN22+IN23+IN24+IN25+IN26+IN27+IN28+IN29+IN30+IN31+IN32+IN33+IN34)/34;
High = AvgHigh;

in1 = Foreign( "AGRANINS", "Low" ) ;
in2 = Foreign( "ASIAPACINS", "Low" ) ;
in3 = Foreign( "BGIC", "Low" ) ;
in4 = Foreign( "CENTRALINS", "Low" ) ;
in5 = Foreign( "CITYGENINS", "Low" ) ;
in6 = Foreign( "CONTININS", "Low" ) ;
in7 = Foreign( "EASTERNINS", "Low" ) ;
in8 = Foreign( "EASTLAND", "Low" ) ;
in9= Foreign( "FEDERALINS", "Low" ) ;
in10= Foreign( "GLOBALINS", "Low" ) ;
in11 = Foreign( "GREENDELT", "Low" ) ;
in12 = Foreign( "JANATAINS", "Low" ) ;
in13 = Foreign( "KARNAPHULI", "Low" ) ;
in14 = Foreign( "MERCINS", "Low" ) ;
in15 = Foreign( "NITOLINS", "Low" ) ;
in16 = Foreign( "PARAMOUNT", "Low" ) ;
in17 = Foreign( "PEOPLESINS", "Low" ) ;
in18 = Foreign( "PHENIXINS", "Low" ) ;
in19 = Foreign( "PIONEERINS", "Low" ) ;
in20 = Foreign( "PRAGATIINS", "Low" ) ;
in21 = Foreign( "PRIMEINSUR", "Low" ) ;
in22 = Foreign( "PURABIGEN", "Low" ) ;
in23 = Foreign( "RELIANCINS", "Low" ) ;
in24 = Foreign( "RUPALIINS", "Low" ) ;
in25 = Foreign( "SONARBAINS", "Low" ) ;
in26 = Foreign( "UNITEDINS", "Low" ) ;
in27 = Foreign( "ASIAINS", "Low" ) ;
in28 = Foreign( "DHAKAINS", "Low" ) ;
in29 = Foreign( "UNITEDINS", "Low" ) ;
in30 = Foreign( "ISLAMIINS", "Low" ) ;
in31 = Foreign( "PROVATIINS", "Low" ) ;
in32 = Foreign( "REPUBLIC", "Low" ) ;
in33 = Foreign( "NORTHRNINS", "Low" ) ;
in34 = Foreign( "STANDARINS", "Low" ) ;
AvgLow= (IN1+IN2+IN3+IN4+IN5+IN6+IN7+IN8+IN9+IN10+IN11+IN12+IN13+IN14+IN15+IN16+IN17+IN18+IN19+IN20+ IN21+IN22+IN23+IN24+IN25+IN26+IN27+IN28+IN29+IN30+IN31+IN32+IN33+IN34)/34;
Low = AvgLow;

in1 = Foreign( "AGRANINS", "Close" ) ;
in2 = Foreign( "ASIAPACINS", "Close" ) ;
in3 = Foreign( "BGIC", "Close" ) ;
in4 = Foreign( "CENTRALINS", "Close" ) ;
in5 = Foreign( "CITYGENINS", "Close" ) ;
in6 = Foreign( "CONTININS", "Close" ) ;
in7 = Foreign( "EASTERNINS", "Close" ) ;
in8 = Foreign( "EASTLAND", "Close" ) ;
in9= Foreign( "FEDERALINS", "Close" ) ;
in10= Foreign( "GLOBALINS", "Close" ) ;
in11 = Foreign( "GREENDELT", "Close" ) ;
in12 = Foreign( "JANATAINS", "Close" ) ;
in13 = Foreign( "KARNAPHULI", "Close" ) ;
in14 = Foreign( "MERCINS", "Close" ) ;
in15 = Foreign( "NITOLINS", "Close" ) ;
in16 = Foreign( "PARAMOUNT", "Close" ) ;
in17 = Foreign( "PEOPLESINS", "Close" ) ;
in18 = Foreign( "PHENIXINS", "Close" ) ;
in19 = Foreign( "PIONEERINS", "Close" ) ;
in20 = Foreign( "PRAGATIINS", "Close" ) ;
in21 = Foreign( "PRIMEINSUR", "Close" ) ;
in22 = Foreign( "PURABIGEN", "Close" ) ;
in23 = Foreign( "RELIANCINS", "Close" ) ;
in24 = Foreign( "RUPALIINS", "Close" ) ;
in25 = Foreign( "SONARBAINS", "Close" ) ;
in26 = Foreign( "UNITEDINS", "Close" ) ;
in27 = Foreign( "ASIAINS", "Close" ) ;
in28 = Foreign( "DHAKAINS", "Close" ) ;
in29 = Foreign( "UNITEDINS", "Close" ) ;
in30 = Foreign( "ISLAMIINS", "Close" ) ;
in31 = Foreign( "PROVATIINS", "Close" ) ;
in32 = Foreign( "REPUBLIC", "Close" ) ;
in33 = Foreign( "NORTHRNINS", "Close" ) ;
in34 = Foreign( "STANDARINS", "Close" ) ;
AvgClose = (IN1+IN2+IN3+IN4+IN5+IN6+IN7+IN8+IN9+IN10+IN11+IN12+IN13+IN14+IN15+IN16+IN17+IN18+IN19+IN20+ IN21+IN22+IN23+IN24+IN25+IN26+IN27+IN28+IN29+IN30+IN31+IN32+IN33+IN34)/34;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"GEN",color,ParamStyle("GENERAL_INSURANCE",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );


in1 = Foreign( "AGRANINS", "Volume" ) ;
in2 = Foreign( "ASIAPACINS", "Volume" ) ;
in3 = Foreign( "BGIC", "Volume" ) ;
in4 = Foreign( "CENTRALINS", "Volume" ) ;
in5 = Foreign( "CITYGENINS", "Volume" ) ;
in6 = Foreign( "CONTININS", "Volume" ) ;
in7 = Foreign( "EASTERNINS", "Volume" ) ;
in8 = Foreign( "EASTLAND", "Volume" ) ;
in9= Foreign( "FEDERALINS", "Volume" ) ;
in10= Foreign( "GLOBALINS", "Volume" ) ;
in11 = Foreign( "GREENDELT", "Volume" ) ;
in12 = Foreign( "JANATAINS", "Volume" ) ;
in13 = Foreign( "KARNAPHULI", "Volume" ) ;
in14 = Foreign( "MERCINS", "Volume" ) ;
in15 = Foreign( "NITOLINS", "Volume" ) ;
in16 = Foreign( "PARAMOUNT", "Volume" ) ;
in17 = Foreign( "PEOPLESINS", "Volume" ) ;
in18 = Foreign( "PHENIXINS", "Volume" ) ;
in19 = Foreign( "PIONEERINS", "Volume" ) ;
in20 = Foreign( "PRAGATIINS", "Volume" ) ;
in21 = Foreign( "PRIMEINSUR", "Volume" ) ;
in22 = Foreign( "PURABIGEN", "Volume" ) ;
in23 = Foreign( "RELIANCINS", "Volume" ) ;
in24 = Foreign( "RUPALIINS", "Volume" ) ;
in25 = Foreign( "SONARBAINS", "Volume" ) ;
in26 = Foreign( "UNITEDINS", "Volume" ) ;
in27 = Foreign( "ASIAINS", "Volume" ) ;
in28 = Foreign( "DHAKAINS", "Volume" ) ;
in29 = Foreign( "UNITEDINS", "Volume" ) ;
in30 = Foreign( "ISLAMIINS", "Volume" ) ;
in31 = Foreign( "PROVATIINS", "Volume" ) ;
in32 = Foreign( "REPUBLIC", "Volume" ) ;
in33 = Foreign( "NORTHRNINS", "Volume" ) ;
in34 = Foreign( "STANDARINS", "Volume" ) ;
AvgOpen = (IN1+IN2+IN3+IN4+IN5+IN6+IN7+IN8+IN9+IN10+IN11+IN12+IN13+IN14+IN15+IN16+IN17+IN18+IN19+IN20+ IN21+IN22+IN23+IN24+IN25+IN26+IN27+IN28+IN29+IN30+IN31+IN32+IN33+IN34)/34;
Volume = AvgVolume;
OpenVolume=0;
CloseVolume=AvgVolume;

giupbar = AvgVolume > Ref(AvgVolume,-1); 
gidownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(gidownbar, colorRed, IIf(giupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("General Insurance",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);


fh = fopen( "C:\\00 Sector Data\\03_GENERAL_INSURANCE.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh ); 
d = Day();
m = Month();
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "03_GENERAL_INSURANCE" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
 O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();


_SECTION_BEGIN("LIFE_INSURANCE");
L1 = Foreign( "DELTALIFE", "Open" ) ;
L2 = Foreign( "FAREASTLIF", "Open" ) ;
L3 = Foreign( "MEGHNALIFE", "Open" ) ;
L4 = Foreign( "NATLIFEINS", "Open" ) ;
//L5 = Foreign( "PADMALIFE", "Open" ) ;
L6 = Foreign( "POPULARLIF", "Open" ) ;
L7 = Foreign( "PRAGATILIF", "Open" ) ;
L8 = Foreign( "PRIMELIFE", "Open" ) ;
L9 = Foreign( "PROGRESLIF", "Open" ) ;
L10 = Foreign( "RUPALILIFE", "Open" ) ;
L11 = Foreign( "SANDHANINS", "Open" ) ;
AvgOpen= (L1+L2+L3+L4+L6+L7+L8+L9+L10+L11)/10;
Open = AvgOpen;

L1 = Foreign( "DELTALIFE", "High" ) ;
L2 = Foreign( "FAREASTLIF", "High" ) ;
L3 = Foreign( "MEGHNALIFE", "High" ) ;
L4 = Foreign( "NATLIFEINS", "High" ) ;
//L5 = Foreign( "PADMALIFE", "High" ) ;
L6 = Foreign( "POPULARLIF", "High" ) ;
L7 = Foreign( "PRAGATILIF", "High" ) ;
L8 = Foreign( "PRIMELIFE", "High" ) ;
L9 = Foreign( "PROGRESLIF", "High" ) ;
L10 = Foreign( "RUPALILIFE", "High" ) ;
L11 = Foreign( "SANDHANINS", "High" ) ;
AvgHigh= (L1+L2+L3+L4+L6+L7+L8+L9+L10+L11)/10;
High = AvgHigh;

L1 = Foreign( "DELTALIFE", "Low" ) ;
L2 = Foreign( "FAREASTLIF", "Low" ) ;
L3 = Foreign( "MEGHNALIFE", "Low" ) ;
L4 = Foreign( "NATLIFEINS", "Low" ) ;
//L5 = Foreign( "PADMALIFE", "Low" ) ;
L6 = Foreign( "POPULARLIF", "Low" ) ;
L7 = Foreign( "PRAGATILIF", "Low" ) ;
L8 = Foreign( "PRIMELIFE", "Low" ) ;
L9 = Foreign( "PROGRESLIF", "Low" ) ;
L10 = Foreign( "RUPALILIFE", "Low" ) ;
L11 = Foreign( "SANDHANINS", "Low" ) ;
AvgLow= (L1+L2+L3+L4+L6+L7+L8+L9+L10+L11)/10;
Low = AvgLow;

L1 = Foreign( "DELTALIFE", "Close" ) ;
L2 = Foreign( "FAREASTLIF", "Close" ) ;
L3 = Foreign( "MEGHNALIFE", "Close" ) ;
L4 = Foreign( "NATLIFEINS", "Close" ) ;
//L5 = Foreign( "PADMALIFE", "Close" ) ;
L6 = Foreign( "POPULARLIF", "Close" ) ;
L7 = Foreign( "PRAGATILIF", "Close" ) ;
L8 = Foreign( "PRIMELIFE", "Close" ) ;
L9 = Foreign( "PROGRESLIF", "Close" ) ;
L10 = Foreign( "RUPALILIFE", "Close" ) ;
L11 = Foreign( "SANDHANINS", "Close" ) ;
AvgClose= (L1+L2+L3+L4+L6+L7+L8+L9+L10+L11)/10;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"LIF",color,ParamStyle("LIFE_INSURANCE",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );

L1 = Foreign( "DELTALIFE", "Volume" ) ;
L2 = Foreign( "FAREASTLIF", "Volume" ) ;
L3 = Foreign( "MEGHNALIFE", "Volume" ) ;
L4 = Foreign( "NATLIFEINS", "Volume" ) ;
//L5 = Foreign( "PADMALIFE", "Volume" ) ;
L6 = Foreign( "POPULARLIF", "Volume" ) ;
L7 = Foreign( "PRAGATILIF", "Volume" ) ;
L8 = Foreign( "PRIMELIFE", "Volume" ) ;
L9 = Foreign( "PROGRESLIF", "Volume" ) ;
L10 = Foreign( "RUPALILIFE", "Volume" ) ;
L11 = Foreign( "SANDHANINS", "Volume" ) ;
AvgVolume= (L1+L2+L3+L4+L6+L7+L8+L9+L10+L11)/10;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

liupbar = AvgVolume > Ref(AvgVolume,-1); 
lidownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(lidownbar, colorRed, IIf(liupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("LIFE_INSURANCE",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\04_LIFE_INSURANCE.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh ); 
d = Day(); 
m = Month();  
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "04_LIFE_INSURANCE" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();


_SECTION_BEGIN("Fuel_Power");
FP1=Foreign("BDWELDING","Open");
FP2=Foreign("BEDL","Open");
//FP3=Foreign("GBBPOWER","Open");
FP4=Foreign("DESCO","Open");
FP5=Foreign("EASTRNLUB","Open");
FP6=Foreign("JAMUNAOIL","Open");
FP7=Foreign("KPCL","Open");
//FP8=Foreign("LINDEBD","Open");
FP9=Foreign("MJLBD","Open");
FP10=Foreign("MPETROLEUM","Open");
FP11=Foreign("PADMAOIL","Open");
FP12=Foreign("POWERGRID","Open");
FP13=Foreign("SUMITPOWER","Open");
FP14=Foreign("TITASGAS","Open");

AvgOpen= (FP1+FP2+FP4+FP5+FP6+FP7+FP9+FP10+FP11+FP12+FP13+FP14)/13;
Open = AvgOpen;

FP1=Foreign("BDWELDING","High");
FP2=Foreign("BEDL","High");
//FP3=Foreign("GBBPOWER","High");
FP4=Foreign("DESCO","High");
FP5=Foreign("EASTRNLUB","High");
FP6=Foreign("JAMUNAOIL","High");
FP7=Foreign("KPCL","High");
//FP8=Foreign("LINDEBD","High");
FP9=Foreign("MJLBD","High");
FP10=Foreign("MPETROLEUM","High");
FP11=Foreign("PADMAOIL","High");
FP12=Foreign("POWERGRID","High");
FP13=Foreign("SUMITPOWER","High");
FP14=Foreign("TITASGAS","High");

AvgHigh= (FP1+FP2+FP4+FP5+FP6+FP7+FP9+FP10+FP11+FP12+FP13+FP14)/13;
High = AvgHigh;

FP1=Foreign("BDWELDING","Low");
FP2=Foreign("BEDL","Low");
//FP3=Foreign("GBBPOWER","Low");
FP4=Foreign("DESCO","Low");
FP5=Foreign("EASTRNLUB","Low");
FP6=Foreign("JAMUNAOIL","Low");
FP7=Foreign("KPCL","Low");
//FP8=Foreign("LINDEBD","Low");
FP9=Foreign("MJLBD","Low");
FP10=Foreign("MPETROLEUM","Low");
FP11=Foreign("PADMAOIL","Low");
FP12=Foreign("POWERGRID","Low");
FP13=Foreign("SUMITPOWER","Low");
FP14=Foreign("TITASGAS","Low");

AvgLow= (FP1+FP2+FP4+FP5+FP6+FP7+FP9+FP10+FP11+FP12+FP13+FP14)/13;
Low = AvgLow;

FP1=Foreign("BDWELDING","Close");
FP2=Foreign("BEDL","Close");
//FP3=Foreign("GBBPOWER","Close");
FP4=Foreign("DESCO","Close");
FP5=Foreign("EASTRNLUB","Close");
FP6=Foreign("JAMUNAOIL","Close");
FP7=Foreign("KPCL","Close");
//FP8=Foreign("LINDEBD","Close");
FP9=Foreign("MJLBD","Close");
FP10=Foreign("MPETROLEUM","Close");
FP11=Foreign("PADMAOIL","Close");
FP12=Foreign("POWERGRID","Close");
FP13=Foreign("SUMITPOWER","Close");
FP14=Foreign("TITASGAS","Close");

AvgClose= (FP1+FP2+FP4+FP5+FP6+FP7+FP9+FP10+FP11+FP12+FP13+FP14)/13;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"POW",color,ParamStyle("FUEL_POWER",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );

FP1=Foreign("BDWELDING","Volume");
FP2=Foreign("BEDL","Volume");
//FP3=Foreign("GBBPOWER","Volume");
FP4=Foreign("DESCO","Volume");
FP5=Foreign("EASTRNLUB","Volume");
FP6=Foreign("JAMUNAOIL","Volume");
FP7=Foreign("KPCL","Volume");
//FP8=Foreign("LINDEBD","Volume");
FP9=Foreign("MJLBD","Volume");
FP10=Foreign("MPETROLEUM","Volume");
FP11=Foreign("PADMAOIL","Volume");
FP12=Foreign("POWERGRID","Volume");
FP13=Foreign("SUMITPOWER","Volume");
FP14=Foreign("TITASGAS","Volume");

AvgVolume= (FP1+FP2+FP4+FP5+FP6+FP7+FP9+FP10+FP11+FP12+FP13+FP14)/13;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

poupbar = AvgVolume > Ref(AvgVolume,-1); 
podownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(podownbar, colorRed, IIf(poupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("FUEL_POWER",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\05_FUEL_POWER.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh ); 
d = Day();
m = Month();
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "05_FUEL_POWER" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();

_SECTION_BEGIN("CEMENT");
tt1 = Foreign( "ARAMITCEM", "Open" ) ;
tt2 = Foreign( "CONFIDCEM", "Open" ) ;
tt3 = Foreign( "HEIDELBCEM", "Open" ) ;
tt4 = Foreign( "LAFSURCEML", "Open" ) ;
tt5 = Foreign( "MEGHNACEM", "Open" ) ;
tt6 = Foreign( "MICEMENT", "Open" ) ;
AvgOpen= (tt1+tt2+tt3+tt4+tt5+tt6)/6;
Open = AvgOpen;

tt1 = Foreign( "ARAMITCEM", "High" ) ;
tt2 = Foreign( "CONFIDCEM", "High" ) ;
tt3 = Foreign( "HEIDELBCEM", "High" ) ;
tt4 = Foreign( "LAFSURCEML", "High" ) ;
tt5 = Foreign( "MEGHNACEM", "High" ) ;
tt6 = Foreign( "MICEMENT", "High" ) ;
AvgHigh= (tt1+tt2+tt3+tt4+tt5+tt6)/6;
High = AvgHigh;

tt1 = Foreign( "ARAMITCEM", "Low" ) ;
tt2 = Foreign( "CONFIDCEM", "Low" ) ;
tt3 = Foreign( "HEIDELBCEM", "Low" ) ;
tt4 = Foreign( "LAFSURCEML", "Low" ) ;
tt5 = Foreign( "MEGHNACEM", "Low" ) ;
tt6 = Foreign( "MICEMENT", "Low" ) ;
AvgLow= (tt1+tt2+tt3+tt4+tt5+tt6)/6;
Low = AvgLow;

tt1 = Foreign( "ARAMITCEM", "Close" ) ;
tt2 = Foreign( "CONFIDCEM", "Close" ) ;
tt3 = Foreign( "HEIDELBCEM", "Close" ) ;
tt4 = Foreign( "LAFSURCEML", "Close" ) ;
tt5 = Foreign( "MEGHNACEM", "Close" ) ;
tt6 = Foreign( "MICEMENT", "Close" ) ;
AvgClose= (tt1+tt2+tt3+tt4+tt5+tt6)/6;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"CEM",color,ParamStyle("CEMENT",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );


tt1 = Foreign( "ARAMITCEM", "Volume" ) ;
tt2 = Foreign( "CONFIDCEM", "Volume" ) ;
tt3 = Foreign( "HEIDELBCEM", "Volume" ) ;
tt4 = Foreign( "LAFSURCEML", "Volume" ) ;
tt5 = Foreign( "MEGHNACEM", "Volume" ) ;
tt6 = Foreign( "MICEMENT", "Volume" ) ;
AvgVolume= (tt1+tt2+tt3+tt4+tt5+tt6)/6;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

ceupbar = AvgVolume > Ref(AvgVolume,-1); 
cedownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(cedownbar, colorRed, IIf(ceupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("CEMENT",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\06_CEMENT.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh ); 
d = Day(); 
m = Month();    
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "06_CEMENT" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
 O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();


_SECTION_BEGIN("TEXTILE");
T1=Foreign("AL-HAJTEX","Open");
T2=Foreign("ALLTEX","Open");
T3=Foreign("ANLIMAYARN","Open");
T4=Foreign("APEXSPINN","Open");
T5=Foreign("CMCKAMAL","Open");
T6=Foreign("DACCADYE","Open");
T7=Foreign("DELTASPINN","Open");
T8=Foreign("DSHGARME","Open");
T9=Foreign("DULAMIACOT","Open");
T10=Foreign("HRTEX","Open");
T11=Foreign("MAKSONSPIN","Open");
T12=Foreign("MALEKSPIN","Open");
T13=Foreign("METROSPIN","Open");
T14=Foreign("MODERNDYE","Open");
T15=Foreign("MITHUNKNIT","Open");
T16=Foreign("PRIMETEX","Open");
T17=Foreign("RAHIMTEXT","Open");
T18=Foreign("RNSPIN","Open");
T19=Foreign("SAFKOSPINN","Open");
T20=Foreign("SAIHAMTEX","Open");
T21=Foreign("SONARGAON","Open");
T22=Foreign("SQUARETEXT","Open");
T23=Foreign("STYLECRAFT","Open");
T24=Foreign("TALLUSPIN","Open");
//T25=Foreign("ZAHINTEX","Open");
//T25=Foreign("ENVOYTEX","Open");
//T25=Foreign("GENNEXT","Open");
//T25=Foreign("SAIHAMCOT","Open");
AvgOpen=(T1+T2+T3+T4+T5+T6+T7+T8+T9+T10+T11+T12+T13+T14+T15+T16+T17+T19+T20+T21+T22+T23+T24)/24;
Open = AvgOpen;

T1=Foreign("AL-HAJTEX","High");
T2=Foreign("ALLTEX","High");
T3=Foreign("ANLIMAYARN","High");
T4=Foreign("APEXSPINN","High");
T5=Foreign("CMCKAMAL","High");
T6=Foreign("DACCADYE","High");
T7=Foreign("DELTASPINN","High");
T8=Foreign("DSHGARME","High");
T9=Foreign("DULAMIACOT","High");
T10=Foreign("HRTEX","High");
T11=Foreign("MAKSONSPIN","High");
T12=Foreign("MALEKSPIN","High");
T13=Foreign("METROSPIN","High");
T14=Foreign("MODERNDYE","High");
T15=Foreign("MITHUNKNIT","High");
T16=Foreign("PRIMETEX","High");
T17=Foreign("RAHIMTEXT","High");
T18=Foreign("RNSPIN","High");
T19=Foreign("SAFKOSPINN","High");
T20=Foreign("SAIHAMTEX","High");
T21=Foreign("SONARGAON","High");
T22=Foreign("SQUARETEXT","High");
T23=Foreign("STYLECRAFT","High");
T24=Foreign("TALLUSPIN","High");
//T25=Foreign("ZAHINTEX","High");
//T25=Foreign("ENVOYTEX","High");
//T25=Foreign("GENNEXT","High");
//T25=Foreign("SAIHAMCOT","High");
AvgHigh=(T1+T2+T3+T4+T5+T6+T7+T8+T9+T10+T11+T12+T13+T14+T15+T16+T17+T19+T20+T21+T22+T23+T24)/24;
High = AvgHigh;

T1=Foreign("AL-HAJTEX","Low");
T2=Foreign("ALLTEX","Low");
T3=Foreign("ANLIMAYARN","Low");
T4=Foreign("APEXSPINN","Low");
T5=Foreign("CMCKAMAL","Low");
T6=Foreign("DACCADYE","Low");
T7=Foreign("DELTASPINN","Low");
T8=Foreign("DSHGARME","Low");
T9=Foreign("DULAMIACOT","Low");
T10=Foreign("HRTEX","Low");
T11=Foreign("MAKSONSPIN","Low");
T12=Foreign("MALEKSPIN","Low");
T13=Foreign("METROSPIN","Low");
T14=Foreign("MODERNDYE","Low");
T15=Foreign("MITHUNKNIT","Low");
T16=Foreign("PRIMETEX","Low");
T17=Foreign("RAHIMTEXT","Low");
T18=Foreign("RNSPIN","Low");
T19=Foreign("SAFKOSPINN","Low");
T20=Foreign("SAIHAMTEX","Low");
T21=Foreign("SONARGAON","Low");
T22=Foreign("SQUARETEXT","Low");
T23=Foreign("STYLECRAFT","Low");
T24=Foreign("TALLUSPIN","Low");
//T25=Foreign("ZAHINTEX","Low");
//T25=Foreign("ENVOYTEX","Low");
//T25=Foreign("GENNEXT","Low");
//T25=Foreign("SAIHAMCOT","Low");
AvgLow=(T1+T2+T3+T4+T5+T6+T7+T8+T9+T10+T11+T12+T13+T14+T15+T16+T17+T19+T20+T21+T22+T23+T24)/24;
Low = AvgLow;

T1=Foreign("AL-HAJTEX","Close");
T2=Foreign("ALLTEX","Close");
T3=Foreign("ANLIMAYARN","Close");
T4=Foreign("APEXSPINN","Close");
T5=Foreign("CMCKAMAL","Close");
T6=Foreign("DACCADYE","Close");
T7=Foreign("DELTASPINN","Close");
T8=Foreign("DSHGARME","Close");
T9=Foreign("DULAMIACOT","Close");
T10=Foreign("HRTEX","Close");
T11=Foreign("MAKSONSPIN","Close");
T12=Foreign("MALEKSPIN","Close");
T13=Foreign("METROSPIN","Close");
T14=Foreign("MODERNDYE","Close");
T15=Foreign("MITHUNKNIT","Close");
T16=Foreign("PRIMETEX","Close");
T17=Foreign("RAHIMTEXT","Close");
T18=Foreign("RNSPIN","Close");
T19=Foreign("SAFKOSPINN","Close");
T20=Foreign("SAIHAMTEX","Close");
T21=Foreign("SONARGAON","Close");
T22=Foreign("SQUARETEXT","Close");
T23=Foreign("STYLECRAFT","Close");
T24=Foreign("TALLUSPIN","Close");
//T25=Foreign("ZAHINTEX","Close");
//T25=Foreign("ENVOYTEX","Close");
//T25=Foreign("GENNEXT","Close");
//T25=Foreign("SAIHAMCOT","Close");
AvgClose=(T1+T2+T3+T4+T5+T6+T7+T8+T9+T10+T11+T12+T13+T14+T15+T16+T17+T19+T20+T21+T22+T23+T24)/24;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"MF",color,ParamStyle("TEXTILE",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );

T1=Foreign("AL-HAJTEX","Volume");
T2=Foreign("ALLTEX","Volume");
T3=Foreign("ANLIMAYARN","Volume");
T4=Foreign("APEXSPINN","Volume");
T5=Foreign("CMCKAMAL","Volume");
T6=Foreign("DACCADYE","Volume");
T7=Foreign("DELTASPINN","Volume");
T8=Foreign("DSHGARME","Volume");
T9=Foreign("DULAMIACOT","Volume");
T10=Foreign("HRTEX","Volume");
T11=Foreign("MAKSONSPIN","Volume");
T12=Foreign("MALEKSPIN","Volume");
T13=Foreign("METROSPIN","Volume");
T14=Foreign("MODERNDYE","Volume");
T15=Foreign("MITHUNKNIT","Volume");
T16=Foreign("PRIMETEX","Volume");
T17=Foreign("RAHIMTEXT","Volume");
T18=Foreign("RNSPIN","Volume");
T19=Foreign("SAFKOSPINN","Volume");
T20=Foreign("SAIHAMTEX","Volume");
T21=Foreign("SONARGAON","Volume");
T22=Foreign("SQUARETEXT","Volume");
T23=Foreign("STYLECRAFT","Volume");
T24=Foreign("TALLUSPIN","Volume");
//T25=Foreign("ZAHINTEX","Volume");
//T25=Foreign("ENVOYTEX","Volume");
//T25=Foreign("GENNEXT","Volume");
//T25=Foreign("SAIHAMCOT","Volume");

AvgVolume=(T1+T2+T3+T4+T5+T6+T7+T8+T9+T10+T11+T12+T13+T14+T15+T16+T17+T19+T20+T21+T22+T23+T24)/24;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

mfupbar = AvgVolume > Ref(AvgVolume,-1); 
mfdownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(mfdownbar, colorRed, IIf(mfupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("TEXTILE",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\07_TEXTILE.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh );
d = Day(); 
m = Month();
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
{
fputs( "07_TEXTILE" +",", fh ); 
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();


_SECTION_BEGIN("ENGINEERING");
E1=Foreign("AFTABAUTO","Open");
E2=Foreign("ANWARGALV","Open");
E3=Foreign("ATLASBANG","Open");
E4=Foreign("AZIZPIPES","Open");
E5=Foreign("BDAUTOCA","Open");
E6=Foreign("BDLAMPS","Open");
E7=Foreign("BDTHAI","Open");
E8=Foreign("BSRMSTEEL","Open");
E9=Foreign("DESHBANDHU","Open");
E10=Foreign("ECABLES","Open");
E11=Foreign("GOLDENSON","Open");
//E12=Foreign("GPHISPAT","Open");
E13=Foreign("KAY&QUE","Open");
E15=Foreign("MONNOSTAF","Open");
E16=Foreign("NAVANACNG","Open");
E17=Foreign("NPOLYMAR","Open");
E18=Foreign("NTLTUBES","Open");
E19=Foreign("OLYMPIC","Open");
E20=Foreign("QSMDRYCELL","Open");
E21=Foreign("RANFOUNDRY","Open");
E22=Foreign("RENWICKJA","Open");
E23=Foreign("SALAMCRST","Open");
E24=Foreign("SINGERBD","Open");
AvgOpen=(E1+E2+E3+E4+E5+E6+E7+E8+E9+E10+E11+E13+E15+E16+E17+E19+E20+E21+E22+E23+E24)/24;
Open = AvgOpen;

E1=Foreign("AFTABAUTO","High");
E2=Foreign("ANWARGALV","High");
E3=Foreign("ATLASBANG","High");
E4=Foreign("AZIZPIPES","High");
E5=Foreign("BDAUTOCA","High");
E6=Foreign("BDLAMPS","High");
E7=Foreign("BDTHAI","High");
E8=Foreign("BSRMSTEEL","High");
E9=Foreign("DESHBANDHU","High");
E10=Foreign("ECABLES","High");
E11=Foreign("GOLDENSON","High");
//E12=Foreign("GPHISPAT","High");
E13=Foreign("KAY&QUE","High");
E15=Foreign("MONNOSTAF","High");
E16=Foreign("NAVANACNG","High");
E17=Foreign("NPOLYMAR","High");
E18=Foreign("NTLTUBES","High");
E19=Foreign("OLYMPIC","High");
E20=Foreign("QSMDRYCELL","High");
E21=Foreign("RANFOUNDRY","High");
E22=Foreign("RENWICKJA","High");
E23=Foreign("SALAMCRST","High");
E24=Foreign("SINGERBD","High");
AvgHigh=(E1+E2+E3+E4+E5+E6+E7+E8+E9+E10+E11+E13+E15+E16+E17+E19+E20+E21+E22+E23+E24)/24;
High = AvgHigh;

E1=Foreign("AFTABAUTO","Low");
E2=Foreign("ANWARGALV","Low");
E3=Foreign("ATLASBANG","Low");
E4=Foreign("AZIZPIPES","Low");
E5=Foreign("BDAUTOCA","Low");
E6=Foreign("BDLAMPS","Low");
E7=Foreign("BDTHAI","Low");
E8=Foreign("BSRMSTEEL","Low");
E9=Foreign("DESHBANDHU","Low");
E10=Foreign("ECABLES","Low");
E11=Foreign("GOLDENSON","Low");
//E12=Foreign("GPHISPAT","Low");
E13=Foreign("KAY&QUE","Low");
E15=Foreign("MONNOSTAF","Low");
E16=Foreign("NAVANACNG","Low");
E17=Foreign("NPOLYMAR","Low");
E18=Foreign("NTLTUBES","Low");
E19=Foreign("OLYMPIC","Low");
E20=Foreign("QSMDRYCELL","Low");
E21=Foreign("RANFOUNDRY","Low");
E22=Foreign("RENWICKJA","Low");
E23=Foreign("SALAMCRST","Low");
E24=Foreign("SINGERBD","Low");
AvgLow=(E1+E2+E3+E4+E5+E6+E7+E8+E9+E10+E11+E13+E15+E16+E17+E19+E20+E21+E22+E23+E24)/24;
Low = AvgLow;

E1=Foreign("AFTABAUTO","Close");
E2=Foreign("ANWARGALV","Close");
E3=Foreign("ATLASBANG","Close");
E4=Foreign("AZIZPIPES","Close");
E5=Foreign("BDAUTOCA","Close");
E6=Foreign("BDLAMPS","Close");
E7=Foreign("BDTHAI","Close");
E8=Foreign("BSRMSTEEL","Close");
E9=Foreign("DESHBANDHU","Close");
E10=Foreign("ECABLES","Close");
E11=Foreign("GOLDENSON","Close");
//E12=Foreign("GPHISPAT","Close");
E13=Foreign("KAY&QUE","Close");
E15=Foreign("MONNOSTAF","Close");
E16=Foreign("NAVANACNG","Close");
E17=Foreign("NPOLYMAR","Close");
E18=Foreign("NTLTUBES","Close");
E19=Foreign("OLYMPIC","Close");
E20=Foreign("QSMDRYCELL","Close");
E21=Foreign("RANFOUNDRY","Close");
E22=Foreign("RENWICKJA","Close");
E23=Foreign("SALAMCRST","Close");
E24=Foreign("SINGERBD","Close");
AvgClose=(E1+E2+E3+E4+E5+E6+E7+E8+E9+E10+E11+E13+E15+E16+E17+E19+E20+E21+E22+E23+E24)/24;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"MF",color,ParamStyle("ENGINEERING",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );

E1=Foreign("AFTABAUTO","Volume");
E2=Foreign("ANWARGALV","Volume");
E3=Foreign("ATLASBANG","Volume");
E4=Foreign("AZIZPIPES","Volume");
E5=Foreign("BDAUTOCA","Volume");
E6=Foreign("BDLAMPS","Volume");
E7=Foreign("BDTHAI","Volume");
E8=Foreign("BSRMSTEEL","Volume");
E9=Foreign("DESHBANDHU","Volume");
E10=Foreign("ECABLES","Volume");
E11=Foreign("GOLDENSON","Volume");
//E12=Foreign("GPHISPAT","Volume");
E13=Foreign("KAY&QUE","Volume");
E15=Foreign("MONNOSTAF","Volume");
E16=Foreign("NAVANACNG","Volume");
E17=Foreign("NPOLYMAR","Volume");
E18=Foreign("NTLTUBES","Volume");
E19=Foreign("OLYMPIC","Volume");
E20=Foreign("QSMDRYCELL","Volume");
E21=Foreign("RANFOUNDRY","Volume");
E22=Foreign("RENWICKJA","Volume");
E23=Foreign("SALAMCRST","Volume");
E24=Foreign("SINGERBD","Volume");
AvgVolume=(E1+E2+E3+E4+E5+E6+E7+E8+E9+E10+E11+E13+E15+E16+E17+E19+E20+E21+E22+E23+E24)/24;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

mfupbar = AvgVolume > Ref(AvgVolume,-1); 
mfdownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(mfdownbar, colorRed, IIf(mfupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("ENGINEERING",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\08_ENGINEERING.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh );
d = Day(); 
m = Month();
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
{
fputs( "08_ENGINEERING" +",", fh ); 
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();




_SECTION_BEGIN("PHARMA_CHEMICALS");
PC1=Foreign("ACI","Open");
PC2=Foreign("ACIFORMULA","Open");
PC3=Foreign("ACTIVEFINE","Open");
PC4=Foreign("AMBEEPHA","Open");
PC5=Foreign("BEACONPHAR","Open");
PC6=Foreign("BXPHARMA","Open");
PC7=Foreign("BXSYNTH","Open");
PC8=Foreign("GLAXOSMITH","Open");
PC9=Foreign("IBNSINA","Open");
PC10=Foreign("IMAMBUTTON","Open");
PC11=Foreign("KEYACOSMET","Open");
PC12=Foreign("KOHINOOR","Open");
PC13=Foreign("LIBRAINFU","Open");
PC14=Foreign("MARICO","Open");
PC15=Foreign("ORIONINFU","Open");
PC16=Foreign("PHARMAID","Open");
PC17=Foreign("RECKITTBEN","Open");
PC18=Foreign("RENATA","Open");
PC19=Foreign("SALVOCHEM","Open");
PC20=Foreign("SQURPHARMA","Open");
AvgOpen=(PC1+PC2+PC3+PC4+PC5+PC6+PC7+PC8+PC9+PC10+PC11+PC12+PC13+PC14+PC15+PC16+PC17+PC19+PC20)/20;
Open = AvgOpen;

PC1=Foreign("ACI","High");
PC2=Foreign("ACIFORMULA","High");
PC3=Foreign("ACTIVEFINE","High");
PC4=Foreign("AMBEEPHA","High");
PC5=Foreign("BEACONPHAR","High");
PC6=Foreign("BXPHARMA","High");
PC7=Foreign("BXSYNTH","High");
PC8=Foreign("GLAXOSMITH","High");
PC9=Foreign("IBNSINA","High");
PC10=Foreign("IMAMBUTTON","High");
PC11=Foreign("KEYACOSMET","High");
PC12=Foreign("KOHINOOR","High");
PC13=Foreign("LIBRAINFU","High");
PC14=Foreign("MARICO","High");
PC15=Foreign("ORIONINFU","High");
PC16=Foreign("PHARMAID","High");
PC17=Foreign("RECKITTBEN","High");
PC18=Foreign("RENATA","High");
PC19=Foreign("SALVOCHEM","High");
PC20=Foreign("SQURPHARMA","High");
AvgHigh=(PC1+PC2+PC3+PC4+PC5+PC6+PC7+PC8+PC9+PC10+PC11+PC12+PC13+PC14+PC15+PC16+PC17+PC19+PC20)/20;
High = AvgHigh;

PC1=Foreign("ACI","Low");
PC2=Foreign("ACIFORMULA","Low");
PC3=Foreign("ACTIVEFINE","Low");
PC4=Foreign("AMBEEPHA","Low");
PC5=Foreign("BEACONPHAR","Low");
PC6=Foreign("BXPHARMA","Low");
PC7=Foreign("BXSYNTH","Low");
PC8=Foreign("GLAXOSMITH","Low");
PC9=Foreign("IBNSINA","Low");
PC10=Foreign("IMAMBUTTON","Low");
PC11=Foreign("KEYACOSMET","Low");
PC12=Foreign("KOHINOOR","Low");
PC13=Foreign("LIBRAINFU","Low");
PC14=Foreign("MARICO","Low");
PC15=Foreign("ORIONINFU","Low");
PC16=Foreign("PHARMAID","Low");
PC17=Foreign("RECKITTBEN","Low");
PC18=Foreign("RENATA","Low");
PC19=Foreign("SALVOCHEM","Low");
PC20=Foreign("SQURPHARMA","Low");
AvgLow=(PC1+PC2+PC3+PC4+PC5+PC6+PC7+PC8+PC9+PC10+PC11+PC12+PC13+PC14+PC15+PC16+PC17+PC19+PC20)/20;
Low = AvgLow;

PC1=Foreign("ACI","Close");
PC2=Foreign("ACIFORMULA","Close");
PC3=Foreign("ACTIVEFINE","Close");
PC4=Foreign("AMBEEPHA","Close");
PC5=Foreign("BEACONPHAR","Close");
PC6=Foreign("BXPHARMA","Close");
PC7=Foreign("BXSYNTH","Close");
PC8=Foreign("GLAXOSMITH","Close");
PC9=Foreign("IBNSINA","Close");
PC10=Foreign("IMAMBUTTON","Close");
PC11=Foreign("KEYACOSMET","Close");
PC12=Foreign("KOHINOOR","Close");
PC13=Foreign("LIBRAINFU","Close");
PC14=Foreign("MARICO","Close");
PC15=Foreign("ORIONINFU","Close");
PC16=Foreign("PHARMAID","Close");
PC17=Foreign("RECKITTBEN","Close");
PC18=Foreign("RENATA","Close");
PC19=Foreign("SALVOCHEM","Close");
PC20=Foreign("SQURPHARMA","Close");
AvgClose=(PC1+PC2+PC3+PC4+PC5+PC6+PC7+PC8+PC9+PC10+PC11+PC12+PC13+PC14+PC15+PC16+PC17+PC19+PC20)/20;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"MF",color,ParamStyle("PHARMA_CHEMICALS",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );

PC1=Foreign("ACI","Volume");
PC2=Foreign("ACIFORMULA","Volume");
PC3=Foreign("ACTIVEFINE","Volume");
PC4=Foreign("AMBEEPHA","Volume");
PC5=Foreign("BEACONPHAR","Volume");
PC6=Foreign("BXPHARMA","Volume");
PC7=Foreign("BXSYNTH","Volume");
PC8=Foreign("GLAXOSMITH","Volume");
PC9=Foreign("IBNSINA","Volume");
PC10=Foreign("IMAMBUTTON","Volume");
PC11=Foreign("KEYACOSMET","Volume");
PC12=Foreign("KOHINOOR","Volume");
PC13=Foreign("LIBRAINFU","Volume");
PC14=Foreign("MARICO","Volume");
PC15=Foreign("ORIONINFU","Volume");
PC16=Foreign("PHARMAID","Volume");
PC17=Foreign("RECKITTBEN","Volume");
PC18=Foreign("RENATA","Volume");
PC19=Foreign("SALVOCHEM","Volume");
PC20=Foreign("SQURPHARMA","Volume");
AvgVolume=(PC1+PC2+PC3+PC4+PC5+PC6+PC7+PC8+PC9+PC10+PC11+PC12+PC13+PC14+PC15+PC16+PC17+PC19+PC20)/20;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

mfupbar = AvgVolume > Ref(AvgVolume,-1); 
mfdownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(mfdownbar, colorRed, IIf(mfupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("PHARMA_CHEMICALS",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\09_PHARMA_CHEMICALS.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh );
d = Day(); 
m = Month();
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
{
fputs( "09_PHARMA_CHEMICALS" +",", fh ); 
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();


_SECTION_BEGIN("FOOD_ALLIED");
FA1=Foreign("AMCL(PRAN)","Open");
FA2=Foreign("APEXFOODS","Open");
FA3=Foreign("BANGAS","Open");
FA4=Foreign("BATBC","Open");
FA5=Foreign("BEACHHATCH","Open");
FA6=Foreign("CVOPRL","Open");
FA7=Foreign("FINEFOODS","Open");
FA8=Foreign("FUWANGFOOD","Open");
FA9=Foreign("GEMINISEA","Open");
FA10=Foreign("MEGCONMILK","Open");
FA11=Foreign("MEGHNAPET","Open");
FA12=Foreign("NTC","Open");
FA13=Foreign("RAHIMAFOOD","Open");
//FA14=Foreign("RDFOOD","Open");
FA15=Foreign("SHYAMPSUG","Open");
FA16=Foreign("ZEALBANGLA","Open");
AvgOpen=(FA1+FA2+FA3+FA4+FA5+FA6+FA7+FA8+FA9+FA10+FA11+FA12+FA13+FA15+FA16)/15;
Open = AvgOpen;

FA1=Foreign("AMCL(PRAN)","High");
FA2=Foreign("APEXFOODS","High");
FA3=Foreign("BANGAS","High");
FA4=Foreign("BATBC","High");
FA5=Foreign("BEACHHATCH","High");
FA6=Foreign("CVOPRL","High");
FA7=Foreign("FINEFOODS","High");
FA8=Foreign("FUWANGFOOD","High");
FA9=Foreign("GEMINISEA","High");
FA10=Foreign("MEGCONMILK","High");
FA11=Foreign("MEGHNAPET","High");
FA12=Foreign("NTC","High");
FA13=Foreign("RAHIMAFOOD","High");
//FA14=Foreign("RDFOOD","High");
FA15=Foreign("SHYAMPSUG","High");
FA16=Foreign("ZEALBANGLA","High");
AvgHigh=(FA1+FA2+FA3+FA4+FA5+FA6+FA7+FA8+FA9+FA10+FA11+FA12+FA13+FA15+FA16)/15;
High = AvgHigh;

FA1=Foreign("AMCL(PRAN)","Low");
FA2=Foreign("APEXFOODS","Low");
FA3=Foreign("BANGAS","Low");
FA4=Foreign("BATBC","Low");
FA5=Foreign("BEACHHATCH","Low");
FA6=Foreign("CVOPRL","Low");
FA7=Foreign("FINEFOODS","Low");
FA8=Foreign("FUWANGFOOD","Low");
FA9=Foreign("GEMINISEA","Low");
FA10=Foreign("MEGCONMILK","Low");
FA11=Foreign("MEGHNAPET","Low");
FA12=Foreign("NTC","Low");
FA13=Foreign("RAHIMAFOOD","Low");
//FA14=Foreign("RDFOOD","Low");
FA15=Foreign("SHYAMPSUG","Low");
FA16=Foreign("ZEALBANGLA","Low");
AvgLow=(FA1+FA2+FA3+FA4+FA5+FA6+FA7+FA8+FA9+FA10+FA11+FA12+FA13+FA15+FA16)/15;
Low = AvgLow;

FA1=Foreign("AMCL(PRAN)","Close");
FA2=Foreign("APEXFOODS","Close");
FA3=Foreign("BANGAS","Close");
FA4=Foreign("BATBC","Close");
FA5=Foreign("BEACHHATCH","Close");
FA6=Foreign("CVOPRL","Close");
FA7=Foreign("FINEFOODS","Close");
FA8=Foreign("FUWANGFOOD","Close");
FA9=Foreign("GEMINISEA","Close");
FA10=Foreign("MEGCONMILK","Close");
FA11=Foreign("MEGHNAPET","Close");
FA12=Foreign("NTC","Close");
FA13=Foreign("RAHIMAFOOD","Close");
//FA14=Foreign("RDFOOD","Close");
FA15=Foreign("SHYAMPSUG","Close");
FA16=Foreign("ZEALBANGLA","Close");
AvgClose=(FA1+FA2+FA3+FA4+FA5+FA6+FA7+FA8+FA9+FA10+FA11+FA12+FA13+FA15+FA16)/15;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"MF",color,ParamStyle("FOOD_ALLIED",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );

FA1=Foreign("AMCL(PRAN)","Volume");
FA2=Foreign("APEXFOODS","Volume");
FA3=Foreign("BANGAS","Volume");
FA4=Foreign("BATBC","Volume");
FA5=Foreign("BEACHHATCH","Volume");
FA6=Foreign("CVOPRL","Volume");
FA7=Foreign("FINEFOODS","Volume");
FA8=Foreign("FUWANGFOOD","Volume");
FA9=Foreign("GEMINISEA","Volume");
FA10=Foreign("MEGCONMILK","Volume");
FA11=Foreign("MEGHNAPET","Volume");
FA12=Foreign("NTC","Volume");
FA13=Foreign("RAHIMAFOOD","Volume");
//FA14=Foreign("RDFOOD","Volume");
FA15=Foreign("SHYAMPSUG","Volume");
FA16=Foreign("ZEALBANGLA","Volume");
AvgVolume=(FA1+FA2+FA3+FA4+FA5+FA6+FA7+FA8+FA9+FA10+FA11+FA12+FA13+FA15+FA16)/15;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

mfupbar = AvgVolume > Ref(AvgVolume,-1); 
mfdownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(mfdownbar, colorRed, IIf(mfupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("FOOD_ALLIED",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\10_FOOD_ALLIED.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh );
d = Day(); 
m = Month();
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
{
fputs( "10_FOOD_ALLIED" +",", fh ); 
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();


_SECTION_BEGIN("MF");
MF1=Foreign("1JANATAMF","Open");
MF2=Foreign("1STBSRS","Open");
MF3=Foreign("1STICB","Open");
MF4=Foreign("1STPRIMFMF","Open");
MF5=Foreign("2NDICB","Open");
MF6=Foreign("3RDICB","Open");
MF7=Foreign("4THICB","Open");
MF8=Foreign("5THICB","Open");
MF9=Foreign("6THICB","Open");
MF10=Foreign("7THICB","Open");
MF11=Foreign("8THICB","Open");
//MF12=Foreign("ABB1STMF","Open");
MF13=Foreign("AIBL1STIMF","Open");
MF14=Foreign("AIMS1STMF","Open");
MF15=Foreign("DBH1STMF","Open");
MF16=Foreign("EBL1STMF","Open");
MF17=Foreign("EBLNRBMF","Open");
//MF18=Foreign("FBFIF","Open");
MF19=Foreign("GRAMEEN1","Open");
MF20=Foreign("GRAMEENS2","Open");
MF21=Foreign("GREENDELMF","Open");
MF22=Foreign("ICB1STNRB","Open");
MF23=Foreign("ICB2NDNRB","Open");
MF24=Foreign("ICB3RDNRB","Open");
MF25=Foreign("ICBAMCL1ST","Open");
MF26=Foreign("ICBAMCL2ND","Open");
MF27=Foreign("ICBEPMF1S1","Open");
MF28=Foreign("ICBISLAMIC","Open");
MF29=Foreign("IFIC1STMF","Open");
MF30=Foreign("IFILISLMF1","Open");
//MF31=Foreign("LRGLOBMF1","Open");
MF32=Foreign("MBL1STMF","Open");
//MF33=Foreign("NLI1STMF","Open");
MF34=Foreign("PF1STMF","Open");
MF35=Foreign("PHPMF1","Open");
MF36=Foreign("POPULAR1MF","Open");
MF37=Foreign("PRIME1ICBA","Open");
MF38=Foreign("RELIANCE1","Open");
MF39=Foreign("SEBL1STMF","Open");
MF40=Foreign("TRUSTB1MF","Open");
//MF41=Foreign("NCCBLMF1","Open");
AvgOpen=(MF1+MF2+MF3+MF4+MF5+MF6+MF7+MF8+MF9+MF10+MF11+MF13+MF14+MF15+MF16+MF17+MF19+MF20
+MF21+MF22+MF23+MF24+MF25+MF26+MF27+MF28+MF29+MF30+MF32+MF34+MF35+MF36+MF37+MF38+MF39+MF40)/36;
Open = AvgOpen;

MF1=Foreign("1JANATAMF","High");
MF2=Foreign("1STBSRS","High");
MF3=Foreign("1STICB","High");
MF4=Foreign("1STPRIMFMF","High");
MF5=Foreign("2NDICB","High");
MF6=Foreign("3RDICB","High");
MF7=Foreign("4THICB","High");
MF8=Foreign("5THICB","High");
MF9=Foreign("6THICB","High");
MF10=Foreign("7THICB","High");
MF11=Foreign("8THICB","High");
//MF12=Foreign("ABB1STMF","High");
MF13=Foreign("AIBL1STIMF","High");
MF14=Foreign("AIMS1STMF","High");
MF15=Foreign("DBH1STMF","High");
MF16=Foreign("EBL1STMF","High");
MF17=Foreign("EBLNRBMF","High");
//MF18=Foreign("FBFIF","High");
MF19=Foreign("GRAMEEN1","High");
MF20=Foreign("GRAMEENS2","High");
MF21=Foreign("GREENDELMF","High");
MF22=Foreign("ICB1STNRB","High");
MF23=Foreign("ICB2NDNRB","High");
MF24=Foreign("ICB3RDNRB","High");
MF25=Foreign("ICBAMCL1ST","High");
MF26=Foreign("ICBAMCL2ND","High");
MF27=Foreign("ICBEPMF1S1","High");
MF28=Foreign("ICBISLAMIC","High");
MF29=Foreign("IFIC1STMF","High");
MF30=Foreign("IFILISLMF1","High");
//MF31=Foreign("LRGLOBMF1","High");
MF32=Foreign("MBL1STMF","High");
//MF33=Foreign("NLI1STMF","High");
MF34=Foreign("PF1STMF","High");
MF35=Foreign("PHPMF1","High");
MF36=Foreign("POPULAR1MF","High");
MF37=Foreign("PRIME1ICBA","High");
MF38=Foreign("RELIANCE1","High");
MF39=Foreign("SEBL1STMF","High");
MF40=Foreign("TRUSTB1MF","High");
//MF41=Foreign("NCCBLMF1","High");
AvgHigh=(MF1+MF2+MF3+MF4+MF5+MF6+MF7+MF8+MF9+MF10+MF11+MF13+MF14+MF15+MF16+MF17+MF19+MF20
+MF21+MF22+MF23+MF24+MF25+MF26+MF27+MF28+MF29+MF30+MF32+MF34+MF35+MF36+MF37+MF38+MF39+MF40)/36;
High = AvgHigh;

MF1=Foreign("1JANATAMF","Low");
MF2=Foreign("1STBSRS","Low");
MF3=Foreign("1STICB","Low");
MF4=Foreign("1STPRIMFMF","Low");
MF5=Foreign("2NDICB","Low");
MF6=Foreign("3RDICB","Low");
MF7=Foreign("4THICB","Low");
MF8=Foreign("5THICB","Low");
MF9=Foreign("6THICB","Low");
MF10=Foreign("7THICB","Low");
MF11=Foreign("8THICB","Low");
//MF12=Foreign("ABB1STMF","Low");
MF13=Foreign("AIBL1STIMF","Low");
MF14=Foreign("AIMS1STMF","Low");
MF15=Foreign("DBH1STMF","Low");
MF16=Foreign("EBL1STMF","Low");
MF17=Foreign("EBLNRBMF","Low");
//MF18=Foreign("FBFIF","Low");
MF19=Foreign("GRAMEEN1","Low");
MF20=Foreign("GRAMEENS2","Low");
MF21=Foreign("GREENDELMF","Low");
MF22=Foreign("ICB1STNRB","Low");
MF23=Foreign("ICB2NDNRB","Low");
MF24=Foreign("ICB3RDNRB","Low");
MF25=Foreign("ICBAMCL1ST","Low");
MF26=Foreign("ICBAMCL2ND","Low");
MF27=Foreign("ICBEPMF1S1","Low");
MF28=Foreign("ICBISLAMIC","Low");
MF29=Foreign("IFIC1STMF","Low");
MF30=Foreign("IFILISLMF1","Low");
//MF31=Foreign("LRGLOBMF1","Low");
MF32=Foreign("MBL1STMF","Low");
//MF33=Foreign("NLI1STMF","Low");
MF34=Foreign("PF1STMF","Low");
MF35=Foreign("PHPMF1","Low");
MF36=Foreign("POPULAR1MF","Low");
MF37=Foreign("PRIME1ICBA","Low");
MF38=Foreign("RELIANCE1","Low");
MF39=Foreign("SEBL1STMF","Low");
MF40=Foreign("TRUSTB1MF","Low");
//MF41=Foreign("NCCBLMF1","Low");
AvgLow=(MF1+MF2+MF3+MF4+MF5+MF6+MF7+MF8+MF9+MF10+MF11+MF13+MF14+MF15+MF16+MF17+MF19+MF20
+MF21+MF22+MF23+MF24+MF25+MF26+MF27+MF28+MF29+MF30+MF32+MF34+MF35+MF36+MF37+MF38+MF39+MF40)/36;
Low = AvgLow;

MF1=Foreign("1JANATAMF","Close");
MF2=Foreign("1STBSRS","Close");
MF3=Foreign("1STICB","Close");
MF4=Foreign("1STPRIMFMF","Close");
MF5=Foreign("2NDICB","Close");
MF6=Foreign("3RDICB","Close");
MF7=Foreign("4THICB","Close");
MF8=Foreign("5THICB","Close");
MF9=Foreign("6THICB","Close");
MF10=Foreign("7THICB","Close");
MF11=Foreign("8THICB","Close");
//MF12=Foreign("ABB1STMF","Close");
MF13=Foreign("AIBL1STIMF","Close");
MF14=Foreign("AIMS1STMF","Close");
MF15=Foreign("DBH1STMF","Close");
MF16=Foreign("EBL1STMF","Close");
MF17=Foreign("EBLNRBMF","Close");
//MF18=Foreign("FBFIF","Close");
MF19=Foreign("GRAMEEN1","Close");
MF20=Foreign("GRAMEENS2","Close");
MF21=Foreign("GREENDELMF","Close");
MF22=Foreign("ICB1STNRB","Close");
MF23=Foreign("ICB2NDNRB","Close");
MF24=Foreign("ICB3RDNRB","Close");
MF25=Foreign("ICBAMCL1ST","Close");
MF26=Foreign("ICBAMCL2ND","Close");
MF27=Foreign("ICBEPMF1S1","Close");
MF28=Foreign("ICBISLAMIC","Close");
MF29=Foreign("IFIC1STMF","Close");
MF30=Foreign("IFILISLMF1","Close");
//MF31=Foreign("LRGLOBMF1","Close");
MF32=Foreign("MBL1STMF","Close");
//MF33=Foreign("NLI1STMF","Close");
MF34=Foreign("PF1STMF","Close");
MF35=Foreign("PHPMF1","Close");
MF36=Foreign("POPULAR1MF","Close");
MF37=Foreign("PRIME1ICBA","Close");
MF38=Foreign("RELIANCE1","Close");
MF39=Foreign("SEBL1STMF","Close");
MF40=Foreign("TRUSTB1MF","Close");
//MF41=Foreign("NCCBLMF1","Close");
AvgClose=(MF1+MF2+MF3+MF4+MF5+MF6+MF7+MF8+MF9+MF10+MF11+MF13+MF14+MF15+MF16+MF17+MF19+MF20
+MF21+MF22+MF23+MF24+MF25+MF26+MF27+MF28+MF29+MF30+MF32+MF34+MF35+MF36+MF37+MF38+MF39+MF40)/36;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"MF",color,ParamStyle("MF",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );


MF1=Foreign("1JANATAMF","Volume");
MF2=Foreign("1STBSRS","Volume");
MF3=Foreign("1STICB","Volume");
MF4=Foreign("1STPRIMFMF","Volume");
MF5=Foreign("2NDICB","Volume");
MF6=Foreign("3RDICB","Volume");
MF7=Foreign("4THICB","Volume");
MF8=Foreign("5THICB","Volume");
MF9=Foreign("6THICB","Volume");
MF10=Foreign("7THICB","Volume");
MF11=Foreign("8THICB","Volume");
//MF12=Foreign("ABB1STMF","Volume");
MF13=Foreign("AIBL1STIMF","Volume");
MF14=Foreign("AIMS1STMF","Volume");
MF15=Foreign("DBH1STMF","Volume");
MF16=Foreign("EBL1STMF","Volume");
MF17=Foreign("EBLNRBMF","Volume");
//MF18=Foreign("FBFIF","Volume");
MF19=Foreign("GRAMEEN1","Volume");
MF20=Foreign("GRAMEENS2","Volume");
MF21=Foreign("GREENDELMF","Volume");
MF22=Foreign("ICB1STNRB","Volume");
MF23=Foreign("ICB2NDNRB","Volume");
MF24=Foreign("ICB3RDNRB","Volume");
MF25=Foreign("ICBAMCL1ST","Volume");
MF26=Foreign("ICBAMCL2ND","Volume");
MF27=Foreign("ICBEPMF1S1","Volume");
MF28=Foreign("ICBISLAMIC","Volume");
MF29=Foreign("IFIC1STMF","Volume");
MF30=Foreign("IFILISLMF1","Volume");
//MF31=Foreign("LRGLOBMF1","Volume");
MF32=Foreign("MBL1STMF","Volume");
//MF33=Foreign("NLI1STMF","Volume");
MF34=Foreign("PF1STMF","Volume");
MF35=Foreign("PHPMF1","Volume");
MF36=Foreign("POPULAR1MF","Volume");
MF37=Foreign("PRIME1ICBA","Volume");
MF38=Foreign("RELIANCE1","Volume");
MF39=Foreign("SEBL1STMF","Volume");
MF40=Foreign("TRUSTB1MF","Volume");
//MF41=Foreign("NCCBLMF1","Volume");
AvgVolume=(MF1+MF2+MF3+MF4+MF5+MF6+MF7+MF8+MF9+MF10+MF11+MF13+MF14+MF15+MF16+MF17+MF19+MF20
+MF21+MF22+MF23+MF24+MF25+MF26+MF27+MF28+MF29+MF30+MF32+MF34+MF35+MF36+MF37+MF38+MF39+MF40)/36;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

mfupbar = AvgVolume > Ref(AvgVolume,-1); 
mfdownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(mfdownbar, colorRed, IIf(mfupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("MF",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\11_MUTUAL_FUND.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh );
d = Day(); 
m = Month();
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
{
fputs( "11_MUTUAL_FUND" +",", fh ); 
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();


_SECTION_BEGIN("IT");
IT1 = Foreign( "AGNISYSL", "Open" ) ;
IT2 = Foreign( "BDCOM", "Open" ) ;
IT3 = Foreign( "DAFODILCOM", "Open" ) ;
IT4 = Foreign( "INTECH", "Open" ) ;
IT5 = Foreign( "ISNLTD", "Open" ) ;
//IT5 = Foreign( "AAMRATECH", "Open" ) ;
AvgOpen= (IT1+IT2+IT3+IT4+IT5)/5;
Open = AvgOpen;

IT1 = Foreign( "AGNISYSL", "High" ) ;
IT2 = Foreign( "BDCOM", "High" ) ;
IT3 = Foreign( "DAFODILCOM", "High" ) ;
IT4 = Foreign( "INTECH", "High" ) ;
IT5 = Foreign( "ISNLTD", "High" ) ;
//IT5 = Foreign( "AAMRATECH", "High" ) ;
AvgHigh= (IT1+IT2+IT3+IT4+IT5)/5;
High = AvgHigh;

IT1 = Foreign( "AGNISYSL", "Low" ) ;
IT2 = Foreign( "BDCOM", "Low" ) ;
IT3 = Foreign( "DAFODILCOM", "Low" ) ;
IT4 = Foreign( "INTECH", "Low" ) ;
IT5 = Foreign( "ISNLTD", "Low" ) ;
//IT5 = Foreign( "AAMRATECH", "Low" ) ;
AvgLow= (IT1+IT2+IT3+IT4+IT5)/5;
Low = AvgLow;

IT1 = Foreign( "AGNISYSL", "Close" ) ;
IT2 = Foreign( "BDCOM", "Close" ) ;
IT3 = Foreign( "DAFODILCOM", "Close" ) ;
IT4 = Foreign( "INTECH", "Close" ) ;
IT5 = Foreign( "ISNLTD", "Close" ) ;
//IT5 = Foreign( "AAMRATECH", "Close" ) ;
AvgClose= (IT1+IT2+IT3+IT4+IT5)/5;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"IT",color,ParamStyle("IT",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );


IT1 = Foreign( "AGNISYSL", "Volume" ) ;
IT2 = Foreign( "BDCOM", "Volume" ) ;
IT3 = Foreign( "DAFODILCOM", "Volume" ) ;
IT4 = Foreign( "INTECH", "Volume" ) ;
IT5 = Foreign( "ISNLTD", "Volume" ) ;
//IT5 = Foreign( "AAMRATECH", "Volume" ) ;
AvgVolume= (IT1+IT2+IT3+IT4+IT5)/5;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

itupbar = AvgVolume > Ref(AvgVolume,-1); 
itdownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(itdownbar, colorRed, IIf(itupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("IT",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\12_IT.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh ); 
d = Day(); 
m = Month();  
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "12_IT" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();


_SECTION_BEGIN("CERAMICS");
Cer1=Foreign("FUWANGCER","Open");
Cer2=Foreign("MONNOCERA","Open");
Cer3=Foreign("RAKCERAMIC","Open");
Cer4=Foreign("SPCERAMICS","Open");
Cer5=Foreign("STANCERAM","Open");
AvgOpen= (Cer1+Cer2+Cer3+Cer4+Cer5)/5;
Open = AvgOpen;

Cer1=Foreign("FUWANGCER","High");
Cer2=Foreign("MONNOCERA","High");
Cer3=Foreign("RAKCERAMIC","High");
Cer4=Foreign("SPCERAMICS","High");
Cer5=Foreign("STANCERAM","High");
AvgHigh= (Cer1+Cer2+Cer3+Cer4+Cer5)/5;
High = AvgHigh;

Cer1=Foreign("FUWANGCER","Low");
Cer2=Foreign("MONNOCERA","Low");
Cer3=Foreign("RAKCERAMIC","Low");
Cer4=Foreign("SPCERAMICS","Low");
Cer5=Foreign("STANCERAM","Low");
AvgLow= (Cer1+Cer2+Cer3+Cer4+Cer5)/5;
Low = AvgLow;

Cer1=Foreign("FUWANGCER","Close");
Cer2=Foreign("MONNOCERA","Close");
Cer3=Foreign("RAKCERAMIC","Close");
Cer4=Foreign("SPCERAMICS","Close");
Cer5=Foreign("STANCERAM","Close");
AvgClose= (Cer1+Cer2+Cer3+Cer4+Cer5)/5;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"IT",color,ParamStyle("CERAMICS",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );


Cer1=Foreign("FUWANGCER","Volume");
Cer2=Foreign("MONNOCERA","Volume");
Cer3=Foreign("RAKCERAMIC","Volume");
Cer4=Foreign("SPCERAMICS","Volume");
Cer5=Foreign("STANCERAM","Volume");
AvgVolume= (Cer1+Cer2+Cer3+Cer4+Cer5)/5;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

itupbar = AvgVolume > Ref(AvgVolume,-1); 
itdownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(itdownbar, colorRed, IIf(itupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("CERAMICS",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\13_CERAMICS.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh ); 
d = Day(); 
m = Month();  
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "13_CERAMICS" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();
 

_SECTION_BEGIN("SERVICE_RE");
SR1=Foreign("EHL","Open");
SR2=Foreign("OCL","Open");
SR3=Foreign("SAMORITA","Open");
SR4=Foreign("SAPORTL","Open");
AvgOpen= (SR1+SR2+SR3+SR4)/4;
Open = AvgOpen;

SR1=Foreign("EHL","High");
SR2=Foreign("OCL","High");
SR3=Foreign("SAMORITA","High");
SR4=Foreign("SAPORTL","High");
AvgHigh= (SR1+SR2+SR3+SR4)/4;
High = AvgHigh;

SR1=Foreign("EHL","Low");
SR2=Foreign("OCL","Low");
SR3=Foreign("SAMORITA","Low");
SR4=Foreign("SAPORTL","C");
AvgLow= (SR1+SR2+SR3+SR4)/4;
Low = AvgLow;

SR1=Foreign("EHL","Close");
SR2=Foreign("OCL","Close");
SR3=Foreign("SAMORITA","Close");
SR4=Foreign("SAPORTL","Close");
AvgClose= (SR1+SR2+SR3+SR4)/4;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"IT",color,ParamStyle("SERVICE_RE",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );


SR1=Foreign("EHL","Volume");
SR2=Foreign("OCL","Volume");
SR3=Foreign("SAMORITA","Volume");
SR4=Foreign("SAPORTL","Volume");
AvgVolume= (SR1+SR2+SR3+SR4)/4;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

itupbar = AvgVolume > Ref(AvgVolume,-1); 
itdownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(itdownbar, colorRed, IIf(itupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("SERVICE_RE",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\14_SERVICE_RE.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh ); 
d = Day(); 
m = Month();  
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "14_SERVICE_RE" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();


_SECTION_BEGIN("TANNERY");
T1=Foreign("APEXADELFT","Open");
T2=Foreign("APEXTANRY","Open");
T3=Foreign("BATASHOE","Open");
T4=Foreign("LEGACYFOOT","Open");
T5=Foreign("SAMATALETH","Open");
AvgOpen= (T1+T2+T3+T4+T5)/5;
Open = AvgOpen;

T1=Foreign("APEXADELFT","High");
T2=Foreign("APEXTANRY","High");
T3=Foreign("BATASHOE","High");
T4=Foreign("LEGACYFOOT","High");
T5=Foreign("SAMATALETH","High");
AvgHigh= (T1+T2+T3+T4+T5)/5;
High = AvgHigh;

T1=Foreign("APEXADELFT","Low");
T2=Foreign("APEXTANRY","Low");
T3=Foreign("BATASHOE","Low");
T4=Foreign("LEGACYFOOT","Low");
T5=Foreign("SAMATALETH","Low");
AvgLow= (T1+T2+T3+T4+T5)/5;
Low = AvgLow;

T1=Foreign("APEXADELFT","Close");
T2=Foreign("APEXTANRY","Close");
T3=Foreign("BATASHOE","Close");
T4=Foreign("LEGACYFOOT","Close");
T5=Foreign("SAMATALETH","Close");
AvgClose= (T1+T2+T3+T4+T5)/5;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"IT",color,ParamStyle("TANNERY",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );


T1=Foreign("APEXADELFT","Volume");
T2=Foreign("APEXTANRY","Volume");
T3=Foreign("BATASHOE","Volume");
T4=Foreign("LEGACYFOOT","Volume");
T5=Foreign("SAMATALETH","Volume");
AvgVolume= (T1+T2+T3+T4+T5)/5;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

itupbar = AvgVolume > Ref(AvgVolume,-1); 
itdownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(itdownbar, colorRed, IIf(itupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("TANNERY",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\15_TANNERY.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh ); 
d = Day(); 
m = Month();  
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "15_TANNERY" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();
 

_SECTION_BEGIN("MISCELLANEOUS");
Mis1=Foreign("ARAMIT","Open");
Mis2=Foreign("BERGERPBL","Open");
Mis3=Foreign("BEXIMCO","Open");
Mis4=Foreign("BSC","Open");
Mis5=Foreign("GQBALLPEN","Open");
Mis6=Foreign("MIRACLEIND","Open");
Mis7=Foreign("SAVAREFR","Open");
Mis8=Foreign("SINOBANGLA","Open");
Mis9=Foreign("USMANIAGL","Open");
AvgOpen= (Mis1+Mis2+Mis3+Mis4+Mis5+Mis6+Mis7+Mis8+Mis9)/9;
Open = AvgOpen;

Mis1=Foreign("ARAMIT","High");
Mis2=Foreign("BERGERPBL","High");
Mis3=Foreign("BEXIMCO","High");
Mis4=Foreign("BSC","High");
Mis5=Foreign("GQBALLPEN","High");
Mis6=Foreign("MIRACLEIND","High");
Mis7=Foreign("SAVAREFR","High");
Mis8=Foreign("SINOBANGLA","High");
Mis9=Foreign("USMANIAGL","High");
AvgHigh= (Mis1+Mis2+Mis3+Mis4+Mis5+Mis6+Mis7+Mis8+Mis9)/9;
High = AvgHigh;

Mis1=Foreign("ARAMIT","Low");
Mis2=Foreign("BERGERPBL","Low");
Mis3=Foreign("BEXIMCO","Low");
Mis4=Foreign("BSC","Low");
Mis5=Foreign("GQBALLPEN","Low");
Mis6=Foreign("MIRACLEIND","Low");
Mis7=Foreign("SAVAREFR","Low");
Mis8=Foreign("SINOBANGLA","Low");
Mis9=Foreign("USMANIAGL","Low");
AvgLow= (Mis1+Mis2+Mis3+Mis4+Mis5+Mis6+Mis7+Mis8+Mis9)/9;
Low = AvgLow;

Mis1=Foreign("ARAMIT","Close");
Mis2=Foreign("BERGERPBL","Close");
Mis3=Foreign("BEXIMCO","Close");
Mis4=Foreign("BSC","Close");
Mis5=Foreign("GQBALLPEN","Close");
Mis6=Foreign("MIRACLEIND","Close");
Mis7=Foreign("SAVAREFR","Close");
Mis8=Foreign("SINOBANGLA","Close");
Mis9=Foreign("USMANIAGL","Close");
AvgClose= (Mis1+Mis2+Mis3+Mis4+Mis5+Mis6+Mis7+Mis8+Mis9)/9;
Close = AvgClose;

Color = IIf(Avgopen > Avgclose, colorRed, colorBrightGreen);
PlotOHLC(Avgopen,Avghigh,Avglow,Avgclose,"IT",color,ParamStyle("MISCELLANEOUS",styleCandle|styleOwnScale|styleNoTitle|stylehidden, mask = maskAll) );

Mis1=Foreign("ARAMIT","Volume");
Mis2=Foreign("BERGERPBL","Volume");
Mis3=Foreign("BEXIMCO","Volume");
Mis4=Foreign("BSC","Volume");
Mis5=Foreign("GQBALLPEN","Volume");
Mis6=Foreign("MIRACLEIND","Volume");
Mis7=Foreign("SAVAREFR","Volume");
Mis8=Foreign("SINOBANGLA","Volume");
Mis9=Foreign("USMANIAGL","Volume");
AvgVolume= (Mis1+Mis2+Mis3+Mis4+Mis5+Mis6+Mis7+Mis8+Mis9)/9;
Volume = AvgVolume;

OpenVolume=0;
CloseVolume=AvgVolume;

itupbar = AvgVolume > Ref(AvgVolume,-1); 
itdownbar = AvgVolume< Ref(AvgVolume,-1);
barcolor=IIf(itdownbar, colorRed, IIf(itupbar,colorBrightGreen,colorWhite) );

PlotOHLC( OpenVolume,CloseVolume,OpenVolume,CloseVolume, "",barcolor,ParamStyle("MISCELLANEOUS",styleCandle|styleOwnScale|stylehidden,mask = maskAll),7);

fh = fopen( "C:\\00 Sector Data\\16_MISCELLANEOUS.csv", "w"); 
if( fh ) 
fputs( "Symbol,Date,Open,High,Low,Close,Volume\n", fh ); 
d = Day(); 
m = Month();  
y = Year(); 
for( i = 0; i < BarCount; i++ ) 
fputs( "16_MISCELLANEOUS" +",", fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
D[ i ], M[ i ], Y[ i ] ); 
fputs( ds, fh ); 
qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] ); 
fputs( qs, fh ); 
fclose( fh ); 
_SECTION_END();
 





0 comments:

Post a Comment