Announcement

Collapse
No announcement yet.

Getting the value for $TICK in EFS study

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

  • Getting the value for $TICK in EFS study

    I have been trying to get the value of the $TICK into my EFS study, so I am using the following code:

    myTICK_O = open(0, 1, "$tick")*1;
    myTICK_H = high(0, 1, "$tick")*1;
    myTICK_L = low(0, 1, "$tick")*1;
    myTICK_C = close(0, 1, "$tick")*1;

    I basically found some various snipets of code out there for $TRIN and $TICKI, I am not sure why the code that I found is multiplying the value by 1, but what have you.

    So I print out the value in an output file, and I know the values that it should be getting for a 1-minute bar in specific, but I can not get the same value in my EFS output as see on a $TICK chart.

    I went through the obvious, I matched up the specific bar to the value I am looking for, but still nothing. Can someone help me out, what am I doing wrong, and in specific, how can I get the same value that I see in a $TICK chart in my EFS?

    Thanks so much,

    Thomas.

  • #2
    Thomas,

    Long time, no see, I recieved your message regarding your progress, congrats.

    Regarding the multiplication by 1, the reason for that is that the value is a string. Multiplying by 1 converts it to a number.

    I'm not sure with regards to the rest of your post.

    Comment


    • #3
      Re: Reply to post 'Getting the value for $TICK in EFS study'

      This format of o,h,l and c report as a string, multiplying it by 1 turns it
      into a number.

      Not sure what the other problem is.

      Comment


      • #4
        Thomas
        What is the Time Template of the chart on which you are running the efs?
        If it is for trading hours other than those of $TICK (9:30-16:00 or equivalent if in different time zone) then the returned values may go out of sync.
        Alex

        Comment


        • #5
          Possibly solution..

          Thomas,

          The getValue function you are using in your efs wills the TICK data evertime there is a new tick in your ROOT chart (the chart running your EFS. Thus, the TICK value may change 2 or more times for every tick that comes thru with your ROOT CHART.

          An alternate solution would be to create a $TICK chart and load a specialized EFS onto it that report the information you want to global variables. This way, your global variables would be updates with every tick of the $TICK chart. Then your other EFS (and chart) could pull this information and use it.

          Maybe this will help.

          Brad
          Brad Matheny
          eSignal Solution Provider since 2000

          Comment


          • #6
            update . . .

            Thanks so much for the responses thus far . . .

            I understand the [ X * 1] idea . . . never thought it would return a string.

            Brad . . . great idea, I am not sure I really understand.

            Alexis . . . perhaps I should just let you know what I am trying to do. I have an ES chart, on a 1-minute, and at the same time I am looking at a $TICK chart, also 1-minute. I want to pull the values from the $TICK chart (NYSE) into my EFS, so I am doing these calls in the exact same place that I am doing study calls. I have made sure to carefully place my study calls such that I am using the proper values, and not using a value in a backtest which is really the value for the bar, and then evaluating the same value, on the action of that bar. Sounds confusing, but to make it simple, never use the closing value of the bar in backtest to evaluate an action you would perform on the open of the bar.

            I know $TICK is 9:30 to 16:00, so when my EFS started to return values outside that, I knew something was wrong. So that is all there is to it, it is really a simple task. I saw tons of code that do similar with $TRIN and $TICKI, so I copied that code, and it just does not work.

            Let me know if there is any further discription I can provide, but to me this is some silly thing I am missing. The other curious note, I was not sure how my EFS understood that I am calling the values from a 1-minute chart, so I also tried this:

            myTICK = "$TICK,1";
            myTICK_O = open(0, 1, myTICK)*1;
            myTICK_H = high(0, 1, myTICK)*1;
            myTICK_L = low(0, 1, myTICK)*1;
            myTICK_C = close(0, 1, myTICK)*1;

            f7.writeln("##_TICK_## OPEN--> " + myTICK_O + " CLOSE--> " + myTICK_C + " HIGH--> " + myTICK_H + " LOW--> " + myTICK_L + " AT " + bar_stamp);

            How about this . . . as per Brad's idea and something which came to me in the shower, maybe I have to write a seperate study like a study for a MA, or a MACD, and then call the returned value in my primary EFS? How would I do that? Just the code for the tick.efs that keeps the value, and the call from the primary code?

            Still, I should be able to do this directly from the primary EFS. Let me know, as always, greatly appreciated.

            Thomas

            Comment


            • #7
              Thomas
              In the mean time that someone comes up with a solution try setting the Time Template for the chart on which you are running the efs to 9:30-16:00 (even if ES has 9:30-16:15). You should see the plots of $TICK aligned correctly.
              Also you may want to check this message.
              Alex

              Comment


              • #8
                I looked at the other message . . .

                I think I have the jist of it all, but is there no way to do this without going through an external file? I wanted to keep it all internal . . .

                So, if I set the time frames to be the same, it should work, right? I will try the FILE-IO method tonight, but ultimately, I would love to see an internal solution.

                Regards,

                Thomas.

                Comment


                • #9
                  looked at the file . .

                  so there is no easy way of doing this internal? If I set the time frames to each other, it should work just fine, right?

                  I will check the FILE-IO method tonight, get back to all on the results.

                  Regards,

                  T

                  Comment


                  • #10
                    Thomas
                    You need to set the Time Template to the shorter of the sessions (in this case the session of $TICK)
                    Alex

                    Comment


                    • #11
                      Thomas,

                      Instead of going the file I/O route, you could output information from the new chart/timeframe/efs to your primary efs via global variables. Here are two simple efs's, the first being the one that routinely sends the global information, the second one that recieves the global and reads the information. You can develop handshaking between the two efs's to coordinate the exchange of information by using arrays and exchanging the array globally.

                      PHP Code:

                      //First efs gets tick information and processes it and provides data via a global variable


                      function preMain(){
                      setGlobalValue ("NewData",0);
                      }
                      function 
                      main(){

                          if (
                      getBarState() == BARSTATE_ALLBARS) {//true once during initial load and subsequent reload

                          
                      }
                          var    
                      vTime = new Date();
                          var 
                      vMillisecond vTime.getTime();
                          
                      setGlobalValue ("NewData",vMillisecond);
                          
                      //debugPrintln("$$$$$$$$$$$$ = "+vMillisecond);

                      }

                      //Second efs grabs the tick data offered by the other efs from the global variable

                      function preMain(){
                      setGlobalValue ("NewData",0);
                      }
                      function 
                      main(){

                          if (
                      getBarState() == BARSTATE_ALLBARS) {//true once during initial load and subsequent reload

                          
                      }
                          var    
                      vTime = new Date();
                          var 
                      vMillisecond vTime.getTime();
                          var 
                      nSet getGlobalValue ("NewData");
                          
                      //debugPrintln("get global time minus set global time = "+(nSet-vMillisecond));


                      I had used these two efs's to check the amount of time it took to exchange the data. When I ran last night on the eMini, the measured time difference was 0, but volume was very low. To perform the check yourself, uncomment the debug lines in both.

                      If you think this would help and you need more details, let me know.

                      Regards,

                      Comment


                      • #12
                        perhaps the wrong series . . .

                        hey Steve,

                        Thanks for your reply, you know how it is when you get stuck on something you normally don't do, I hate this!!!

                        I do not need tick data, I need data on the $TICK, which is an indicator, like $TRIN, $PREM, and so forth.

                        Read the whole post, I might have misunderstood you, but all I need is the data from the $TICK that I see in another chart. I will work on setting the time frame to be equal, and seeing how that helps.

                        If anyone has any other ideas, I am still all ears until I get a chance to try some of this out tonight.

                        Thanks for all the responses so far . . .

                        Thomas.

                        Comment


                        • #13
                          Thomas,

                          Sorry for not being clear, but I was a bit quick in my answer, I meant $TICK. If it is data, it can be passed.





                          Regards,

                          Comment


                          • #14
                            alright . . .

                            hey Steve,

                            Thanks . . . so I run EFS2 in the TICK chart and just output the O, H, L, and C, and then run EFS1 to get the values in on a normal ES chart?

                            I will try to slap this together, I am trying the time frames first since it seems to be the easiest solution and Alexis says it will work.

                            Just in case, if you have the time for it, can you just show me a little example with an EFS I would load in a one minute chart, and the EFS I would load in a tick chart? I could experiment, but I am sure you might be able to do it a lot smoother than my fumbling.

                            Are both EFS running in one chart? I follow the code, and I understand it, I am just getting confused at the passing of the value. Also, how do I control the passing of the value for the specific bar in question? I am not sure how that call happens for the same bar, or is that inherent.

                            You know . . . I am just not seeing it . . . I just have a mental block on this.

                            T

                            Comment


                            • #15
                              Thomas,

                              I am pressed for time, but here is some code that I use to transfer info between efs's. The 1st snippet is the one that supplies the data, the second snippet monitors every tick
                              PHP Code:

                              1st efs

                              var LI = new Array(12);
                              var 
                              globSig = new Array(2);

                              for (
                              i=0;i<12;i++){
                                  
                              LI[i] = close(-i);
                              }


                              setGlobalValue (("nLi"), LI)
                              setGlobalValue ("NewData"1);//set to indicate global posted
                                  
                                  
                                  
                              2nd efs
                                  
                                  
                                  
                              var flag getGlobalValue("NewData");
                                  if ( 
                              flag == null ){flag 0;}
                                  if (
                              flag){//if we have data
                                      
                              setGlobalValue("NewData",0);//set to zero
                                      
                              var data getGlobalValue("nLi");  // data is now an array, 12 long, no need to parsefloat
                                  

                              I have some committments tonight and will not be able to follow up until much later. Hopefully it helps. BTW, Alex is usually right.

                              Regards

                              Comment

                              Working...
                              X