Average Daily Range (ADR) - code check
Results 1 to 7 of 7

Thread: Average Daily Range (ADR) - code check

  1. #1
    Hey,

    can someone check the following code for calculating the ADR? It is coded that way it skips sunday bars...

    Quote Originally Posted by ;
    int getADR(string s, int times)

    int adr=0,I=0;
    int tmp_days = times;

    for(I=1;ilt;=tmp_days;I ) TimeDayOfWeek(iTime(s,PERIOD_D1,I)) gt; 5)
    tmp_days ;

    else
    adr = adr (iHigh(s,PERIOD_D1,I)-iLow(s,PERIOD_D1,I)) / MarketInfo(s,MODE_POINT);




    adr = adr/days;

    return (adr);
    thank you, cheers!

  2. #2
    Quote Originally Posted by ;
    hello,

    can someone check the following code for calculating the ADR? It is coded that way it skips sunday pubs...

    thank you, cheers!
    MarketInfo(s,MODE_POINT) will result in 0 and give you a divide-by-zero mistake for all non-JPY currency pairs.

  3. #3
    Quote Originally Posted by ;
    hello,

    can someone check the next code for calculating the ADR? It's coded that way that it skips sunday bars...

    thank you, cheers!
    My version of implementation is that. I needed to use a custom function FindAndReplace() to discover if the symbol has a Yen component. Allow me to know if you need the source code. Should you have to bypass you may switch to some other broker which don't comprise. This is only because your price charts will reveal if your broker supplies. I know several brokers do unlike US-based brokers.

    Http://www..com/shared/ar_code.PNG

    ADR Indior screenshot:



    My evaluation results are consistent with what you see on this site http://www.aboutcurrency.com/univers...cy_pairs.shtml

  4. #4
    I finally found that the ADR indi which excludes the Sunday bar in calculation. When ADR isn't reached I am attempting to bring a tag. . To reveal, in red... Not Reached and once it's attained then reveal in green ADR Reached (only for simplicity here).

    I've made some acute hacks to script and now it shows Not Reached in red... and when it's attained it does reveal in green Reached... But I need the red tag Not reached to disappear and be replaced with the green tag and also vice versa. At this time they remain there and appear one on top of the other. Do I use the ObjectDelete? In deinit or under each tag?

    NOTE to other people: This indi additionally had ATR (that I simply remarked as I think ATR is not applicable in Forex) and it computes ADR correctly. I've confirmed it with Excel. So... it works... it is just not very pretty.

    Thanks for the aid
    https://www.nigeriaforextrading.com/...2133329721.mq4

  5. #5
    1 Attachment(s) pipimo88, try this see if it works for you. If the problem occurs again change time frame to update information. If it works I will post a version that is cleaned up afterwards. It worked on fxdd, did not have time try on various brokers.

    Tom
    https://www.nigeriaforextrading.com/...7-indiors.html

  6. #6
    1 Attachment(s) Attached is your picture precisely what the indi does. After ADR is attained... The first Not attained in red is still there and green attained appears on top of it. Issue I had.

    The improvement is that the switching timeframes will refresh the indi and it'll display correctly... until the next period the reverse label appears.

    I've definitelly seen indis where things could be turned on and off automatically... simply can not get you to take action. Thank you for trying. Any thoughts?

  7. #7
    Hi!

    I know the Average Daily Range is calculated within several days where every day's range (co - lo) is averaged.

    Can someone explain to me what folks mean when they say Weekly ADR or Monthly ADR or even 180day ADR? How is it calculated?

    E.g. Does Weekly ADR = final week ADR of this week's 5 trading days?

    I have seen many people use these terms including people talk about yearly ADR but have so far never seen a rule which defines how it ought to be calculated.

    Any aid is describing would be well appreciated.

    Cheers!

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.