Announcement

Collapse
No announcement yet.

Stuck on Coding 2X Stochastic

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

  • #16
    Alex,

    I'm sorry. I was referring to the code of the StochasticK function in the Library which I've attached. The comments about the parameter use and line 53 are regarding that. This is how I was trying to see exactly what was being calculated.

    I took a stab at developing a related function StochasticTSK which substituted hl2 for the close in that line, but it will not execute when called.

    I'll attach that on another post.

    Richard
    Attached Files

    Comment


    • #17
      Here is my StochasticTSK.
      Attached Files

      Comment


      • #18
        Richard
        As is the StochasticK script computes the indicator using only close(), high() and low() as the sources.
        To calculate the highest High and lowest Low it calls two external efs(s) specifically StochasticHH and StochasticLL (both included in the Library folder). However the efsExternal() calls (see lines 39 and 40) are not set up to pass a series to the called efs(s) and those efs(s) are not set up to receive and/or use any other series besides the ones that are pre-programmed in them ie high() in the StochasticHH and low() in the StochasticLL.
        In order to do what you want you need to modify all three efs(s). The simplest method iis to first add the following line inside the calcPercentK function in the StochasticK efs.
        var HL2 = hl2();
        Then in the equation in line 53 replace close(0) with HL2,getValue(0)
        Once you have done that replace high() and low() with hl2() in both the StochasticHH and the StochasticLL scripts.
        Save the scripts with a different name so that they will not be overwritten at the next upgrade.
        If you then want to make the source of the Stochastic a user defined parameter you will need to modify the various scripts to set them up to pass/receive the required series. For detailed examples of how to do this see this thread and this thread.
        Having said this I still am of the opinion that the solution you are trying to implement is unnecessarily complex given that you can obtain the same exact results (and in a considerably more efficient way) using the built-in stochK() function.
        Anyhow at this point I believe you should have all the information necessary to modify the script to your requirements
        Alex

        Comment


        • #19
          Thanks for all of your help.

          Richard

          Comment


          • #20
            Richard
            You are most welcome
            Alex

            Comment

            Working...
            X