Hello,
I've slightly modified this T3 study to prove to myself that I am starting to understand efs a little bit. However, I still have a terrible time with counting bars. In any directional movement, I would like the 1st bar to be labeled #1, the 2nd, #2, etc. for a total of 13 bars. If the move has only ,say, 7 bars, the numbering would stop on #7. If there are more than 13 bars in the movement, the numbering would stop on #13, & there would be no more #s for the rest of the bars.When a new direction is established, the numbering would start again. There would be no #s for the bars with the yellow circles.
function preMain(){
setPriceStudy(true);
setCursorLabelName("Upper",0);
setCursorLabelName("T3Avg",1);
setCursorLabelName("Lower",2);
setDefaultBarFgColor(Color.khaki,0)
setDefaultBarFgColor(Color.blue,1);
setDefaultBarFgColor(Color.khaki,2);
setDefaultBarThickness(2,0);
setDefaultBarThickness(2,1);
setDefaultBarThickness(2,2);
setColorPriceBars(true);
setDefaultPriceBarColor(Color.black);
}
var e1_1=0.0;
var e2_1=0.0;
var e3_1=0.0;
var e4_1=0.0;
var e5_1=0.0;
var e6_1=0.0;
function main(Price,Periods){
if(Price==null)Price="Close";
if(Periods==null)Periods=6;
var vPrice=getValue(Price,0);
var b=0.7;
var b2=b*b;
var b3=b*b*b;
var c1=-b3;
var c2=3*b2+3*b3;
var c3=-6*b2-3*b-3*b3;
var c4=1+3*b+b3+3*b2;
var f1=2/(Periods+1);
var f2=1-f1;
var e1=f1*vPrice+f2*e1_1;
var e2=f1*e1+f2*e2_1;
var e3=f1*e2+f2*e3_1;
var e4=f1*e3+f2*e4_1;
var e5=f1*e4+f2*e5_1;
var e6=f1*e5+f2*e6_1;
if(getBarState()==BARSTATE_NEWBAR){
e1_1=e1;
e2_1=e2;
e3_1=e3;
e4_1=e4;
e5_1=e5;
e6_1=e6;
}
var T3Average=c1*e6+c2*e5+c3*e4+c4*e3;
var vUpper=T3Average*(1+.07/100));
var vLower=T3Average*(1-.07/100));
if(vPrice>=vUpper){
drawShapeRelative(0,vPrice,Shape.UPTRIANGLE,null,C olor.green,null);
drawTextRelative(0,vPrice,"1",Color.magenta,null,T ext.CENTER|Text.BOTTOM,"Arial",15);
}
if(VPrice<=vLower){
drawShapeRelative(0,vPrice,Shape.DOWNTRIANGLE,null ,Color.red,null);
drawTextRelative(0,vPrice,"2",Color.aqua,null,Text .CENTER|Text.BOTTOM,"Arial"15);
}
if(vPrice>vLower&&(vPrice<vUpper)){
drawShapeRelative(0,vPrice,Shape.CIRCLE,null,Color .yellow,null);
}
return new Array(vUpper,T3Average,vLower);
}
I guess I just don't understand how what I would like to accomplish can be simplified to fit in a small place in a text line. Thanks in advance for your help.
Diane
I've slightly modified this T3 study to prove to myself that I am starting to understand efs a little bit. However, I still have a terrible time with counting bars. In any directional movement, I would like the 1st bar to be labeled #1, the 2nd, #2, etc. for a total of 13 bars. If the move has only ,say, 7 bars, the numbering would stop on #7. If there are more than 13 bars in the movement, the numbering would stop on #13, & there would be no more #s for the rest of the bars.When a new direction is established, the numbering would start again. There would be no #s for the bars with the yellow circles.
function preMain(){
setPriceStudy(true);
setCursorLabelName("Upper",0);
setCursorLabelName("T3Avg",1);
setCursorLabelName("Lower",2);
setDefaultBarFgColor(Color.khaki,0)
setDefaultBarFgColor(Color.blue,1);
setDefaultBarFgColor(Color.khaki,2);
setDefaultBarThickness(2,0);
setDefaultBarThickness(2,1);
setDefaultBarThickness(2,2);
setColorPriceBars(true);
setDefaultPriceBarColor(Color.black);
}
var e1_1=0.0;
var e2_1=0.0;
var e3_1=0.0;
var e4_1=0.0;
var e5_1=0.0;
var e6_1=0.0;
function main(Price,Periods){
if(Price==null)Price="Close";
if(Periods==null)Periods=6;
var vPrice=getValue(Price,0);
var b=0.7;
var b2=b*b;
var b3=b*b*b;
var c1=-b3;
var c2=3*b2+3*b3;
var c3=-6*b2-3*b-3*b3;
var c4=1+3*b+b3+3*b2;
var f1=2/(Periods+1);
var f2=1-f1;
var e1=f1*vPrice+f2*e1_1;
var e2=f1*e1+f2*e2_1;
var e3=f1*e2+f2*e3_1;
var e4=f1*e3+f2*e4_1;
var e5=f1*e4+f2*e5_1;
var e6=f1*e5+f2*e6_1;
if(getBarState()==BARSTATE_NEWBAR){
e1_1=e1;
e2_1=e2;
e3_1=e3;
e4_1=e4;
e5_1=e5;
e6_1=e6;
}
var T3Average=c1*e6+c2*e5+c3*e4+c4*e3;
var vUpper=T3Average*(1+.07/100));
var vLower=T3Average*(1-.07/100));
if(vPrice>=vUpper){
drawShapeRelative(0,vPrice,Shape.UPTRIANGLE,null,C olor.green,null);
drawTextRelative(0,vPrice,"1",Color.magenta,null,T ext.CENTER|Text.BOTTOM,"Arial",15);
}
if(VPrice<=vLower){
drawShapeRelative(0,vPrice,Shape.DOWNTRIANGLE,null ,Color.red,null);
drawTextRelative(0,vPrice,"2",Color.aqua,null,Text .CENTER|Text.BOTTOM,"Arial"15);
}
if(vPrice>vLower&&(vPrice<vUpper)){
drawShapeRelative(0,vPrice,Shape.CIRCLE,null,Color .yellow,null);
}
return new Array(vUpper,T3Average,vLower);
}
I guess I just don't understand how what I would like to accomplish can be simplified to fit in a small place in a text line. Thanks in advance for your help.
Diane
Comment