The Great Pumpkin
Page 1 of 6116 12311 ... LastLast
Results 1 to 10 of 151

Thread: The Great Pumpkin

  1. #1
    Quote Originally Posted by ;
    The Bands take exactly the same number of samples (candles/bars) for estimating the expression (moving average) and the standard deviation (rings).
    Yes, that's what I am saying also. But your code enables this identical number to be different.

    Quote Originally Posted by ;
    SMA computes (a b c d e f g)/7, which is fine, and attributes it to price g, which isn't accurate.
    I frankly don't see how attributing the average to any price matters during calculation of standard deviation. The formulation does not involve time or index of the values (in our case, prices).





    I fail to see any attribution.

    As for the confidence interval, to me that says only it's advised to use larger samples, i.e. 200 rather than 20 (using your illuions). But it does not say that we ought to use 20 worth and use 200 values to calculate the SD, beginning from the value of the sample that is smaller. (I can only refer back to some example of using prices of 12-3 vs. the average of 5-0.)

    One of us is really missing some thing here.

  2. #2
    Quote Originally Posted by ;
    quote I frankly do not see how attributing the average to any price things during calculation of standard deviation.
    I agree that it ought to be no difference once the price mean is level with respect to time. Then the lag of the moving average will be equal to zero, so in this case the lag correction is unimportant. However things do change within a fashion.

    The blue line in the plot below is your conventional SMA, the red is shifted back by a half of its span. Can you calculate the standard deviation based on subtracting the information off the second line or the first? Do you believe it's exactly the same in this circumstance?



    Quote Originally Posted by ;
    quote As for the confidence interval, to me that states only that it's advised to use larger samples, i.e. 200 instead of 20 (utilizing your illuions). But it doesn't say that we use 200 values to compute the SD, starting from the value of the sample and ought to use 20 values.
    In principle one portion of the issue could be solved by using Bands with a massive Period. That would enforce one to use the interval moving average, which one might not like to do. Furthermore, there is that lag company that is uncorrected there.

    k

  3. #3
    Quote Originally Posted by ;
    Do you think it is identical in this circumstance?
    Yes.


  4. #4
    Quote Originally Posted by ;
    quote Yes.
    Well, the error of the standard deviation (600 samples) for the non-shifted case is 128% in my case above.
    For the MA shifted by period/2, the error is 2.6 percent.
    The proportion of the two calculated standard deviations for the two instances is 2.29.
    I'd say that is a significant difference.

    https://www.nigeriaforextrading.com/...8591738792.pdf

    Cheers,
    k

  5. #5
    Quote Originally Posted by ;
    quote Well, the error of the standard deviation (600 samples) for its non-shifted instance is 128 percent in my example above. For the MA shifted by period/2, the error is 2.6 percent. The proportion of both calculated standard deviations for both instances is 2.29. I'd say that is a difference that is substantial. image Cheers, k
    Inserted Code ln#91;139#93;: I - span, I
    Are both endings contained? Because that would imply you typical interval 1 points in time (x axis).

    Inserted Code ln#91;147#93;: data2 = (Take#91;y, 401, 1000#93; - SMA)^2;
    SMA = Average of 1-400 = previous data
    401-1000 = potential data

    ???

  6. #6
    Quote Originally Posted by ;
    quote ln[139]: I - period, I Are both ends included? Because that would imply you average period 1 points in time (x axis).
    The array indexing in Mathematica starts with 1. I calculated the 401st element of the MA as a total amount of initial 400 data points, etc.. For instance, 501st is calculated as an average value of 101-500th data component etc..

    Quote Originally Posted by ;
    quote SMA = Typical of 1-400 = past data 401-1000 = potential data ???
    No, these are the data points for which the SMA (400) was calculated therefore the y values are for x=401-1000. In Metatrader this would correspond to a standard moving average.

    The trick here is, once more, to shift the MA by half its time back in time (to x =201-800 in my example), then use it like an average value quote. It's a lot better based then (since the consequences of period/2=400/2=200 is compensated) and approximates the information far better. Therefore the sum of squares of differences between the estimate and the information is a lot smaller. Otherwise, if you don't do this, then the standard deviation is overestimated.

    The sole drawback of the changing back in time is the most recent data points are not taken into account in the calculation of the standard deviation. But because the standard deviation does not change considerably, that is not too important.

    I'm sorry, but I really can't explain it any better. The only thing I could say is: add a linear drift above, compute the simple moving average and use it. Alter it back in time an interval and calculate the worth again. See whether there's a difference.

    Cheers,
    k

  7. #7
    Quote Originally Posted by ;
    quote Try this variant. K file image
    Hey kprsa,
    functions flawlessly!
    Thanks a lot

  8. #8
    Quote Originally Posted by ;
    quote The array indexing in Mathematica starts with 1. I calculated the 401st element of the MA as a total amount of first 400 data points, etc.. For instance, 501st is calculated as a mean value of 101-500th data element etc. quote These are the data points for the SMA (400) was calculated therefore the y values are for x=401-1000. In Metatrader this could correspond to some standard moving average.
    Alright, I believe I got it. So, looking at this line again:

    Inserted Code data2 = (Take#91;y, 401, 1000#93; - SMA)^2;
    Does this make an array of 600 components, with each element being equal to the square of this gap of the Y value and the corresponding SMA value at the same point on the X axis? I.e.

    data2[1] = (Y[401] - SMA[401])^2
    data2[2] = (Y[402] - SMA[402])^2
    ...
    data2[600] = (Y[1000] - SMA[1000])^2

    And this next line:

    Inserted Code sigmanonshifted = Sqrt#91;Sum#91;data2#91;#91;I#93;#93; / 600, I, 600#93;#93;
    Takes the amount of data2[1], data[2] ... data2[600] and divides by 600, then takes the square root of this quotient?

  9. #9
    Quote Originally Posted by ;
    quote Okay, I believe I got it. So, looking on this line again: data2 = (Take[y, 401, 1000] - SMA)^2; Does this create an array of 600 components, with each element being equivalent to the square of the difference of the Y value and the corresponding SMA value in precisely the exact same point in the X axis? I.e. data2[1] = (Y[401] - SMA[401])^2 data2[2] = (Y[402] - SMA[402])^2 ... data2[600] = (Y[1000] - SMA[1000])^2 And then this second line: sigmanonshifted = Sqrt[Sum[data2[] / 600, I, 600]] Takes the amount of data2[1], info[2] ... data2[600] and divides it by 600,...
    yes, all of appropriate. The same stuff with (Take[y, 201,800]-SMA)^2 corresponds to change by 200=period/2.
    Today I wasn't in my hobby pc and did not have mt4. I will generate some histogr so that one can compare the bb, bb with samples for stdev, bb with shift of ma and more samples for stdev. Probably tomorrow morning.

    k

  10. #10
    Quote Originally Posted by ;
    quote yes, all right.
    No, it's not. What I have described here:

    Quote Originally Posted by ;
    data2[1] = (Y[401] - SMA[401])^2
    data2[2] = (Y[402] - SMA[402])^2
    ...
    data2[600] = (Y[1000] - SMA[1000])^2
    is NOT how you calculate standard deviation.


    it is possible to observe that the expression ( #956; ) has no index. So there is just one mean value you work with at every stage.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.