Announcement

Collapse
No announcement yet.

question about different ways to call MACD Hist

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

  • question about different ways to call MACD Hist

    I am stymied because I am getting different values for MACD Histogram depending on how the efs call is made. I am sorry, I don't knwo enough to understand what these different structures imply. Here is the pertinent code snip:


    study = new MACDStudy(nFastLng, nSlowLng, nSignalSmooth, tSource);
    var vVol = study.getValue(MACDStudy.HIST);

    test = macdHist(nFastLng, nSlowLng, nSignalSmooth, tSource);

    In particular, the script was calling the MACD Hist using <study> and returning <vVol>. Then I tried to replicate the histogram using the script in Custon EFS2 folder, and got something different. So I added the call using <test> . Both <test> and <study> have exact same inputs (defined above in the script) but return different values.

    Why is this? Thanks very much. Joe.

  • #2
    Joe
    In the EFS1 MACD study there are actually two more parameters which are optional and that if not used are set by default to true, false. So if you write the following
    study = new MACDStudy(nFastLng, nSlowLng, nSignalSmooth, tSource);
    it is the same as if you wrote
    study = new MACDStudy(nFastLng, nSlowLng, nSignalSmooth, tSource, true, false);
    The first of those two optional parameters sets the Oscillator to use simple (true) or exponential (false) moving averages. The second instead sets the type of moving average used by the Signal line where true is simple and false is exponential.
    In the EFS2 MACD study instead both the Oscillator and the Signal use only exponential averages.
    If you want to see the same result in the EFS1 study set it to the following
    study = new MACDStudy(nFastLng, nSlowLng, nSignalSmooth, tSource, false, false);
    Alex

    Comment


    • #3
      Thank you very much. That makes sense, but it is a subtle difference. I had taken a look at the EFS Developers Refererence but I didn't see anything there describing those flags.

      Thank you for the prompt reply. Best regards. Joe.

      Comment

      Working...
      X