Announcement

Collapse
No announcement yet.

Alert.addToList weird results

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

  • Alert.addToList weird results

    Any help as to why the following would be greatly appreciated.

    This line;

    Alert.addToList("Incorrect use of "+sUse, "Use capitals " + sTheName, Color.green, Color.black );

    works well within my program. Both sUse and sTheName are defined and the alert displays thier values. But if I add:

    debugPrintln("vFlag2="+vFlag);
    if (vFlag == false)
    { Alert.addToList("Incorrect use of "+sUse, "Use capitals " + sTheName, Color.green, Color.black );
    vFlag = true;
    }
    debugPrintln("vFlag3="+vFlag);

    vFlag prints false on the way in, true on the way out, however the alert does not fire.

    The line I want to use is:

    if (vFlag == false &&
    sUse != "ALL" &&
    sUse != "NQ" &&
    sUse != "YM" &&
    sUse != "NONE")
    {
    Alert.addToList("Incorrect use of "+sUse, "Use capitals " + sTheName, Color.green, Color.black );
    vFlag = true;
    }

    is the same as the example above. When all conditions are true, it enters the routine, resets vFlag to true, however does not trigger the alert.

    What am I doing wrong? All comments are appreciated.

    Merv

  • #2
    Would anyone like to have a go at this problem? Anyone know of any quirks which might make Alert misbehave? Really would like to know what I'm doing wrong.

    Cheers

    Comment


    • #3
      Hi merkro,

      Just a thought. Replace your code:
      PHP Code:
      if (vFlag == false &&
      sUse != "ALL" &&
      sUse != "NQ" &&
      sUse != "YM" &&
      sUse != "NONE")
      {
      Alert.addToList("Incorrect use of "+sUse"Use capitals " sTheNameColor.greenColor.black ); 
      vFlag true;

      with
      PHP Code:
      if (vFlag == false &&
      sUse != "ALL" &&
      sUse != "NQ" &&
      sUse != "YM" &&
      sUse != "NONE")
      {
      debugPrintln("1 - Incorrect use of "+sUse);
      debugPrintln("2 - Use capitals " sTheName);
      Alert.addToList("IBM""It Triggered"Color.greenColor.black ); 
      Alert.addToList(getSymbol(), "It Triggered"Color.greenColor.black ); 
      //Alert.addToList("Incorrect use of "+sUse, "Use capitals " + sTheName, Color.green, Color.black ); 
      vFlag true;

      Since it already is changing "vFlag" from false to true (and there are no other conflicting instances of "vFlag' in the code) this should let you know if the two "Alert.addToList" text inputs are correctly processed.

      Wayne
      Last edited by waynecd; 08-24-2010, 01:32 AM.

      Comment


      • #4
        Wayne, thanks for replying, it is appreciated. Unfortunately I get the same result with your suggestion as with the original code. It only seems to be when the alert is embedded within the conditional block of code that it will not fire, as I can move both of your alerts as well as my original alert into the code proper, and they all fire on each tick.

        I wonder if the alert function is treated a little different to other statements? I have an askForInput at the bottom of Premain, and when I load the EFS, it does one run thru the code, printing to the output log, before then actioning the askForInput. This means the vFlag is reset before askForInput is actioned, and if the alert is treated similar, then it would not be triggered the second time due to vFlag being set to true on the initial scan.

        With this in mind, I changed the code to

        if (vFlag < 5 &&
        sUse != "ALL" &&
        sUse != "NQ" &&
        sUse != "YM" &&
        sUse != "NONE")
        {
        debugPrintln("1 - Incorrect use of "+sUse);
        debugPrintln("2 - Use capitals " + sTheName);
        Alert.addToList("ES U0", "It Triggered", Color.green, Color.black );
        Alert.addToList(getSymbol(), "It Triggered", Color.green, Color.black );
        //Alert.addToList("Incorrect use of "+sUse, "Use capitals " + sTheName, Color.green, Color.black );
        vFlag ++;
        }


        and what I got was the output to the Formula Output Window 5 times.

        Have tried the askForInput within the main, as well as removed it altogether, and same result.

        Not sure where to go from here. If someone would insert the code into an efs on thier machine and tell me it works, then I'll accept that the problem is mine, accept that I can't work out the fix, and move on.

        Aternately, if they told me it didn't work at thier end either, then I would accept it's an eSignal problem, and I can't do anything about it, and still move on. Perhaps I should just move on?

        Happy to receive any other suggestions, and appreciate your taking the time to respond. It's always nice to know I'm not entirely alone.

        Cheers.

        Merv

        Comment


        • #5
          merkro,

          As Attached is test code that triggers fine on my side using different conditions from those you posted.

          As I understand it "Alert.addToList()" executes as the current bar is forming (in real time) and not on historical bars. That is why you see 5 prints to the "Formula Output" window and no Alert List posts. If I am wrong about this maybe someone who knows can clear it up.

          Wayne

          Note: if the Alert List window is open and hidden in the background you may not see it as it updates.
          Attached Files
          Last edited by waynecd; 08-24-2010, 04:20 AM.

          Comment


          • #6
            Wayne, thanks for your help, you have solved my problem. Your example worked, and your explanation caused me to add islastbaronchart to my conditions, and it fired right up. Another lesson well learned.

            Again, thank you for your help. Strange how the simple things can be the most fraustrating........

            Cheers

            Merv

            Comment


            • #7
              Glad it worked.

              Wayne

              Comment

              Working...
              X