Announcement

Collapse
No announcement yet.

Help designing a Control Panel

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

  • Help designing a Control Panel

    I'd like to write a study that instead of plotting something, it displays values in a Control Panel. Very similar to the esignal Cursor window.

    As an example I would like to print the current value for the TRIN and TICK in a simple text-type box surrounded by a frame. This information box would display either on top of the chart window or alternatively in a separate window pane below.

    I'v tried using DrawTextAbsolute or DrawTextRelative but these move in relation to the main chart data as bars are added or if your scroll left/right. The Control panel needs to remain fixed in situ very much like the esignal Cursor window.

    Anyone any ideas of how I go about writing this.
    Last edited by Freefox; 09-19-2004, 02:17 AM.

  • #2
    Freefox
    The enclosed example will write "your value here" in a fixed spot in an indicator window. The writing will not move when the chart is scrolled or the bar spacing is changed.
    Hope this helps
    Alex

    PHP Code:
    function preMain() {
        
    setPriceStudy(false);
        
    setStudyTitle("Sample");
        
    setShowCursorLabel(false);
        }
            
    function 
    main() {
        
        
    drawTextPixel(20,20,"your value here",Color.white,Color.black,Text.BOLD|Text.FRAME|
                      
    Text.RELATIVETOTOP|Text.RELATIVETOLEFT,"Arial",20);

    return;

    Comment


    • #3
      Freefox:

      Attached is a simple example script that should get you started. It draws text in a frame at top left of chart that remains fixed, regardless of scrolling etc.

      Chris
      Attached Files

      Comment


      • #4
        Thanks ckryza and Alexis, this is exactly want I wanted to print a non moving text box.

        Next problem I've encountered is how do I always show current value for a symbol (eg. TRIN) regardless of what the bar interval of the current chart is.

        For example, my main dsiplay may show a 5 minute barchart of the emini S&P 500 (ES Z4) but what I would like to do is show the real-time value of TRIN. That is, for each change in the value of TRIN I want to display is value in the control panel.

        I've seen there are various ways to do this when I new bar is plotted in the main window etc, but I want to print the real-time value of TRIN every time it changes regardless of the interval in the main charting window. Effectively the 'event' I need to capture is an 'ONChange' for the value of TRIN.

        Any help greatly appreciated?

        Comment


        • #5
          Freefox
          The enclosed sample efs should do what you asked. It will print the current value of $TRIN in a fixed spot of the indicator window (same as in the script I posted earlier).
          Through Edit Studies you can change the symbol for which you want to retrieve the current value (default is $TRIN)
          Alex

          PHP Code:
          function preMain() {
              
          setCursorLabelName("Sym");
              
          setStudyTitle("Sym")
                  
              var 
          fp1 = new FunctionParameter("Sym"FunctionParameter.STRING);
              
          fp1.setName("Symbol");        
              
          fp1.setDefault("$TRIN");
          }     

          function 
          main(Sym) {
                  
          var 
          vSymbol close(0Sym);

              
          drawTextPixel(2020formatPriceNumber(vSymbol), Color.whiteColor.black,Text.BOLD|Text.FRAME|
                            
          Text.RELATIVETOTOP|Text.RELATIVETOLEFT"Arial"20"Sym");


              return ;

          Comment


          • #6
            Thanks for this Alexis,

            Couple of questions though ...

            1. Is there a way to NOT show anything in the esignal Cursor window as it it not relevant when you are displaying values in a seperate text box on the screen?

            2. Also can you provide me example code of how I would use this technique to display 2 values on the screen at the same time. (eg. TICK and TRIN) ? (Again making sure that both are real-time, ie. immediatley any value changes it is reflected on the screen). Based on that I should be able to extend it myself to include some other values I am interested in and execute some calculations.

            Thanks.
            Last edited by Freefox; 09-19-2004, 11:51 AM.

            Comment


            • #7
              Freefox
              1. Yes, add setShowCursorLabel(false); in the preMain section of the efs (see sample script below)
              2. See sample script below
              Alex

              PHP Code:
              function preMain() {
                  
              setCursorLabelName("Sym");
                  
              setStudyTitle("Sym");
                  
              setShowCursorLabel(false);
                      
                  var 
              fp1 = new FunctionParameter("Sym"FunctionParameter.STRING);
                  
              fp1.setName("Symbol");        
                  
              fp1.setDefault("$TRIN");
                  
                  var 
              fp2 = new FunctionParameter("Sym2"FunctionParameter.STRING);
                  
              fp2.setName("Symbol2");        
                  
              fp2.setDefault("$TICK");
              }     

              function 
              main(Sym,Sym2) {
                      
              var 
              vSymbol close(0Sym);
              var 
              vSymbol2 close(0Sym2);

                  
              drawTextPixel(2020formatPriceNumber(vSymbol), Color.whiteColor.black,Text.BOLD|Text.FRAME|
                                
              Text.RELATIVETOTOP|Text.RELATIVETOLEFT"Arial"20"Sym");
                  
              drawTextPixel(2050formatPriceNumber(vSymbol2), Color.whiteColor.black,Text.BOLD|Text.FRAME|
                                
              Text.RELATIVETOTOP|Text.RELATIVETOLEFT"Arial"20"Sym2");


                  return ;

              Comment

              Working...
              X