Announcement

Collapse
No announcement yet.

alert problem in version 10.1 (July-14-2008)

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

  • alert problem in version 10.1 (July-14-2008)

    Hello,

    I have an old study that worked fine, but
    with the new version of esignal, it is not working. The following efs is an example that shows what is not working:


    function preMain()
    {
    setComputeOnClose();
    }
    function main()
    {
    if( getCurrentBarIndex() > -1 )
    {
    Alert.playSound("phone.wav");
    debugPrintln("bar = -1" );
    }
    }

    The line "bar = -1" is printed, but no sound is played, when the "setComputeOnClose" is used.

    Unfortunately, I have to use the setComputeOnClose() in the full study.

    Please help me to solve this problem,

    Thanks

    Nissan

  • #2
    Re: alert problem in version 10.1 (July-14-2008)

    Nissan
    I am not sure on which prior version of eSignal this study was triggering the alert or printing the debug line but I tested it on version 8.x and neither event is triggered (which is to be expected).
    This is because when using setComputeOnClose() the last bar being processed is bar index -1. You can easily verify this by adding a debugPrintln(getCurrentBarIndex()) outside of the conditional statement and you will see that the value returned will be -1 hence the conditional statement if( getCurrentBarIndex() > -1 ) never evaluates to true.
    If you want to use setComputeOnClose() you need to change the condition to if( getCurrentBarIndex() == -1 )
    Once you make this change the script will trigger both events on each first tick of a new bar
    Alex


    Originally posted by nissan
    Hello,

    I have an old study that worked fine, but
    with the new version of esignal, it is not working. The following efs is an example that shows what is not working:


    function preMain()
    {
    setComputeOnClose();
    }
    function main()
    {
    if( getCurrentBarIndex() > -1 )
    {
    Alert.playSound("phone.wav");
    debugPrintln("bar = -1" );
    }
    }

    The line "bar = -1" is printed, but no sound is played, when the "setComputeOnClose" is used.

    Unfortunately, I have to use the setComputeOnClose() in the full study.

    Please help me to solve this problem,

    Thanks

    Nissan

    Comment


    • #3
      Re: alert problem in version 10.1 (July-14-2008)

      Nissan
      Also note that the latest version of eSignal was updated on July 16 2008 so you may want to download that release
      Alex

      Comment


      • #4
        The last bar on the chart is bar number 0.

        When I run the following efs with daily interval, it prints "bar = 0"
        and also paints a red line on the last bar. However - there is no alert sound.

        When I run it with intraday interval - the last bar is not processed at all. (no "bar = 0", no red line and no alert sound)
        function preMain()
        {
        setComputeOnClose();
        setPriceStudy(true);
        }
        function main()
        {
        if( getCurrentBarIndex() > -1 )
        {
        Alert.playSound("phone.wav");
        debugPrintln("bar = " + getCurrentBarIndex() );
        drawLineRelative(0,0, 0, 50000, PS_DOT, 4, Color.red, 0);
        }
        }

        Comment


        • #5
          Nissan

          When I run the following efs with daily interval, it prints "bar = 0"
          That is because at this time setComputeOnClose() does not take effect on daily, weekly and monthly intervals (see the note in this article in the EFS KnowledgeBase on this function). As I understand it this is slated to be fixed in one of the upcoming releases.

          However - there is no alert sound.
          For some reason unknown to me it does however prevent alerts to be triggered on bar 0. FWIW this behavior is the same as in prior versions of eSignal

          When I run it with intraday interval - the last bar is not processed at all. (no "bar = 0", no red line and no alert sound)
          That is to be expected for the reason I explained in my previous reply.
          Alex


          Originally posted by nissan
          The last bar on the chart is bar number 0.

          When I run the following efs with daily interval, it prints "bar = 0"
          and also paints a red line on the last bar. However - there is no alert sound.

          When I run it with intraday interval - the last bar is not processed at all. (no "bar = 0", no red line and no alert sound)
          function preMain()
          {
          setComputeOnClose();
          setPriceStudy(true);
          }
          function main()
          {
          if( getCurrentBarIndex() > -1 )
          {
          Alert.playSound("phone.wav");
          debugPrintln("bar = " + getCurrentBarIndex() );
          drawLineRelative(0,0, 0, 50000, PS_DOT, 4, Color.red, 0);
          }
          }

          Comment


          • #6
            So - for non- intraday I can avoide "setComputeOnClose". But what can I do for the intraday intervals?

            My main problem is between two market days, when the last intraday bar is not "closed" befor the new trading day starts, so I get the alert only on the begining of the next day.

            Do you have in mind a workaround to this problem?
            (not using "setComputeOnClose" will hurt the performence too much)

            thanks a lot,

            Nissan

            Comment


            • #7
              Nissan
              The only workaround I can think of at this time is to not use setComputeOnClose() and to enclose in a conditional statement that checks for BARSTATE_NEWBAR (see getBarState() in the EFS KnowledgeBase for the description and syntax of this function) OR a specific computer or bar time (see the Date Object in the EFS KnowledgeBase for the description and syntax of the object and its methods) at which time it executes the script
              Alex


              Originally posted by nissan
              So - for non- intraday I can avoide "setComputeOnClose". But what can I do for the intraday intervals?

              My main problem is between two market days, when the last intraday bar is not "closed" befor the new trading day starts, so I get the alert only on the begining of the next day.

              Do you have in mind a workaround to this problem?
              (not using "setComputeOnClose" will hurt the performence too much)

              thanks a lot,

              Nissan

              Comment


              • #8
                Thanks a lot,

                I'll try this option,


                Nissan

                Comment


                • #9
                  Nissan
                  You are most welcome
                  Alex


                  Originally posted by nissan
                  Thanks a lot,

                  I'll try this option,


                  Nissan

                  Comment

                  Working...
                  X