Hi,
I am still a little bemused by the use of #$ varaibles although I have integrated them successfully in other scripts.
This script tries to use #$factor as an adjustable variable but it does not seem to work and the “factor” option does not appear in the adjustable variables when the script is used.
Here is the script;
//This is the 3period exponential MA of the TEI // // #$factor=1; // //TM1 factors TMbar1=4*$factor; TMbar2=10*$factor; TMosc=29*$factor: // TM1=MACD(BAR1=TMbar1, BAR2=TMbar2, OSC=TMbar3, CALC=HLC, STYLE=Exponential); TM2=OFFSET(TM1, OFFSET=2); // TMDirection=IF((TM1-TM2)<0, -1, IF((TM1-TM2)>0,1,0)); // TMTrendDirection=IF(TM1<0,-1,IF(TM1>0,1,0)); // //MA factors MAbars=12*$factor; MAoffset=3*$factor; // M1=MA(BARS=MAbars, STYLE=Exponential); M2=OFFSET(M1, OFFSET=MAoffset); // MomDirection=IF((M1-M2)>0,1,IF((M1-M2)<0,-1,0)); // M3offest=1*$factor M3=OFFSET(M1, OFFSET=M3offset); // MASlope=M1-M3; MADirection=IF(MASlope<0,-1,IF(MASlope>0,1,0)); CloseFactor=If(CLOSE()>M1,1,If(CLOSE()<M1,-1,0)); // MACDbar1=12*$factor; MACDbar2=24*$factor; MACDosc=9*$factor; // MACDFactor=MACD(BAR1=MACDbar1, BAR2=MACDbar2, OSC=MACDosc, CALC=Close, STYLE=Exponential, DEFAULT=Oscillator); MACDPosition=IF(MACDFactor>0,1,IF(MACDFactor<0,-1,0)); // TEInd=(TMDirection+TMTrendDirection+MomDirection+MADirection+CloseFactor+MaCDPosition); // TEIMAadj=MA(TEInd, BARS=3*$factor, STYLE=Exponential, CALC=CLOSE); // TEIMAadj //This is the 3period exponential MA of the TEI // // #$factor=1; // //TM1 factors TMbar1=4*$factor; TMbar2=10*$factor; TMosc=29*$factor: // TM1=MACD(BAR1=TMbar1, BAR2=TMbar2, OSC=TMbar3, CALC=HLC, STYLE=Exponential); TM2=OFFSET(TM1, OFFSET=2); // TMDirection=IF((TM1-TM2)<0, -1, IF((TM1-TM2)>0,1,0)); // TMTrendDirection=IF(TM1<0,-1,IF(TM1>0,1,0)); // //MA factors MAbars=12*$factor; MAoffset=3*$factor; // M1=MA(BARS=MAbars, STYLE=Exponential); M2=OFFSET(M1, OFFSET=MAoffset); // MomDirection=IF((M1-M2)>0,1,IF((M1-M2)<0,-1,0)); // M3offest=1*$factor M3=OFFSET(M1, OFFSET=M3offset); // MASlope=M1-M3; MADirection=IF(MASlope<0,-1,IF(MASlope>0,1,0)); CloseFactor=If(CLOSE()>M1,1,If(CLOSE()<M1,-1,0)); // MACDbar1=12*$factor; MACDbar2=24*$factor; MACDosc=9*$factor; // MACDFactor=MACD(BAR1=MACDbar1, BAR2=MACDbar2, OSC=MACDosc, CALC=Close, STYLE=Exponential, DEFAULT=Oscillator); MACDPosition=IF(MACDFactor>0,1,IF(MACDFactor<0,-1,0)); // TEInd=(TMDirection+TMTrendDirection+MomDirection+MADirection+CloseFactor+MaCDPosition); // TEIMAadj=MA(TEInd, BARS=3*$factor, STYLE=Exponential, CALC=CLOSE); // TEIMAadj
I have tried to attach the exported script but apparently it is not an allowed file type so I have attached the entire workbook which is only one chart.
cheers
Michael