Announcement

Collapse
No announcement yet.

getvalue on different intervals

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Ian,

    Ooop...just saw your post that you got it to work. Great! So how did you sych the two EFS studies so that historical data would reflect the correct values?

    Garth
    Garth

    Comment


    • #17
      I couldn't synch them up historically. I am actually designing the system for intraday...so I had to wait for the market to open today to test it out.
      I'm in the process of hooking up the balance of the 4 intervals I'm using to the GlobalValues. There are a few things that are a little unusual (when isn't that the case?)...but otherwise, it seems to work.
      I would like to look at the twotimer. When & where would it be posted?

      Ian

      Comment


      • #18
        Ian,

        Alex has been really swamped lately (as you can tell from all the questions he has been handling on this BB lately, and he is doing other stuff as well), so I'm not sure when he will have the last bits together. It should be fairly soon.

        My guess is he will post it to the EFS group...or at least post a pointer to it there if he posts it elsewhere.

        But really, I will let Alex speak for himself, as he knows his plans and schedule better than I (at least I hope he does ;-).

        Garth
        Garth

        Comment


        • #19
          The GlobalVariables worked (less a few glitches) with 2 simple test efs that I ran today. In the process, I have finished putting the GlobalVariables in all 3 of the efs that I divided to work in 3 different time intervals. However, now when I try to start up any one of them, esignal freezes. I have to move the location of the files to get it running again.
          Each efs worked perfectly before I put in the GlobalVariables, so I know that there within lies the problem.

          Using the GlobalVariables prevents me from backtesting (in my particular situation) and now this. Do you think that I should be working with a platform that can do multiple time intervals in 1 file?
          Unfortunately, I do not have the luxury to wait for esignal to come up with a distant future solution, as I am subject to time constraints.

          Comment


          • #20
            Well you can do this in eSignal...its just painful at this point. Your problem with the globals might have to do with getting null returns instead of data...check for nulls on all returns.

            In order to get backtest data, you will have to do something fairly clever to synch up you studies. There is no real easy way to do this at this time, but it is possible. There are a few ways:

            1) The method twotimer uses a single chart and has you load in each interval one at a time. This may not work for you if you need all charts synched up at one, but for people using historical data to plot future events it works fine.

            2) You could make sure you always hand load your studies in a specific order. This would allow you to know "for sure" that the study that needs to run first does. It can keep all its values in an array and either use universal globals, or write these values to a file for the next one to read, etc. Once all are started they should stay in synch in RT. Note that you would have to keep the timestamps for the historical data as well to make sure everything is synched. You can even use your universal globals to make sure that things are loaded in the correct order, or it prints and error msg on the chart.

            3) You could use a universal global "I'm done" flag to keep everything in order. This would mean interating all bars by hand after the zero bar is reached by all. You could even lockstep them by having each wait for the "I'm Done" flag. You would still have to track date/time stamps to make sure everything stays in order.

            3) You could write the builtin's you need using EFS and just use getValue(close,,,"Symbol,Interval") as the input.

            There are variations on these themes to make them easier to use, and it all really depends on how your indicators work together on which approach I would take.
            Garth

            Comment


            • #21
              At this point, with all the hours I've put in, I really just would like to see this work in real time. I suppose that for the time being I can rig a few modified efs to use for back testing that wouldn't use any of the Globals, so I'm not going to spend much time on synching for backtesting.

              With respect to the null returns, I actually have no experience working with them. I included a small part of the main of 1 of the efs. Garth, would you mind giving me a for instance on how I would use it in my case.

              thnx:

              function main() {
              /**
              * The main() function is called once per bar on all previous bars, once per
              * each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
              * in your preMain(), it is also called on every tick.
              */

              var vTime = getValue("Time");
              hour=vTime.getHours();
              min = vTime.getMinutes();

              //{{Share global values by all 4 EFS
              var LongOndmi=0;
              var LongOnadx=0;
              var LongOnmacd=0;
              var ShortOncci=0;
              LongOndmi = getGlobalValue("Longdmi");
              LongOnadx = getGlobalValue("Longadx");
              LongOnmacd = getGlobalValue("Longmacd");
              ShortOncci = getGlobalValue("ShortCCI");

              //{{establishes PDI highs
              if (
              vADXDM.getValue(ADXDMStudy.PDI, -2)+.75 < vADXDM.getValue(ADXDMStudy.PDI, -1) &&
              vADXDM.getValue(ADXDMStudy.PDI, -1) > vADXDM.getValue(ADXDMStudy.PDI)+.75 &&
              vADXDM.getValue(ADXDMStudy.PDI, -1) > vADXDM.getValue(ADXDMStudy.NDI, -1) &&
              ((hour*100) + min >= 930 && (hour*100) + min <= 1545)
              ) onAction1();

              //{{resets PDI high everytime PDI cross below NDI
              if (
              vADXDM.getValue(ADXDMStudy.PDI) < vADXDM.getValue(ADXDMStudy.NDI)
              ) onAction101();

              //{{establishes PDI higher high 1 lot buy entry
              else if (
              vADXDM.getValue(ADXDMStudy.PDI) > lastHighADX &&
              vADXDM.getValue(ADXDMStudy.PDI) > vADXDM.getValue(ADXDMStudy.NDI) &&
              ((hour*100) + min >= 930 && (hour*100) + min <= 1545) &&
              signal==0 &&
              LongOndmi==0
              ) onAction2();
              setGlobalValue("LongOndmi", 1);
              setGlobalValue("ShortOnCCI", 0);

              Comment


              • #22
                Hi,

                In general, anytime you ask for data from eSignal, you should check for a null return. This includes getValue, getGlobalValue, etc...

                What you do on such an error condition is up to the specific application, but typically you would I do one of a few things:

                1) Just do a return and do nothing.
                2) return a null or -1 (this is if my EFS was desinged to be called by another EFS...in this way the calling EFS knows there is problems).
                3) Print an error mesg and return.

                Though there are cases where I do other things.

                So as one example it might look like:

                var MyClose = getValue("Close");
                if (MyClose == null){
                debugPrintln("Error on getValue - null return");
                return;
                }


                Garth
                Garth

                Comment

                Working...
                X