trying to code a formula into

Forums ProRealTime English forum ProBuilder support trying to code a formula into

Viewing 9 posts - 1 through 9 (of 9 total)
  • #247736

    Hello i’ve been trying to code a formula into the one that I’ve already got in the one I’ve used for this range indicator is based off the London opening closed ranges it looked back at 10 of them and then gives me an average I want to change the former a bit so I so I get a different reading slightly I don’t know how to do that it seems a bit more complicated for me

    I’ve also added a picture in that picture I’ve used rulers and I’ve colored them and I’ve worked out the formula by hand and then draw on the boxes to their measurements then measurements ain’t the same as the formula that’s working in the program you can see the lines behind the boxes they’re slightly there are off the boxes lines are the results I am looking for

    1. Overall Average Formula
    [ \text{Overall Average} = \frac{\sum \text{All Values}}{\text{Total Number of Values}} ]
    For example, if you have 10 numbers:
    [ \text{Average} = \frac{x_1 + x_2 + … + x_{10}}{10} ]
    2. Sorting the Data
    Before calculating high and low averages, I sort the data in ascending order.
    3. Splitting into Two Halves
    – Low Half: The first half of the sorted values.
    – High Half: The second half of the sorted values.
    4. Low Average Formula
    [ \text{Low Average} = \frac{\sum \text{Lower Half Values}}{\text{Number of Values in Lower Half}} ]
    5. High Average Formula
    [ \text{High Average} = \frac{\sum \text{Upper Half Values}}{\text{Number of Values in Upper Half}} ]

     

    #247739

     

    Step 1: Overall Average
    [ \frac{253.4 + 181.2 + 360.8 + 123.6 + 304.3 + 290.7 + 503.7 + 91.8 + 211.6 + 157.2}{10} ]
    Summing the values:
    [ 253.4 + 181.2 + 360.8 + 123.6 + 304.3 + 290.7 + 503.7 + 91.8 + 211.6 + 157.2 = 2478.3 ]
    Dividing by 10:
    [ 2478.3 \div 10 = 247.83 ]
    So, the overall average is 247.83.
    Step 2: Sorting the Numbers
    Sorted list: 91.8, 123.6, 157.2, 181.2, 211.6, 253.4, 290.7, 304.3, 360.8, 503.7
    Step 3: Low Average (Bottom Half)
    Numbers: 91.8, 123.6, 157.2, 181.2, 211.6
    [ \frac{91.8 + 123.6 + 157.2 + 181.2 + 211.6}{5} ]
    Summing:
    [ 91.8 + 123.6 + 157.2 + 181.2 + 211.6 = 765.4 ]
    Dividing:
    [ 765.4 \div 5 = 153.08 ]
    So, the low average is 153.08.
    Step 4: High Average (Top Half)
    Numbers: 253.4, 290.7, 304.3, 360.8, 503.7
    [ \frac{253.4 + 290.7 + 304.3 + 360.8 + 503.7}{5} ]
    Summing:
    [ 253.4 + 290.7 + 304.3 + 360.8 + 503.7 = 1713.9 ]
    Dividing:
    [ 1713.9 \div 5 = 342.78 ]
    So, the high average is 342.78.

    Final Results:
    – Overall Average: 247.83
    – Low Average: 153.08
    – High Average: 342.78

    #247745

    Try this one.

    I removed empty lines and comments just to make more lines visible in the editor.

    I addes some ONCEs at the beginning, used MAX and MIN in place of some IF..ENDIFs, then made sure indexes within brackets are never lower than 1.

     

    #247761

    Hello i’m sorry to tell you that code didn’t work it did print the three ranges but they all have the same number and the number is 195.7 I also looked at the Look Back of 10 ranges and manually did the equation and I didn’t get anywhere near that number and I also shifted the 10 ranges back one more just a double check has the way that I did the equations and the output of those equations

    They also is a screenshot if you look at the bottom right that’s this code that you’ve helped me with top right is my previous code we’ve standard deviations not this more complex but better equation

    360.8 123.6 304.3 290.7 503.7 91.8 211.6 157.2 528.9 195.7

    Overall Average
    \frac{360.8 + 123.6 + 304.3 + 290.7 + 503.7 + 91.8 + 211.6 + 157.2 + 528.9 + 195.7}{10} ]
    Summing the values: [ 360.8 + 123.6 + 304.3 + 290.7 + 503.7 + 91.8 + 211.6 + 157.2 + 528.9 + 195.7 = 2768.3 ]
    Dividing by 10: [ 2768.3 \div 10 = 276.83 ]
    So, overall average = 276.83.

    – Overall Average: 276.83
    – Low Average: 155.98
    – High Average: 397.68

    Low Average
    Numbers: 91.8, 123.6, 157.2, 195.7, 211.6 [ \frac{91.8 + 123.6 + 157.2 + 195.7 + 211.6}{5} ]
    Summing: [ 91.8 + 123.6 + 157.2 + 195.7 + 211.6 = 779.9 ]
    Dividing by 5: [ 779.9 \div 5 = 155.98 ]

    High Average
    Numbers: 290.7, 304.3, 360.8, 503.7, 528.9 [ \frac{290.7 + 304.3 + 360.8 + 503.7 + 528.9}{5} ]
    Summing: [ 290.7 + 304.3 + 360.8 + 503.7 + 528.9 = 1988.4 ]
    Dividing by 5: [ 1988.4 \div 5 = 397.68 ]

    Sorting the Numbers
    Sorted list: 91.8, 123.6, 157.2, 181.2, 211.6, 290.7, 304.3, 360.8, 503.7, 528.9

    Low Average

    Numbers: 91.8, 123.6, 157.2, 181.2, 211.6 [ \frac{91.8 + 123.6 + 157.2 + 181.2 + 211.6}{5} ]

    Summing: [ 91.8 + 123.6 + 157.2 + 181.2 + 211.6 = 765.4 ]

    Dividing by 5: [ 765.4 \div 5 = 153.08 ]

    So, low average = 153.08.

     

    High Average 

    Numbers: 290.7, 304.3, 360.8, 503.7, 528.9 [ \frac{290.7 + 304.3 + 360.8 + 503.7 + 528.9}{5} ]

    Summing: [ 290.7 + 304.3 + 360.8 + 503.7 + 528.9 = 1988.4 ]

    Dividing by 5: [ 1988.4 \div 5 = 397.68 ]

    So, high average = 397.68.

    #247764

    calculate the overall average of the last 10 London session ranges, which you’ve already set up. Now, we take it a step further with a refined statistical approach:

    1️⃣ Identify the 5 highest values in the dataset of 10.
    2️⃣ Calculate the average of these 5 highest values.
    3️⃣ Identify the 5 lowest values in the dataset.
    4️⃣ Calculate the average of these 5 lowest values.

    This gives you a high average and low average, which is a more nuanced measure than standard deviation. It’s brilliant because it filters extreme variations without being overly sensitive to outliers.

    Collects the last 10 London ranges
    Sorts the dataset to easily extract the highest and lowest values
    Selects the 5 highest and 5 lowest values
    Computes their respective averages

     

    #247772

    Please check this code for the correct ranges:

    I also removed all the unused variables and arrays.

     

    1 user thanked author for this post.
    #247773
    JS

    When using an average, it does not necessarily mean that the average is also the middle value (the median)…

    The number of values above or below the average does not have to be equal…

    The code below first calculates the average, then determines how many values are above or below that average…

    Based on this, the “HighAvg” and “LowAvg” are calculated…

     

    1 user thanked author for this post.
    #247805

    By the looks of it on the studies it’s taking the lowest Range and marking that up as the low and then it’s taking the highest range of marking that up as the high not taking the 10 ranges and split in the top five and then average in them and then obviously taking the bottom five and then finding the average out then out of them, don’t know if PRT is capable of doing that a gentleman has also responded with a slightly different way of doing it not too sure how to implement that into the code logic that’s where I struggle that might show some nice results   ,,check file,,

    #247844

    HELLO  would you have a look again pleas

     

Viewing 9 posts - 1 through 9 (of 9 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login