Announcement

Collapse
No announcement yet.

Ma Trix

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ma Trix

    Happy New Year Everyone!!!
    Could someone help me with this EFS?
    I just want to thicken the TRIX and MA of the TRIX and enlarge the Arrows so I can see them. Getting older and can't see the indicator. Enclosed is the EFS. Thanks!!!


    function preMain()
    {
    setStudyTitle("Triple Exponential Average");
    setCursorLabelName("TRIX", 0);
    setCursorLabelName("MAofTRIX", 1);
    setCursorLabelName("Zero Line", 2);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarFgColor(Color.black, 2);
    }
    var XA1_1 = 0.0;
    var XA2_1 = 0.0;
    var XA3_1 = 0.0;
    var aTripleXAvg = null;
    var BarCntr = 0;

    function main(sPrice,nLength,MALength)
    {
    if (MALength == null) MALength = 3;

    var Price = "Close";
    if (sPrice != null) Price = sPrice;
    var len = 10;
    if (nLength != null) len = nLength;
    var vPrice = Math.log(getValue(Price, 0));
    var Factor = 2 / (len + 1);
    var XA1 = Factor * vPrice + (1 - Factor) * XA1_1;
    var XA2 = Factor * XA1 + (1 - Factor) * XA2_1;
    var XA3 = Factor * XA2 + (1 - Factor) * XA3_1;
    var TripleXAvg = (XA3 - XA3_1) * 10000;

    if (getBarState() == BARSTATE_NEWBAR){
    XA1_1 = XA1;
    XA2_1 = XA2;
    XA3_1 = XA3;
    }
    if (aTripleXAvg == null) {
    aTripleXAvg = new Array(MALength);
    }
    if (getBarState() == BARSTATE_NEWBAR) {
    aTripleXAvg.pop();
    aTripleXAvg.unshift(TripleXAvg);
    } else {
    aTripleXAvg[0] = TripleXAvg;
    }
    var nSum = 0;
    for (i = 0; i < MALength; ++i) {
    nSum += aTripleXAvg[i];
    }
    var vTrixMA = nSum/MALength;

    if(getBarState()==BARSTATE_NEWBAR){
    BarCntr += 1;
    }
    if (BarCntr > 15) {
    var vRef = ref(-1,-2);
    var TripleXAvg1 = vRef[0][0];
    var vTrixMA1 = vRef[0][1];
    var TripleXAvg2 = vRef[1][0];
    var vTrixMA2 = vRef[1][1];
    }
    if(getBarState()==BARSTATE_NEWBAR){
    if(TripleXAvg2<vTrixMA2&&TripleXAvg1>vTrixMA1){
    Alert.playSound("blip.wav");
    drawShapeRelative(-1,TripleXAvg,Shape.UPARROW,"",Color.green,null,nul l);
    }
    if(TripleXAvg2>vTrixMA2&&TripleXAvg1<vTrixMA1){
    Alert.playSound("blip.wav");
    drawShapeRelative(-1,TripleXAvg,Shape.DOWNARROW,"",Color.red,null,nul l)
    }
    }
    return new Array(TripleXAvg,vTrixMA, 0);
    }

  • #2
    Re: Ma Trix

    gwika
    With regards to thickening the plots add two setDefaultBarThickness() statements as shown in the following image



    In the arguments of those functions the first parameter defines the thickness while the second assigns the statement to the corresponding item in the return array (0 is the first item, 1 is the second)
    You can find the complete description and syntax for that function in this article in the EFS KnowledgeBase
    As to the arrows they cannot be enlarged as is because the shapes are dependent on the bar spacing.
    A solution would be to draw the arrows as text [using the "Wingdings" font] rather than shapes. In the image enclosed below you can see a working example of how to do this.
    Alex




    Originally posted by gwika
    Happy New Year Everyone!!!
    Could someone help me with this EFS?
    I just want to thicken the TRIX and MA of the TRIX and enlarge the Arrows so I can see them. Getting older and can't see the indicator. Enclosed is the EFS. Thanks!!!


    function preMain()
    {
    setStudyTitle("Triple Exponential Average");
    setCursorLabelName("TRIX", 0);
    setCursorLabelName("MAofTRIX", 1);
    setCursorLabelName("Zero Line", 2);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarFgColor(Color.black, 2);
    }
    var XA1_1 = 0.0;
    var XA2_1 = 0.0;
    var XA3_1 = 0.0;
    var aTripleXAvg = null;
    var BarCntr = 0;

    function main(sPrice,nLength,MALength)
    {
    if (MALength == null) MALength = 3;

    var Price = "Close";
    if (sPrice != null) Price = sPrice;
    var len = 10;
    if (nLength != null) len = nLength;
    var vPrice = Math.log(getValue(Price, 0));
    var Factor = 2 / (len + 1);
    var XA1 = Factor * vPrice + (1 - Factor) * XA1_1;
    var XA2 = Factor * XA1 + (1 - Factor) * XA2_1;
    var XA3 = Factor * XA2 + (1 - Factor) * XA3_1;
    var TripleXAvg = (XA3 - XA3_1) * 10000;

    if (getBarState() == BARSTATE_NEWBAR){
    XA1_1 = XA1;
    XA2_1 = XA2;
    XA3_1 = XA3;
    }
    if (aTripleXAvg == null) {
    aTripleXAvg = new Array(MALength);
    }
    if (getBarState() == BARSTATE_NEWBAR) {
    aTripleXAvg.pop();
    aTripleXAvg.unshift(TripleXAvg);
    } else {
    aTripleXAvg[0] = TripleXAvg;
    }
    var nSum = 0;
    for (i = 0; i < MALength; ++i) {
    nSum += aTripleXAvg[i];
    }
    var vTrixMA = nSum/MALength;

    if(getBarState()==BARSTATE_NEWBAR){
    BarCntr += 1;
    }
    if (BarCntr > 15) {
    var vRef = ref(-1,-2);
    var TripleXAvg1 = vRef[0][0];
    var vTrixMA1 = vRef[0][1];
    var TripleXAvg2 = vRef[1][0];
    var vTrixMA2 = vRef[1][1];
    }
    if(getBarState()==BARSTATE_NEWBAR){
    if(TripleXAvg2<vTrixMA2&&TripleXAvg1>vTrixMA1){
    Alert.playSound("blip.wav");
    drawShapeRelative(-1,TripleXAvg,Shape.UPARROW,"",Color.green,null,nul l);
    }
    if(TripleXAvg2>vTrixMA2&&TripleXAvg1<vTrixMA1){
    Alert.playSound("blip.wav");
    drawShapeRelative(-1,TripleXAvg,Shape.DOWNARROW,"",Color.red,null,nul l)
    }
    }
    return new Array(TripleXAvg,vTrixMA, 0);
    }

    Comment

    Working...
    X