Announcement

Collapse
No announcement yet.

does esignal have function barslast which is in metastock soft

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

  • does esignal have function barslast which is in metastock soft

    Does someone know the same function for that?
    Which can give the number to current bar from the first bar which meet the condition
    Thanks a lot.

  • #2
    Re: does esignal have function barslast which is in metastock soft

    lufund
    If you mean the BarsSince() function there is no equivalent in efs that I know of. However assuming I undertood you correctly here is one way you could accomplish the tast.
    Declare a global variable and set it initially to 0. Then when your condition evaluates to true assign the value returned by the function getCurrentBarCount() to your variable.
    Then at any time just calculate the difference between the current value of getCurrentBarCount() and that of your variable and that will represent the number of bars from the bar that met the condition (see example enclosed below)
    Alex

    PHP Code:
    var vBarCount 0;//declare this as a global variable ie outside of main()

    //then inside main()
    if(myCondition){
        
    vBarCount getCurrentBarCount();
        
    //execute other commands
    }
    var 
    vBarsSince getCurrentBarCount()-vBarCount;
    //rest of your code 

    Originally posted by lufund
    Does someone know the same function for that?
    Which can give the number to current bar from the first bar which meet the condition
    Thanks a lot.

    Comment

    Working...
    X