Announcement

Collapse
No announcement yet.

Setting a flag to indicate being long or short

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

  • Setting a flag to indicate being long or short

    My EFS program indicates when to enter a market. I need to set a flag when that happens, so the program knows that the next test is to exit the market, not enter it.

    I can't find a manual or instruction book for EFS on the eSignal site, there surely must be one.

  • #2
    JohnMBradford
    All the information available on EFS can be found in the EFS KnowledgeBase
    Alex

    Comment


    • #3
      Thank you Alex, I'm sure it is, I just don't know how to begin to find it!

      John

      Comment


      • #4
        John
        Click on the link I provided in my prior reply and it will take you to the eSignal KnowledgeBase. Once there click on the EFS KnowledgeBase link in the left pane.
        I can't give you any specific guidance beyond this as it is not apparent from your message how familiar you are with programming in general and with EFS/JavaScript in particular.
        If you can provide further details as to what you are trying to accomplish someone may be able to assist you
        Alex

        Comment


        • #5
          Alex, thank you, I did that, but I couldn't get it to produce anything that was relevant. Even if it had, I doubt that I'd have understood the answer.
          I've done lots of programming over many years, off and on, so I know what I want to do, but I know nothing about EFS or Javascript. Presumably there's a manual somewhere within the eSignal website? If there is, I can't find it.
          What I want to do - I've created an alert to tell me when to enter a market, let's say short in Dec gold. I did that with the EFS formula wizard. And it's said go short in gold because it's tested that the flag is set to zero, ie, no current open position. I can't set up the test successfully.
          I'm sure it's dead easy, and I've tried several possibilities from within the EFS editor, but I just get error messages when I add something like 'flag = 0' as an additional 'if' expression in function main, eg
          if (
          close() < vEMA15_of_Low.getValue(MAStudy.MA) &&
          close(-1) >= vEMA15_of_Low.getValue(MAStudy.MA, -1) &&
          vEMA15.getValue(MAStudy.MA) < vEMA15.getValue(MAStudy.MA, -1) &&
          flag = 0
          ) onAction1()

          Regards, John

          Comment


          • #6
            John
            If you have not already done so declare flag as a global variable (ie outside of function main()) and set it to an intial value of 0.
            Then in function onAction1() set flag to (for example) -1 when the condition that triggers that function returns true. At that point in the conditions to exit the short you check for flag to be equal to -1 and if true you reset flag to 0 in the corresponding function onAction().
            You may find some useful information on this subject in the Guide to Developing eSignal Strategies
            Alex

            Comment


            • #7
              Thank you, you've clearly understood what I want to do. I know I need to do all that, my whole point is that I just don't know how to. For example, you say "check for flag to be equal to......". Well, haven't I done just that in the coding on my previous post, where I've said 'flag = 0'? That produces an error message when I do a syntax check.

              Why is the coding I highlighted in bold wrong, and what should it be?

              Comment


              • #8
                John
                The correct syntax should be && flag == 0)
                Alex

                Comment


                • #9
                  Thank you, it worked.

                  Where do I find that sort of information, please?

                  Comment


                  • #10
                    John
                    Search for operators in the EFS KnowledgeBase (see the link I provided earlier in this thread).
                    I would also suggest going through the EFS2 Function Reference available at the same link
                    Alex

                    Comment


                    • #11
                      OK, thank you. This is like pulling teeth.

                      I've looked at that, but it's all pretty baffling, why do eSignal insist that I re-invent the wheel, when presumably everyone can easily do what I want to do. Why can't someone just give me the code I need?

                      I haven't got time to learn Java within my month's free trial - I've got several other questions piling up behind this one. (for example, why do I only get an alert when the chart is on the screen, ie exactly when I don't need an alert)

                      Comment


                      • #12
                        It works! Thank you, I take back my previous exasperated comments.

                        Comment

                        Working...
                        X