Announcement

Collapse
No announcement yet.

efsExternal

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

  • efsExternal

    Hi

    Two questions:


    1. Do I only need to call efsExternal once in function main() or on every tick - e,g. is the efsExternal a registration and then it will be updated automatically after that?


    if If i call an efs study with a different timeframe within my efs study can i be sure the values in the called study are updated when i access them ... e.g. say I am calling a study with a 15min timeframe from a 5 min timeframe study every 15 mins BOTH will receive a BARSTAT_NEWBAR ... if I access global values set in the NEWBAR code section of the 15 min study will they be updated by the time i process the NEWBAR message in the 5 min study - how can i be sure the 15 min NEWBAR message has been processed already?

    I was thinking if I canmnot be sure I'd process the first tick message after the NEWBAR in my calling study????

    Thanks

    Paul

  • #2
    Paul
    The more efficient way to do it is to declare the study as a global variable and initialize it once in main eg
    PHP Code:
    var myStudy null;//global variable
     
    function main(){
     
        if(
    myStudy == nullmyStudy efsExternal("myEFS.efs"param1param2etc);//initialize
        //rest of your code
     
        
    return myStudy.getValue(0);//retrieve the value with getValue() method

    If you want to ensure that the values are updated when a new bar forms on the higher interval check for a BARSTATE_NEWBAR using getBarStateInterval() (for the description and syntax see the link to the EFS KnowledgeBase article)
    Alex

    Comment


    • #3
      One More Thing !

      Alexis

      Thanks ... that's great!

      One more question can I call a study that calls another study?

      Paul

      Comment


      • #4
        Paul
        Yes it is possible in the same way you can use efsInternal() to call an internal function which in turn calls another internal function (and so on) also through efsInternal().
        See this thread for some examples of nested efsInternal() and efsExternal() calls.
        Alex

        Comment

        Working...
        X