Announcement

Collapse
No announcement yet.

Draw Starting At Mouse Click?

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

  • Draw Starting At Mouse Click?

    Hi

    I wish to draw a non price cyclic indicator, and initiate its starting point in the pane with a mouse click.

    I can detect the index bar with a mouse click but would appreciate some guidance on the following:

    1) How to clear the study pane once the default has drawn initially.

    2) How to initiate a re-draw from mouse selected index bar.

    Basically this is a 'Reload' and redraw from a specific point.

    Thanks

  • #2
    Hello red49er,

    I think that using mouse clicks to control this behaviour is the more complex route. If I understand correctly, you want your indicator to start at a specified bar index. The easiest way to do this, in my opinion, would be to set up a formula parameter where you would enter the start time of the bar or the bar index. When you apply the change to the Edit Studies dialog, the formula gets reloaded by default. Within your formula code, you would use this parameter in a condition to look for that specified bar while the formula is loading to trigger the starting point for the indicator calculation. Hope this helps.
    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


    • #3
      how about storing the selected bar's index and using reloadEFS() and testing for the existence of the value? [all "global" (not in a function) variables are preserved]

      PS: You are right, "Basically this is a 'Reload' and redraw from a specific point.", if my idea works that is.
      Last edited by Dave180; 07-24-2008, 04:47 AM.

      Comment


      • #4
        Thanks Jason & Dave,

        I finally managed it by selecting the required index bar with a double click, and storing that in a Global var before a reloadEFS.
        Then filtering out all bars prior to the selected index bar as it reloaded.
        Took a while but got there in the end!
        Incidentally, I COULD NOT find a way to pass the selected index bar to the 'Study Properties' popup after a doubleclick and 'askForInput'. It just pulled up the last stored function parameter value presumably retrieved from efs-engine memory storage area. So you had to directly type in the selected index bar in 'Study Properties' to get it to draw correctly(sort of defeated the object of having a double click do all the work).
        Is there a way you can think of to access a function param. var, or push data to it from within a script? (i.e. not going through the popup) I tried using a Global var as func.param. input but it still kept returning the old previous value, maybe I was doing something wrong?
        Thanks for your input and any further ideas on the function param. point.
        Best regards.
        Last edited by red49er; 07-25-2008, 09:16 AM.

        Comment


        • #5
          Hello red49er,

          You're most welcome.

          The Edit Studies dialog is only intended for manual changes to the parameters. If you want to change formula parameters pragmatically, I would suggest bypassing the Edit Studies dialog altogether and just set the globals with these values for reference within your formula logic.
          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


          • #6
            DoubleClick Madness...!

            Greetings o' wise ones with furrowed brows...

            Can anyone offer suggestions?
            I'd be eternally grateful if you could...

            THE PROBLEM:
            To redraw non price study starting from barIndex position of a double click loaded into global var. StartDraw.
            SO FAR:
            Used bar index value obtained by doubleclick which is loaded into global variable before reloadEFS. This would normally work.
            However, I'm filtering out bars prior to StartDraw using conditional, as I don't need to display them and it cuts down on time to plot the rest (complex indicator!)
            I initially plot points from say, -150 to -1, and some future points from 0 to say +25 (I have setComputeOnClose() active).
            ReloadEFS will not redraw the bars from -150 to -1. I've tried allowing it through/or block using all BARSTATE_? conditions also my own initiation var.
            WHAT WORKS:
            Is the EDIT STUDIES routine, which redaws everything perfectly when new StartDraw entered!!
            So my real question is... What are the conditions which it uses (variables saved/BARSTATE etc. etc.) to allow me to do the same with my StartDraw variables before reloadEFS?

            Input eagerly awaited...
            Best Regards
            Nigel
            BTW we had a brief topic on this on 07-25-08
            'Draw starting at mouse click'

            Comment


            • #7
              Try dumping needed values to a text file. I use this for different projects as needed.

              Simply create a routine that CREATES the text file when needed (or in POSTMAIN). You want to store definitions on each line.. like..

              startbar = -203;
              endbar = -1;
              othervar1 = true;
              othervar2 = 24.50;

              Now, on reload, you want to READ this file and eval() the statements in that file in your main() function.

              The end result should be that your settings are RELOADED as needed.

              You can also create a function to CLEAR the settings by writing an empty file when needed.

              If you don't understand this, send me a PM and I'll try to help further.
              Brad Matheny
              eSignal Solution Provider since 2000

              Comment


              • #8
                red, not sure I understand what the problem is, I can't understand
                ReloadEFS will not redraw the bars from -150 to -1. I've tried allowing it through/or block using all BARSTATE_? conditions also my own initiation var.
                Is this to do with when the chart is reloaded (when eSignal is restarted say), or because the wrong bars get ignored / processed if you use Edit Study after you have done a click-induced reloadEFS()?

                Bar indexes change, so perhaps I should have been more thoughtful in my initial comment - the rawtime() might be a better value to store to clearly identify bars.

                Comment


                • #9
                  Hi

                  Thanks Dave180 & Doji3333.

                  As before when struggling with a knoty problem for so long I became tired and I gave up...
                  Refreshed this morning I was able to put my finger on it within 30mins. It was to do with making certain all global vars were set correctly before reloadEFS.

                  I have included a bare bones version of the code which may be useful to others playing with doubleclicks, reloadEFS and drawing future bars.

                  Regards
                  Attached Files
                  Last edited by red49er; 11-13-2008, 08:09 AM.

                  Comment


                  • #10
                    Good for you. Code order is important and I'm glad you have it all worked out. Let me know if there is anything else I can do for you?
                    Brad Matheny
                    eSignal Solution Provider since 2000

                    Comment

                    Working...
                    X