Announcement

Collapse
No announcement yet.

difference between day and night sessions

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

  • difference between day and night sessions

    I am wondering if there is a script to show a slight background change of color ( like light grey for day and darker gray for night)

    I am aware of the little hash marks diamonds that print at the bottom of the screen for this purpose - but like with CQG - they have a much better visual way of marking there charts - a much easier way to see exactly what traded in globex or eurex and where the day session starts.

    I believe it has to be simple to create this script - if somewone made the little diamonds and the bottom - why cant they make chart background color change instead - slight color changes.

    Thanks,
    Graham Davis

  • #2
    Graham
    The attached script should do what you are looking for.
    You can set the RTH start/end times through Edit Studies
    Alex

    PHP Code:
    function preMain(){
        
    setPriceStudy(true); 
        
    setStudyTitle("Background"); 
        
    setShowCursorLabel(false); 

        var 
    fp1 = new FunctionParameter("StartRTH"FunctionParameter.NUMBER);
        
    fp1.setDefault(930);
      
        var 
    fp2 = new FunctionParameter("EndRTH"FunctionParameter.NUMBER);
        
    fp2.setDefault(1615);
    }

    function 
    main(StartRTH,EndRTH){

        if (!
    isIntraday()) return;
        
        if((
    getHour()*100)+getMinute() >= StartRTH && (getHour()*100)+getMinute() < EndRTH){
            
    setBarBgColor(Color.RGB(220,220,220));
        } else {
            
    setBarBgColor(Color.lightgrey);
        }

        return 
    null;

    Comment


    • #3
      problem

      Alexis
      I cant get it to work on a tick chart ie. 1024t chart of the es #f
      Thanks,
      Graham

      Comment


      • #4
        Graham
        Replace if (!isIntraday()) return; with if (isDWM()) return; and it should work
        Alex

        Comment


        • #5
          !!!!

          you are great !!!
          Graham

          Comment


          • #6
            Graham
            Thank you for the compliment
            Alex

            Comment


            • #7
              color change

              Alexis, (sorry about the pm)

              I ran across this thread for the background color change script. It was very helpful....Thanks to everyone helping those of us who are not programmers.

              After saving and changing the start & end times it worked quite nicely on my chart. Then, I tried to change the times for a different period, saved with different name and tried to run it in addition to the first efs file. Wouldn't work

              Wondering what I need to do to the script to get the following background colors??

              basic background color - white if possible

              0100-0200 - light green
              0200-0400- light grey
              0400-0800 - light green
              0800-1300 - light grey

              Can you have additional variables in the script??

              Thanks for any help,

              Dan

              Comment


              • #8
                Dan
                You would need to change the conditions to something similar to the following example

                PHP Code:
                if((getHour()*100)+getMinute() >= 100 && (getHour()*100)+getMinute() < 200){
                        
                setBarBgColor(your color);
                    } else if((
                getHour()*200)+getMinute() >= 100 && (getHour()*100)+getMinute() < 300){
                        
                setBarBgColor(your color);
                    } else if((
                getHour()..etc...){
                        
                setBarBgColor(your color);
                    } else {
                        
                setBarBgColor(your color); 
                For a list of available "plain language" colors see this article in the EFS KnowledgeBase. For other colors use the RGB code.
                As to adding variables use the existing ones as an example assigning to each variable a different fp# and your own variable name and default value

                PHP Code:
                var fp2 = new FunctionParameter("EndRTH"FunctionParameter.NUMBER);
                    
                fp2.setDefault(1615);
                    
                    var 
                fp3 = new FunctionParameter("var_name1"FunctionParameter.NUMBER);
                    
                fp3.setDefault(value1);
                    
                    var 
                fp4 = new FunctionParameter("etc"...) 
                For each variable you add you will also need to include inside the brackets of function main() the name you assigned ie
                function main(StartRTH,EndRTH,var_name1,etc){
                Hope this helps
                Alex

                Comment


                • #9
                  Thanks much Alex....I appreciate the help

                  Comment


                  • #10
                    study Z ordering w/ BarBgColor

                    I have used a similar EFS for some time, and frequently have to delete and reload my after hours EFS so that more recently loaded studies can be seen.

                    It appears that the latest loaded study goes to the bottom of the ordering, so after adding a new study I need to delete and restart the after hours script. Note just Reload'ing it is not enough.


                    I also seem to have this problem when starting eSignal and my saved Page loads up. Frequently, the after hours script covers up some of the other studies.
                    This is even after I've done the above fix and re-saved the Page.

                    Is there a way to force a script like your background script to always be at the bottom of the depth buffer?

                    Thanks

                    Comment


                    • #11
                      Hello dgerdes,

                      Currently we do not have any methods for controlling the z-ordering within the EFS code. To have our development team consider creating some new functionality for handling this, please submit a request to [email protected].
                      Jason K.
                      Project Manager
                      eSignal - an Interactive Data company

                      EFS KnowledgeBase
                      JavaScript for EFS Video Series
                      EFS Beginner Tutorial Series
                      EFS Glossary
                      Custom EFS Development Policy

                      New User Orientation

                      Comment


                      • #12
                        Thanks Jason,

                        Before I submit the request you recommend, let me ask the question slightly differently.

                        I don't need to be able to control this from w/in EFS (altho for the afterhours background, that would be a nice feature)

                        My question was more general asking if there is any way to explicitely control the ordering of various EFS's so that the changes were persistant and reliable. (e.g. via the Page or Layout structures)

                        Forgive me if I'm posting this question in the wrong place.


                        Thanks again

                        Comment


                        • #13
                          Hello dgerdes,

                          I misunderstood the initial problem you were describing. I'm seeing how the setBarBgColor() function from one study is covering the indicator lines from studies that are applied after that study. This is a problem that needs to be fixed. I've reported this to our development team. For future reference the tracking number is EDL# 12306.

                          However, I would still encourage you to submit a request for some z-order controls. Either through EFS or Advanced Chart properties, which could resolve this issue as well.
                          Jason K.
                          Project Manager
                          eSignal - an Interactive Data company

                          EFS KnowledgeBase
                          JavaScript for EFS Video Series
                          EFS Beginner Tutorial Series
                          EFS Glossary
                          Custom EFS Development Policy

                          New User Orientation

                          Comment


                          • #14
                            Cool. Thanks Jason.


                            Make sure your boss knows your customers appreciate your quick and effective responses.

                            Comment


                            • #15
                              My pleasure. Thank you for the compliment.
                              Jason K.
                              Project Manager
                              eSignal - an Interactive Data company

                              EFS KnowledgeBase
                              JavaScript for EFS Video Series
                              EFS Beginner Tutorial Series
                              EFS Glossary
                              Custom EFS Development Policy

                              New User Orientation

                              Comment

                              Working...
                              X