Announcement

Collapse
No announcement yet.

up-down.efs STUDY

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

  • up-down.efs STUDY

    Below is the Up-Down.efs file that I found in this forum.

    It plots two lines of Higher Highs and Lower Lows for the same length of time.

    How do you change the program to be able to adjust the LOOKBACK value? I don't know if I am stating it correctly, but I am trying to plot a sum of the 10 day Higher Highs, and a sum of 12 day Lower Lows.

    Thanks.





    function preMain(){

    setStudyTitle("Up-Down");
    setCursorLabelName("Up",0);
    setCursorLabelName("Dn",1);
    setDefaultBarFgColor(Color.blue,0);
    setDefaultBarFgColor(Color.red,1);

    var fp1 = new FunctionParameter("Lookback", FunctionParameter.NUMBER);
    fp1.setLowerLimit(1);
    fp1.setDefault(100);

    }

    var vCounterUp=0;
    var vCounterDn=0;
    var aCounterUp=null;
    var aCounterDn=null;

    function main(Lookback){

    if (aCounterUp==null)
    aCounterUp=new Array(Lookback);
    if (aCounterDn==null)
    aCounterDn=new Array(Lookback);

    if(getBarState()==BARSTATE_NEWBAR){
    if(high(-1)>high(-2)&&low(-1)>low(-2)){
    vCounterUp=1;
    }else{
    vCounterUp=0;
    }
    if(low(-1)<low(-2)&&high(-1)<high(-2)){
    vCounterDn=1;
    }else{
    vCounterDn=0;
    }
    }

  • #2
    edit this line in the code to be the value you want..

    fp1.setDefault(100);


    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Yes, but how do you get two lines, each with different values?

      In other words, the High plot measuring 10 days, and the Low plot measuring 12 days.

      Comment


      • #4
        you would have to add another function parameter, fp2, which would be assigned to LookBack2. Then add LookBack2 to the main parameter list and use LookBack2 where you want a different value than LookBack.

        So for instance, the value of LookBack could be used for the high plot and the value of LookBack2 could be used for the low plot.

        Steve

        Comment

        Working...
        X