Announcement

Collapse
No announcement yet.

getting previous value from an efsExternal on specific period.

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

  • getting previous value from an efsExternal on specific period.

    Hi All,

    I am hoping someone may be able to help with this one. Please excuse me if this is very 101 but I am not a programmer and kind of fumbling my way through this.

    What I am trying to achieve is to get the value of the previous bar of an external EFS script (for a specific interval, in this case 15). I have read this great post and I thought that I was doing everything right:

    http://forum.esignalcentral.com/prin...2752&perpage=5

    PHP Code:
    function main() {

        var 
    xSVERSI15  efsExternal"Sve_InvFish_Rsi.efs"44,inv(15));
        var 
    sSVERSI15 getSeries(xSVERSI15,0);
        var 
    prevSVERSI15 sSVERSI15.getValue(-1);

        
    debugPrintln(prevSVERSI15);



    I'm not sure why I get null from the above.

    The external function (as far as I can tell) has only one element. I have tried getSeries with and without the ,0.

    I have attached the external efs. I'll be very grateful for any insights into where I am going wrong, or even if what I am trying to do is possible or not.

    Many Thanks

    KBB
    Attached Files

  • #2
    KBB
    As far as I can see the script you posted is working and is printing values from the debug statement (see following screenshot)



    That said it could be simplified (and made more efficient) as follows. Unless you need to plot the return of your script (or the called efs returns more than one element which is not the case in this instance) you do not need to call the series using the getSeries() function

    PHP Code:

    var xSVERSI15 null;

    function 
    main() { 
        
        if(
    xSVERSI15==nullxSVERSI15 efsExternal"Sve_InvFish_Rsi.efs"44,inv(15)); 
        var 
    prevSVERSI15 xSVERSI15.getValue(-1); 

        
    debugPrintln(prevSVERSI15); 


    As to the nulls you may need to provide more details on how you are running the script and where you are seeing them
    Alex


    Originally posted by Kent.B.Bothered View Post
    Hi All,

    I am hoping someone may be able to help with this one. Please excuse me if this is very 101 but I am not a programmer and kind of fumbling my way through this.

    What I am trying to achieve is to get the value of the previous bar of an external EFS script (for a specific interval, in this case 15). I have read this great post and I thought that I was doing everything right:

    http://forum.esignalcentral.com/prin...2752&perpage=5

    PHP Code:
    function main() {

        var 
    xSVERSI15  efsExternal"Sve_InvFish_Rsi.efs"44,inv(15));
        var 
    sSVERSI15 getSeries(xSVERSI15,0);
        var 
    prevSVERSI15 sSVERSI15.getValue(-1);

        
    debugPrintln(prevSVERSI15);



    I'm not sure why I get null from the above.

    The external function (as far as I can tell) has only one element. I have tried getSeries with and without the ,0.

    I have attached the external efs. I'll be very grateful for any insights into where I am going wrong, or even if what I am trying to do is possible or not.

    Many Thanks

    KBB

    Comment


    • #3
      Hi Alex,

      LOL. Thank you so much, I did mention that I'm fumbling, right?

      This is quite embarrassing but I thought the script output window (where I was getting null) was the same as the Formula Output.

      I can see the output now...and work magic on it. This is great, thanks again.

      KBB

      Comment


      • #4
        KBB
        You are welcome
        Alex


        Originally posted by Kent.B.Bothered View Post
        Hi Alex,

        LOL. Thank you so much, I did mention that I'm fumbling, right?

        This is quite embarrassing but I thought the script output window (where I was getting null) was the same as the Formula Output.

        I can see the output now...and work magic on it. This is great, thanks again.

        KBB

        Comment

        Working...
        X