Announcement

Collapse
No announcement yet.

Does an efs load with historical intrabar data or OHLC data only?

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

  • Does an efs load with historical intrabar data or OHLC data only?

    I am having a problem understanding how an efs is loading data. I have an efs running in an AdvChart but if I reload the efs after making a change the efs appears to change as it recalculates. The plotting of the efs is different.

    I also notice that when running in realtime the efs tends to jump, as if it wasn't receiving data but then suddenly does. However I am not losing a connection.

    Any ideas of how eSignal treats this intrabar data but historically and in realtime?

    Thanks

  • #2
    Re: Does an efs load with historical intrabar data or OHLC data only?

    mastag3
    An efs will execute once on each historical bar as it loads on the chart and then once on every tick on the current (ie real time) bar unless the script is specifically set to compute on Close only.
    From what you describe it seems that the script is performing some calculations in real time that should instead occur once only per bar.
    You will need to post the efs or a working example that illustrates the issue for someone to be able to determine what the problem may be and to provide some guidance in resolving it
    Alex


    Originally posted by mastag3
    I am having a problem understanding how an efs is loading data. I have an efs running in an AdvChart but if I reload the efs after making a change the efs appears to change as it recalculates. The plotting of the efs is different.

    I also notice that when running in realtime the efs tends to jump, as if it wasn't receiving data but then suddenly does. However I am not losing a connection.

    Any ideas of how eSignal treats this intrabar data but historically and in realtime?

    Thanks

    Comment


    • #3
      Alex, thanks so much for you quick reply.

      I think what you said makes sense and I understand why its doing what its doing. But I have a follow up. I saw in the EFS help something about setting an instruction within the efs to reload the efs at a new bar. Can you explain further what this means/how it works and help me apply it to the attached efs.

      Finally I have an unrelated question. Is it possible to run and EFS formula on a 1 Min AdvChart that will check the values of the indicators X times per bar (Minute). I have experimented with using a tick chart to approximate X number of bars per minute but that is obviously very stock/volume dependent. I am looking to apply this to an automated trading system but I would like to find a method of checking Buy/Sell signals somewhere in between every tick and at the NewBar. I've scoured the search but have been unsuccessful so far.

      Thanks in advance for your help.

      Gordon
      Attached Files

      Comment


      • #4
        Gordon
        Now that I see the script I think I understand the issue you are referring to. You may want to review the explanation provided in this thread that relates to using studies on multiple time frames.
        As to reloading the script at each new bar that is not necessary if you return the series instead of a value.
        The first change would be to initialize the ema() function once only when the script is first loaded in the chart. To do this replace the following line of code in your script
        PHP Code:
        vEMA ema(Lengthinv(Interval)); 
        with the following
        PHP Code:
        if(vEMA == nullvEMA ema(Lengthinv(Interval)); 
        Note that you are already declaring the vEMA variable as a global variable and setting it initially to null.
        Then replace the return statement ie
        PHP Code:
        return vEMA.getValue(0); 
        with the following
        PHP Code:
        return getSeries(vEMA); 
        As explained in the linked thread this will plot the series rather than the value thereby synchronizing the plot across all the lower interval bars that constitute the higher interval.
        Alex


        Originally posted by mastag3
        Alex, thanks so much for you quick reply.

        I think what you said makes sense and I understand why its doing what its doing. But I have a follow up. I saw in the EFS help something about setting an instruction within the efs to reload the efs at a new bar. Can you explain further what this means/how it works and help me apply it to the attached efs.

        Finally I have an unrelated question. Is it possible to run and EFS formula on a 1 Min AdvChart that will check the values of the indicators X times per bar (Minute). I have experimented with using a tick chart to approximate X number of bars per minute but that is obviously very stock/volume dependent. I am looking to apply this to an automated trading system but I would like to find a method of checking Buy/Sell signals somewhere in between every tick and at the NewBar. I've scoured the search but have been unsuccessful so far.

        Thanks in advance for your help.

        Gordon

        Comment


        • #5
          Thanks Alex. That helps a lot.

          Is it possible to do the same with variables that I've defined and are not internal EFS Studies? Attached is another EFS file where I am trying to return the angle of the slope of the EMA. I am having the same problem when I reload. I tried to use the get series function but it returns a blank screen. I think thats because it sees the angle as a single number and not a series of numbers. Any suggestions?

          Also, do you have any thoughts on the unrelated question I posted previously...
          Finally I have an unrelated question. Is it possible to run and EFS formula on a 1 Min AdvChart that will check the values of the indicators X times per bar (Minute). I have experimented with using a tick chart to approximate X number of bars per minute but that is obviously very stock/volume dependent. I am looking to apply this to an automated trading system but I would like to find a method of checking Buy/Sell signals somewhere in between every tick and at the NewBar. I've scoured the search but have been unsuccessful so far.
          Thanks again.
          Attached Files

          Comment


          • #6
            Gordon
            The reason why you cannot use the getSeries() in your last script is because the variable is a value and not a series.
            When you apply some math to a series the result is a value [and not a series] in the same way as when you apply some math to an array the result is a value and not an array. In order to create a series you will need to calculate your custom variable in a separate function or efs and then call that function or efs from inside main() using either the efsInternal() or efsExternal() functions (see the links to the corresponding article in the EFS KnowledgeBase for the description and syntax of these functions). This will create the series
            For a more detailed explanation and solution see this post in reply to a similar question. In that reply you will also find links to other examples on creating studies on studies or custom variables using efs2 functions
            You may also want to run a search in the EFS Studies forum for the keyword efsInternal* and you will find many examples as this has been discussed before
            Alex


            Originally posted by mastag3
            Thanks Alex. That helps a lot.

            Is it possible to do the same with variables that I've defined and are not internal EFS Studies? Attached is another EFS file where I am trying to return the angle of the slope of the EMA. I am having the same problem when I reload. I tried to use the get series function but it returns a blank screen. I think thats because it sees the angle as a single number and not a series of numbers. Any suggestions?

            Also, do you have any thoughts on the unrelated question I posted previously...


            Thanks again.

            Comment


            • #7
              Gordon
              With regards to your second question you can easily do that using a tick counter that you reset to 1 at every new bar and at every number of ticks at which you want to execute a given action
              Then you create a condition that checks if the counter is equal to 1 (which will occur at every new bar and every n ticks depending on the threshold you use) and execute those actions eg
              PHP Code:
              //example for every 5 ticks

              if(getBarState()==BARSTATE_NEWBAR){
                  
              Counter 1;//note that Co0unter must be declared globally
              }
              Counter++;
              if(
              Counter==5Counter 1;//every 5 ticks the counter is reset to 1 replacxe 5 with a value of choice
              if(Counter==1){
                  
              //execute your actions here
              }

              //alternatively use the modulus operator ie
              Counter++;
              if(
              Counter == 0){//if the integer remainder of Counter divided by 5 is 0
                  //execute your actions

              If you run a search in the EFS Studies forum for the keyword tick counter you should find several examples on how to create tick counters as the subject has been discussed before
              Alex


              Originally posted by mastag3
              Alex, thanks so much for you quick reply.

              I think what you said makes sense and I understand why its doing what its doing. But I have a follow up. I saw in the EFS help something about setting an instruction within the efs to reload the efs at a new bar. Can you explain further what this means/how it works and help me apply it to the attached efs.

              Finally I have an unrelated question. Is it possible to run and EFS formula on a 1 Min AdvChart that will check the values of the indicators X times per bar (Minute). I have experimented with using a tick chart to approximate X number of bars per minute but that is obviously very stock/volume dependent. I am looking to apply this to an automated trading system but I would like to find a method of checking Buy/Sell signals somewhere in between every tick and at the NewBar. I've scoured the search but have been unsuccessful so far.

              Thanks in advance for your help.

              Gordon

              Comment


              • #8
                Alex Thanks, but i really wasn't looking to use ticks as a parameter. A tick chart was one way I thought to get around the issue I was having. I was looking for a way to cut a one minute bar into pieces. For instance. I have a strategy running on a 1 minute adv chart and I'd like the strategy to "check" if it should perform an action,for example, 4 times per bar, or every 15 seconds.

                This way I can cut down on false signals of running it on every tick, but am able to act quickly enough if something changes within the minute bar.

                Is this possible?

                Comment


                • #9
                  Gordon
                  You would need to do that using the Date Object and setting your conditions based on system (ie your computer's) time eg
                  PHP Code:
                  var sysDate = new Date();
                  if(
                  sysDate.getSeconds()==15){
                      
                  //execute your commands;l;

                  For the description and syntax of the object and its methods see the link to to the article in the EFS KnowledgeBase.
                  Keep in mind though that an efs executes only on trades so if there is no trade at for example the 15th second within the minute the efs will not execute the instructions you may have set for that specific time.
                  Also a trade may not occur at the exact time set in the condition ie instead of 10:01:15 it may occur at 10:01:16 so again the instruction would not be executed at the specific time.
                  Alex


                  Originally posted by mastag3
                  Alex Thanks, but i really wasn't looking to use ticks as a parameter. A tick chart was one way I thought to get around the issue I was having. I was looking for a way to cut a one minute bar into pieces. For instance. I have a strategy running on a 1 minute adv chart and I'd like the strategy to "check" if it should perform an action,for example, 4 times per bar, or every 15 seconds.

                  This way I can cut down on false signals of running it on every tick, but am able to act quickly enough if something changes within the minute bar.

                  Is this possible?

                  Comment

                  Working...
                  X