Announcement

Collapse
No announcement yet.

Error in code

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

  • Error in code

    I am using the built-in CCIStudy() and BBands. sometimes when im back testing, it does not give me any value for the indicator for a certain BAR i do get the Price information. Like lets say i was lookin at a 10 min chart, at 11:30 there is price information but it says none for CCI BB-basis: None BB-Upper: None and BB-Lower: None. and then at the next bar it comes out to be fine? what could be the error?

  • #2
    Hello subhiii,

    The problem is most likely related to your formula code. It's difficult to say what the exact problem is without seeing your code. Please post your complete formula as an attachment and I'll take a look.
    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
      Attached is the code...

      thanks..
      Attached Files

      Comment


      • #4
        Hello subhiii,

        The problem is with the following line of code in your cIdent() function.

        Strategy.doSell("Exit Long", Strategy.STOP, Strategy.THISBAR);

        You are specifying a .STOP order type without passing the stop price to the function.

        Strategy.doSell(Description, Fill Type, Fill Bar, LotSize, StopOrLimit)

        Try something like below and it will solve the problem. Or change the order type.

        Strategy.doSell("Exit Long", Strategy.STOP, Strategy.THISBAR, Strategy.getDefaultLotSize(), close());

        close() may not be the stop price you want to use, so if you have a stop price variable you're using, you can pass that instead.
        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


        • #5
          thanks a lot Jason

          Comment


          • #6
            I just looked thru the EFS Help Documentation and was wondering if it is possible to use Strategy.SetStop() for STOPs instead of the checkin low(), high() of each bar? does that work fine? Secondly, if you recommend using .SetStop that means i can use it for trailing stops as well? what do u say? pls recommend.

            Thank you.

            Comment


            • #7
              Hello subhiii,

              Yes, you can use Strategy.setStop() to exit trades in back testing. You can also use it to create a trailing stop. You will need to call Strategy.clearStop() followed by Strategy.setStop() with the new stop price on each bar.
              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


              • #8
                Do u have a sample CODE for trailing Stop by any chance... I am really struggling with Trailing orders.. It will be really helpful if you can get me that code.

                Thank you,

                Comment

                Working...
                X