Announcement

Collapse
No announcement yet.

Possible To Extend T3 Channel Lines?

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

  • Possible To Extend T3 Channel Lines?

    Hello,
    With the T3 Channel, once it's on the chart, regardless of length(period) , I'm trying to have the lines extend further in the projected direction , perhaps by clicking on them. From the sound of it, I thought the addLineToolEXTENTED might work, but I can't figure out how to insert it into the T3 study. Would the addLine be appropriate, or do I need to do something else? Thanks.
    Diane

  • #2
    Diane
    I don't know which T3 efs you are referring so for the purpose of this example I will be using the customMA.efs which is in the EFS2 Custom folder
    The first thing you want to do is create the two variables that you will use for the y1 and y2 parameters of LineTool.RAY. In doing so you also run a null check on the values.

    PHP Code:
    var nMA_0 xMA.getValue(0);//value of the MA at the current bar
    var nMA_1 xMA.getValue(-1);//value of the MA at the prior bar
    if(nMA_1==null || nMA_0==null) return;//null check 
    At that point you can insert the command for the line tool. You will need to preceed it with a clearLineTool() command else you will get an infinite number of lines drawn

    PHP Code:
    clearLineTool(LineTool.RAY);//clear all the LineTool.RAY
    addLineTool(LineTool.RAY,-1,nMA_1,0,nMA_0,1,Color.blue,"Ray");//add the LineTool.RAY 
    The result is shown in the image enclosed below.
    Apply the same logic to your study.
    Alex


    Comment


    • #3
      Hi Alex,
      Thanks for your prompt reply. For the purpose of learning how to do this, I'm going with the single line T3 Average. I tried to use the MA for guidance, but it is not working out. Can you please advise additional help? Thanks.
      Diane
      Attached Files

      Comment


      • #4
        Diane
        Since that script does not use built-in studies it is necessary to use a different solution to retrieve the value of the T3Average at the prior bar.
        The first thing you need to do create two global variables and set them to null ie

        PHP Code:
        var T3Average null;
        var 
        T3Average_1 null
        Then in main insert the following section just before the line var T3Average = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3;

        PHP Code:
        if(getBarState()==BARSTATE_NEWBAR){
                
        T3Average_1=T3Average;
            } 
        At every new bar this will assign to the variable T3Average_1 the last computed value of T3Average thereby creating the historical value we need as one of the coordinates of the LineTool.
        Then remove the var from var T3Average = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3; since we have already declared that variable as a global variable.
        At this point in the line above the return statement insert the following section of code which is virtually the same I showed you in my prior reply.
        Alex

        PHP Code:
        if(T3Average==null||T3Average_1==null) return;
                
            
        clearLineTool(LineTool.RAY);
            
        addLineTool(LineTool.RAY,-1,T3Average_1,0,T3Average,1,Color.blue,"Ray"); 

        Comment


        • #5
          Diane
          As I already indicated to you in this message the version of the T3 you are using computes incorrectly in real time. In that same message I also showed you how to create historical values of a custom variable which is the same process I am using in the example in this thread. You may want to bookmark either thread for future reference if you need to create historical values of a custom variable.
          Alex

          Comment


          • #6
            Good Morning, Alex,
            Thank you so much for the corrected T3. It works beautifully! Now I will apply it to my channel, the development of which you so patiently guided me. It is, indeed, a great reference of how to set up historical value . Again, my sincerest thanks for all you do for us. Have a great weekend!
            Diane

            Comment

            Working...
            X