Announcement

Collapse
No announcement yet.

Formula Problem in the Donchian Color

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

  • Formula Problem in the Donchian Color

    Please, Can someone found out the problem in the below formula?
    Every time I try to open it the eSignal software crashs!



    /************************************************** *******
    Alexis C. Montenegro © July 2003
    Use and/or modify this code freely. If you redistribute it
    please include this and/or any other comment blocks and a
    description of any changes you make.
    ************************************************** ********/

    var vDonch = null;

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Donchian");
    setCursorLabelName("DCUpr", 0);
    setCursorLabelName("DCMid", 1);
    setCursorLabelName("DCLwr", 2);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarFgColor(Color.blue, 2);
    setDefaultBarThickness(1,0);
    setDefaultBarThickness(1,1);
    setDefaultBarThickness(1,2);

    var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
    fp1.setLowerLimit(1);
    fp1.setDefault(20); //Edit this value to set a new default

    var fp2 = new FunctionParameter("Offset", FunctionParameter.NUMBER);
    fp2.setDefault(0); //Edit this value to set a new default

    }

    function main(Length, StdDev, Source) {

    // generate Bollinger study if it doesn't already exist
    if(vDonch == null) vDonch = new DonchianStudy(Length, Source, StdDev);

    // get the current values for upper, basis, and lower bollinger bands
    var vUpper = vDonch.getValue(DonchianStudy.UPPER);
    var vBasis = vDonch.getValue(DonchianStudy.BASIS);
    var vLower = vDonch.getValue(DonchianStudy.LOWER);

    // fill in color between the upper and lower bands
    setBarBgColor(Color.yellow,1,vLower,vUpper);

    // return the values for upper, basis, and lower to be drawn on the chart
    return new Array(vUpper, vBasis, vLower);
    }

  • #2
    Hi Barros,

    Here is your problem, see the error in the debug window when I did a syntax check?

    You should have seen that error on your end as well.



    Regardless, the problem with the code you posted seems at first glance to be with with the space after the forward slash and the first *.

    I did not look any further than this error.

    Comment


    • #3
      Barros,

      As followup, it seems that you do not define the arguments that appear in the main(Length, StdDev, Source) with respective function parameters definitions. As a result, you are trying to run an efs with undefined variables that are essential.

      if you want to see what is occuring, comment all lines out within main, then place debug statements outputting the arguments that are being provided to main (Length, StdDev, Source).

      Comment


      • #4
        Solution

        Hi, Stevehare2003,
        Please, could you make the necessary correction, because I am a bad programmer. Thanks for it.

        Comment


        • #5
          Barros,

          If you want to try to create efs's, you need to learn how. This is what I chose to do starting back in 2003. It has not always been easy, but I have managed.

          If you want to learn how to do this, this forum is an excellent place to help you learn. If you do not feel it is something you want to learn, there are several consultants that you can pay to do this for you.

          Comment


          • #6
            Barros,

            If you are interested in programming Richard Donchian's systems I would recommend (in case you are unaware) that rather then code the strategy yourself (if as you say you are unable to) you refer to the sample btDonchian*.efs studies in JasonK's fileshare and the Backtesting Documents upon which these strategies are based.

            Whether you want to use this strategy as a mechanism for learning or not, the techniques and programming methodologies described in detail and generously provided by JasonK are essential reading to familiarize yourself (and perhaps memorize portions there of, as they are the invaluable "gold" standard for backtesting systems and have saved many of us all countless hours of time and money, IMHO).

            Any specific questions or problems will be addressed promptly by forums users and staff once you begin modifying or developing you own strategies if and when you post in the forum.

            However, time consideration usually preclude members and staff from actually doing the type of custom programming you are asking.

            More importantly, I believe the purpose of the forum is that it's perhaps not in our best long term interest to have others doing our programming, as developing profitable trading systems is a very time intensive, iterative, and perhaps never ending process.



            Glen
            Last edited by demarcog; 12-18-2006, 02:22 PM.
            Glen Demarco
            [email protected]

            Comment


            • #7
              Thanks

              Dear friends Demarcog and Stevehare2003.
              The formula that I am trying to do is only to put a color in the background between the upper and lower bands.
              Thank you for your attention.

              PS:
              Purpose: The purpose of this forum is for eSignal users to request coding assistance and guidance for EFS formula development. The forum moderators and eSignal Community Support Group are dedicated to providing guidance and assistance to the forum users whenever possible. We will help fix coding errors, investigate potential EFS bugs and provide coding suggestions. We would also like to encourage all forum members to participate in assisting other members as well to help promote a positive and helpful community for EFS development.

              Comment

              Working...
              X