Announcement

Collapse
No announcement yet.

Problem with duplicate orders using Esignal Paper Trader

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

  • Problem with duplicate orders using Esignal Paper Trader

    I wanted to familiarize myself with the different order types and other Generic Broker Functions prior to modifying my current strategies and am using this very rudimentary EFS to experiment with some different order types.

    I noticed that although I'm only seeing one buy or sell function in the Formula Output Window, I'm seeing 4 or 5 orders and executions in the Esignal Paper Trader broker window. I was using a 5 minute chart of OIH.

    If anyone can take a look at the order generating EFS I would appreciate it (see attached).
    Attached Files
    Last edited by demarcog; 10-24-2006, 08:36 PM.
    Glen Demarco
    [email protected]

  • #2
    After working on this most of the day today I think I may know what the error was:

    PHP Code:

    var StrategyIsLong false;

    if (
    StrategyIsLong) {

    .....do 
    sell ...


    Will the if(StrategyIsLong) evaluate to true because it is a non zero value?

    When I changed it to if (StrategyIsLong == true ) it seemed to fix the problem.


    I'm a little unclear on this in the corejavascript doc I saw an example that: if("true" == true) evaluates to false?


    I've also noticed in the IB.efs there is code that checks for enable || "enable" indicating also that they are not the same?
    Last edited by demarcog; 10-25-2006, 07:00 PM.
    Glen Demarco
    [email protected]

    Comment


    • #3
      Hello demarcog,

      A condition such as, if (StrategyIsLong), will only evaluate to false if it contains a number of 0, a Boolean value of false or is set to null. The Boolean false is also the same as the number 0. Likewise, the Boolean true is the same as the number 1.

      if (true == 1) would evaluate to true.

      if (false == 0) would evaluate to true.

      If your StrategyIsLong variable contains anything other than null, 0 or a Boolean false, the condition will evaluate to true.

      var myVar = "asdf";

      if (myVar) // this is true

      This type of condition basically ask if the variable contains a value that is not null, false or 0.

      if ("true" == true) // this is false

      A string containing the characters "true" is not the same as a Boolean true value.

      In general, for any of your formula development efforts, you can avoid any confusion revolving around your conditionals by always using comparison operators in those expressions.

      The line of code you're referring to in IB.efs, if (vEnable == "false" || vEnable == false), was part of a work-around for a bug we used to have that was associated with the .BOOLEAN function parameter type, which was fixed. It's not needed anymore so you can just check for a Boolean false value and not a "false" string. Be sure to also remove the +"" from the Enable+"" line and change any conditions that look at the bTrade variable to look for the Boolean true/false values instead of "true"/"false" strings.
      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


      • #4
        Originally posted by JasonK
        Hello demarcog,

        A condition such as, if (StrategyIsLong), will only evaluate to false if it contains a number of 0, a Boolean value of false or is set to null. The Boolean false is also the same as the number 0. Likewise, the Boolean true is the same as the number 1.

        if (true == 1) would evaluate to true.

        if (false == 0) would evaluate to true.

        If your StrategyIsLong variable contains anything other than null, 0 or a Boolean false, the condition will evaluate to true.

        var myVar = "asdf";

        if (myVar) // this is true

        This type of condition basically ask if the variable contains a value that is not null, false or 0.

        if ("true" == true) // this is false

        A string containing the characters "true" is not the same as a Boolean true value.

        In general, for any of your formula development efforts, you can avoid any confusion revolving around your conditionals by always using comparison operators in those expressions.

        The line of code you're referring to in IB.efs, if (vEnable == "false" || vEnable == false), was part of a work-around for a bug we used to have that was associated with the .BOOLEAN function parameter type, which was fixed. It's not needed anymore so you can just check for a Boolean false value and not a "false" string. Be sure to also remove the +"" from the Enable+"" line and change any conditions that look at the bTrade variable to look for the Boolean true/false values instead of "true"/"false" strings.
        Thanks for that information.........I mistakenly thought that initializing a variable with true or false typed it as a .BOOLEAN, wow was I mistaken.

        Thought "true" was same a true as I've seen both used so often in code that they were both .BOOLEAN.

        I incorporated the IB.efs into my strategies as you suggested in an earlier post. Thanks for the suggestion, it's a very convenient feature having those buttons. I also made all the changes you listed.


        For some reason the buttons disappear occasionally and I have to reload manually for them to reappear....probably has to do with my strategy which does some unusual reloads for reasons I won't go into ( the R word....)


        Thank you very much for the help it is greatly appreciated.

        glen
        Glen Demarco
        [email protected]

        Comment


        • #5
          You're most welcome.
          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

          Working...
          X