Optuma Forums › Optuma Scripting › Use of #$ variables › Reply To: Use of #$ variables
May 23, 2020 at 7:31 am
#58227
Michael
- Topics: 20
- Replies: 32
- Posts: 52
Here is the script again in better form because the forum won’t let me edit my post above.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
//This is the 3period exponential MA of the TEI // //sample factor code only //#$BBBMA=8; //#$BIMAsma=5; //BIMAplot=MA(BBBIndex,BARS=$BBBMA, STYLE=Exponential, CALC=Close, TOOLNAME=BIMA); // // #$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 |