Announcement

Collapse
No announcement yet.

fractals

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

  • fractals

    Hi
    I am trying to use the daily fractals on a smaller time frame chart.
    My guess is I need to change the following two lines to daily interval rather than high of smaller time frames and I am clueless about it.( Perhaps like getvalue ( high, inv("d") .............. )


    var vHigh = getValue("High",0, -82);
    var vLow = getValue("Low",0, -82);

    Any help be greatly appreciated.

  • #2
    Rana
    See this and this article (and the examples contained therein) in the EFS KnowledgeBase on the high() and low() functions.
    Also see this thread which provides a complete set of examples on how to use the efs2 functions which allow for secondary symbols and/or intervals
    Alex


    Originally posted by Rana View Post
    Hi
    I am trying to use the daily fractals on a smaller time frame chart.
    My guess is I need to change the following two lines to daily interval rather than high of smaller time frames and I am clueless about it.( Perhaps like getvalue ( high, inv("d") .............. )


    var vHigh = getValue("High",0, -82);
    var vLow = getValue("Low",0, -82);

    Any help be greatly appreciated.

    Comment


    • #3
      Alex, thanks for pointing me to very good threads.

      ( part of Bill William fractal )
      var vHigh = getValue("High",0, -82);
      var vLow = getValue("Low",0, -82);
      var Price = (vHigh[0] + vLow[0]) / 2;
      var Sum1 = 0.0;
      var Sum2 = 0.0;
      var Sum3 = 0.0;
      var i = 0;
      var Value1 = vHigh[0];
      var Value2 = vLow[0];
      for (i = 0;i < 21;i++)
      ...... ..... ....... ......
      To my understanding I need to change first 2 lines of this indicator, so it can return the fix interval(Daily) higher highs and higher lows etc instead of the time interval I am seeing on my chart( say 60min) .....
      I first tried ........ var vHigh = getValue(high,inv("d"),0,-82 ); //getValue("High",0, -82); is original setting

      and then tried .... var vHigh = getValue(high(0,inv("d")),-82 );

      I am getting this error for both tries.
      Error: Function 'getValue': none of the 3 overloads could convert all the argument types:
      could be (bartype:String, [symbol:String])
      or (bartype:String, barindex:Integer, [symbol:String])
      or (bartype:String, barindex:Integer, numbars:Integer, [symbol:String])

      then I tried changing it to var vHigh = (high(inv("d")),0,-82 ); and this returns no HIGH values on chart.

      I am bit lost what to do next. I will be reading the third thread you referred again n again and may be able to understand it. or if you can help me change something in it that can do the changes I am looking for in fractals.

      Regards

      Comment


      • #4
        FWIW the following two expressions return the same array values:
        var aValues = getValue( "Close", 0, -10 );// pre EFS2 function
        var aValues1 = close(0, -10 );// EFS2 function
        and to add the daily interval as a series so you can return any index value place the following in a bInit code block:
        var aValuesDaily = close(inv("D");

        So for your particular example try:

        PHP Code:
        function preMain(){
            
        setPriceStudy(true);
            
        //setPriceStudy(false);
        }
        var 
        bInit=false;
        var 
        vHigh=null;//global variable to store series
        var vLow=null;
        function 
        main(){
            var 
        Price null,Sum1 0.0,Sum2 0.0,Sum3 0.0,0;
            var 
        Value1 null,Value2 null;//declare local variables here
            
        if(!bInit){
                
        vHigh high(inv("D"));
                
        vLow low(inv("D"));
                
        bInit=true;
            }
            
        Value1=vHigh.getValue(0);
        //the 0 in ".getValue(0)" is the index value to retrieve, i.e. (-1) is yesterday, -2 day before yesterday, etc
            
        Value2=vLow.getValue(0);
            
        Price = (Value1 Value2) / 2;
            for (
        0;21;i++){}
            
        //debugPrintln("16: "+Value1+"\t"+Value2+"\t"+Price);

        Wayne
        Last edited by waynecd; 01-12-2016, 03:43 AM.

        Comment


        • #5
          Rana

          Originally posted by Rana View Post
          ]I first tried ........ var vHigh = getValue(high,inv("d"),0,-82 ); //getValue("High",0, -82); is original setting
          and then tried .... var vHigh = getValue(high(0,inv("d")),-82 );
          As you have already found out neither of the two methods you tried is correct or for that matter follows the examples provided in the articles and/or thread I linked
          The proper syntax (as shown in those articles and/or thread) would be
          var vHigh = high(inv("d"))
          to create the series (note that while you may want to initialize the series at BARSTATE_ALLBARS or in some initialization routine as that is more efficient this is not a requirement).
          Once you created the series you can then retrieve any of its values using the getValue() method of the series object (see the link to the related EFS Kb article) eg
          var vHighValue = vHigh.getValue(x)
          where x is the index of the bar you want to retrieve (0 for current bar, negative values for past bars, etc)
          Note that you can also retrieve the value directly from a series ie without first declaring the series eg
          var vHighValue = high(x, inv("d"))
          where x is the index of the bar
          You can find a complete set of examples in the thread I linked in my prior message
          That said you can retrieve the values of an external symbol and/or interval using the legacy syntax ie high(0,-10,"IBM,60") however the function in this case does not maintain proper synchronization between symbols and/or intervals (this is why the EFS functions were created)

          As an aside, contrary to what waynecd stated in his post

          Originally posted by waynecd View Post
          ...
          var aValues1 = close(0, -10 );// EFS2 function
          ...
          the syntax close(0, -10) is not an EFS2 function. That syntax is still legacy EFS and cannot use the sym() or inv() functions as such to call an external symbol and/or interval but relies on the legacy syntax as explained in this article in the EFS KnowledgeBase (and mentioned earlier in this post). Furthermore none of the EFS2 functions return an array
          Alex


          Originally posted by Rana View Post
          Alex, thanks for pointing me to very good threads.

          ( part of Bill William fractal )
          var vHigh = getValue("High",0, -82);
          var vLow = getValue("Low",0, -82);
          var Price = (vHigh[0] + vLow[0]) / 2;
          var Sum1 = 0.0;
          var Sum2 = 0.0;
          var Sum3 = 0.0;
          var i = 0;
          var Value1 = vHigh[0];
          var Value2 = vLow[0];
          for (i = 0;i < 21;i++)
          ...... ..... ....... ......
          To my understanding I need to change first 2 lines of this indicator, so it can return the fix interval(Daily) higher highs and higher lows etc instead of the time interval I am seeing on my chart( say 60min) .....
          I first tried ........ var vHigh = getValue(high,inv("d"),0,-82 ); //getValue("High",0, -82); is original setting

          and then tried .... var vHigh = getValue(high(0,inv("d")),-82 );

          I am getting this error for both tries.
          Error: Function 'getValue': none of the 3 overloads could convert all the argument types:
          could be (bartype:String, [symbol:String])
          or (bartype:String, barindex:Integer, [symbol:String])
          or (bartype:String, barindex:Integer, numbars:Integer, [symbol:String])

          then I tried changing it to var vHigh = (high(inv("d")),0,-82 ); and this returns no HIGH values on chart.

          I am bit lost what to do next. I will be reading the third thread you referred again n again and may be able to understand it. or if you can help me change something in it that can do the changes I am looking for in fractals.

          Regards

          Comment


          • #6
            Many thanks for taking time to reply my query.
            I found another script posted in these forums which is similar to what I am looking for and changing this line is working for me.
            "var xHH = highest( iPeriods , high(inv("15")) ) ;

            Alex, I also like your PnF breakouts which you wrote many years ago. I am not sure yet but I think I will be asking your help in DRAWING the lines at those highs and lows where price breaks. Its become more technical for me than I anticipated but with your help I hope I will get what I want.

            Thanks once again.

            Comment

            Working...
            X