Announcement

Collapse
No announcement yet.

reload

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

  • reload

    How would one write and EFS to include reloading that EFS at the beginning of each new bar ? I know there is a reload EFS() function

  • #2
    Hello morpheous,

    Before we explore the methods for using the reloadEFS() function, may I ask why you need to reload at the instance of each new bar? There is most likely a better solution for you vs. the reloadEFS() function.
    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
      well I'm currently using a signal system that computes on close, I use compute on close to avoid false signals however I also find that I miss big moves in the ES waiting for the 3 minute bar to close. I'm looking for a way to get the early signals during the formation of the bars while maintaining the close of each bar signal to comfirm the signal. Know what I mean? I thought the reload function might be a way to "clean up" the draw arrow alerts that will clutter up the chart. Also, is it possible to have the add to list alert compute on close exclusively, will other alerts compute on every tick?

      morph

      Comment


      • #4
        Hi,

        well I'm currently using a signal system that computes on close, I use compute on close to avoid false signals however I also find that I miss big moves in the ES waiting for the 3 minute bar to close.
        Instead of using ComputeOnClose you might try encapsulating those parts of the formula you want only to execute on a bar close with a check for NEWBAR:

        var nState = getCurrentBarState();
        if (nState == BARSTATE_NEWBAR){
        // Code to execute only on start of newbar goes here
        }

        Also, is it possible to have the add to list alert compute on close exclusively, will other alerts compute on every tick?
        See the above.

        I thought the reload function might be a way to "clean up" the draw arrow alerts that will clutter up the chart.
        If you want to draw arrow on the chart, you can use the same label for each arrow, only changing the label when a NEWBAR comes in:

        var nIndex = getCurrentBarIndex();
        var nlabel = 0;
        var nState = getCurrentBarState();
        if (nState == BARSTATE_NEWBAR){
        nlabel++;
        }
        drawShapeRelative(nIndex,5,Shape.UPTRIANGLE, "", Color.lime, Shape.RELATIVETOTOP, "UpArrow" + nlabel);

        So for each time the drawshape above is executed in a bar it will automatically draw an UPTRIANGLE at the current bar near the top of the chart. It will also erase any other UPTRIANGLE's previously drawn for that same bar (and hence using the same label).

        You can also use removeShape("UpArrow" + nlabel) to explicitly remove an existing shape...

        Garth
        Garth

        Comment


        • #5
          thanks for the advise, I understand in theory. I tried to define a var nState = getCurrentBarState(); but I'm getting a "getCurrentBarState()" not defined error?

          Comment


          • #6
            Try getBarState().
            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


            • #7
              Ooopps. Sorry, Jason is correct.

              Garth
              Garth

              Comment


              • #8
                If I have the below Action and want to do everything on close of bar except play sound (want early warning) how would I do it. I've taken your addvice and used vState == BARSTATE_NEWBAR for the execute code but what now?


                function onAction1() {
                if (vLastAlert != 1) drawShapeRelative(0, low()-.35, Shape.UPARROW, "", Color.RGB(0,255,0), Shape.LEFT);
                if (vLastAlert != 1) Strategy.doLong("", Strategy.MARKET, Strategy.NEXTBAR, Strategy.DEFAULT, 0);
                if (vLastAlert != 1) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Reminder.wav");
                if (vLastAlert != 1) Alert.addToList(getSymbol(), "3Min Rocket UP - check 13Min", Color.RGB(0,0,0), Color.RGB(0,255,0));
                nEntryPrice = open(1);
                vLastAlert = 1;
                Last edited by morpheous; 07-30-2003, 12:06 PM.

                Comment


                • #9
                  Was the code produced by the FW?

                  I will give you a general idea, but if you are using the FW I don't really know the steps to accomplish it...

                  You would need to take the statement:

                  if (vLastAlert != 1) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Reminder.wav");

                  and out of that second of code, and create a new section that isn't in the check for NEWBAR, but is in the section of code after you have verifed your signal.

                  This code would look something like:


                  if (vLastAudioAlert != 1) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Reminder.wav");
                  vLastAudioAlert = 1;

                  You would also have to declare a new local global called vLastAudioAlert.

                  G
                  Garth

                  Comment


                  • #10
                    Hi,

                    Also, don't forget to reset vLastAdioAlert at the same location that vLastAlert is reset.

                    Garth
                    Garth

                    Comment


                    • #11
                      I think I'm close but maybe I misunderstood what "BARSTATE_NEWBAR" means. Does it mean "computeonclose" or is newbar a bar that has no signals on it yet?

                      here's my problem.. I want to draw and arrow and popup alert on the close of the bar only, while playing a sound on every break of the rule

                      I've define my long entry as "vLong"
                      action 1 draws the arrow and popup while action 7 only plays a sound. What happens is the arrow and popup occur during the formation of the bar, I want it to compute on the close only.
                      Can this be done?

                      var vLong == "my entry signal"
                      var vState == getBarState();

                      if (
                      vState == BARSTATE_NEWBAR &&
                      vLong == true
                      ) onAction1()

                      else if (
                      vLong == true
                      ) onAction7()
                      Last edited by morpheous; 07-31-2003, 08:26 AM.

                      Comment


                      • #12
                        Hello morpheous,

                        getBarState() returns BARSTATE_NEWBAR at the instance a new bar begins. For every trade during the formation of the bar, getBarState() returns BARSTATE_CURRENTBAR.

                        What you need to do is check for BARSTATE_NEWBAR and then look at close(-1), which is the close of the previous bar that just closed. Then, if your condition is true use -1 for the x position in your drawShapeRelative(-1, low()-.35, .... ) function.
                        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


                        • #13
                          Ok I think I understand but if as you say

                          "getBarState() returns BARSTATE_NEWBAR at the instance a new bar begins. then why would the statement"
                          then why would

                          if (
                          vState == BARSTATE_NEWBAR &&
                          vLong == true
                          ) onAction1()

                          not work, because as you said

                          "For every trade during the formation of the bar, getBarState() returns BARSTATE_CURRENTBAR."

                          then that would mean that the state "vState == BARSTATE_NEWBAR &&" is false in the above statement and action1() would not occur?

                          also you said

                          "What you need to do is check for BARSTATE_NEWBAR and then look at close(-1),"

                          what is the syntax on that? is it
                          vState == (BARSTATE_NEWBAR, close(-1))

                          Comment


                          • #14
                            also you said

                            "What you need to do is check for BARSTATE_NEWBAR and then look at close(-1),"

                            what is the syntax on that? is it
                            vState == (BARSTATE_NEWBAR, close(-1))
                            I think he was just being generic in his reply. He means you check for the long condition -1 bars back.

                            In reality, I can't think that you need to do this. Let's take the example of historic data. When it says I have a NEWBAR and I request the close, I get the closing value of that bar (same for high, low, etc...). Therefore for historic data NEWBAR and CURRENTBAR are the same.

                            For realtime data, the odds of any large move happening between the last tick of the previous bar and the first tick of the NEWBAR is very remote. I can see this happening on daily charts that don't include overnight sessions, but I can't see it for any other case (except of course weekly and monthly).

                            So for looking at the current close (open, high, etc) on NEWBAR to be a problem you would have to be runing a daily chart and leave it up over night...I don't think many of us do this (I'm sure some do, but I doubt it would even register as 1%).

                            But using -1 for the time portion of the draw makes good sense, is is likely what you want to do.

                            Garth
                            Garth

                            Comment


                            • #15
                              I appreciate all the help, but this is getting a little confusing so what I've done is created two EFS, one that computes on close and one that doesn't, on the one that doesn't the only alert I have is a sound, the arrows and popup are on the computeonclose EFS. It does the job but I have to remember to adjust to EFS when I want to change something..

                              Comment

                              Working...
                              X