Menu
Brokers
MT4 Forex Brokers
MT5 Forex brokers
PayPal Brokers
Skrill Brokers
Oil Trading Brokers
Gold Trading Brokers
Web Browser Platform
Brokers with CFD Trading
ECN Brokers
Bitcoin FX Brokers
PAMM Forex Brokers
With Cent Accounts
With High Leverage
Cryptocurrency Brokers
Forums
All threads
New threads
New posts
Trending
Search forums
What's new
New threads
New posts
Latest activity
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Reply to thread
Forums
Trading Platforms
MetaTrader Indicators
ATR Levels Indicator Daily to Weekly Opening
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
[QUOTE="SwitchTrader, post: 149122, member: 53748"] Hi All, I have this ATR indicator originally compiled by Bill Jones. What I am trying to do is to get it to open at 00:00 Hours every Sunday which is market open for me. As those in the know will see it's opening daily just now. I have managed to get the ATR changed from Daily to Weekly but as for what to change for the time frame I am stuck. I can change the opening times easily enough. Could someone show me where I should be looking and what I need to change? Would it be possible add an input to get it to open Monthly, Weekly and Daily even? Here's the code I have with the ATR Period already changed. [code=mql4]//+------------------------------------------------------------------+ //| ATR Marks.mq4 | //| Bill Jones | //| Colorado Springs, CO | //+------------------------------------------------------------------+ #property copyright "2014 - Bill Jones" #property indicator_chart_window //---- input int ATRPeriod=20; // ATR Period Parameter //---- double H4,L4,fullatr,shiftnbr; int dayshift,dayshiftold=-5; int NbrDigits; bool ErrFlag=true; // True = print an error datetime OldBar=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { ObjectDelete("ATRHigh Line"); ObjectDelete("ATRLow Line"); ObjectDelete("ATR Label"); ObjectDelete("ATRDay Line"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { if(IndicatorCounted() < 1) return(0); if(Time[0] == OldBar) return(0); OldBar=Time[0]; //---- if(Period()>1440) // Day chart is the largest to display values on. { if(ErrFlag) { ErrFlag=false; Print("Error - Chart period is greater than 1 day."); } return(-1); // then exit } NbrDigits=Digits-1; // Digits must be either 3 or 5. 2 & 4 Digit accounts do not work here. if(NbrDigits>2) shiftnbr=10000; else shiftnbr=100; int BarsPerChart=WindowBarsPerChart()-5; // Don't check all of the bars dayshift=0; while(dayshift<BarsPerChart) { if(TimeToStr(Time[dayshift],TIME_MINUTES)=="00:00") break; // Find the 5pm NY bar. dayshift++; } if(dayshift == dayshiftold) return(0); dayshiftold = dayshift; ObjectDelete("ATRHigh Line"); ObjectDelete("ATRLow Line"); ObjectDelete("ATR Label"); ObjectDelete("ATRDay Line"); fullatr=iATR(Symbol(),PERIOD_W1,ATRPeriod,1); L4 = Close[dayshift] - fullatr; H4 = Close[dayshift] + fullatr; //---- //---- if(ObjectFind("ATRDay Line")!=0) { ObjectCreate("ATRDay Line",OBJ_VLINE,0,Time[dayshift],0); ObjectSet("ATRDay Line",OBJPROP_COLOR,Teal); ObjectSet("ATRDay Line",OBJPROP_WIDTH,1); } //---- if(ObjectFind("ATRHigh Line")!=0) { ObjectCreate("ATRHigh Line",OBJ_TREND,0,Time[dayshift],H4,Time[0],H4); ObjectSet("ATRHigh Line",OBJPROP_COLOR,Teal); ObjectSet("ATRHigh Line",OBJPROP_WIDTH,1); } //---- if(ObjectFind("ATRLow Line")!=0) { ObjectCreate("ATRLow Line",OBJ_TREND,0,Time[dayshift],L4,Time[0],L4); ObjectSet("ATRLow Line",OBJPROP_COLOR,Teal); ObjectSet("ATRLow Line",OBJPROP_WIDTH,1); } //---- if(ObjectFind("ATR Label")!=0) { ObjectCreate("ATR Label",OBJ_TEXT,0,Time[dayshift+5],H4); ObjectSetText("ATR Label","ATR: "+DoubleToStr((fullatr*shiftnbr),0),10,"Verdana",White); } //---- return(0); } //+------------------------------------------------------------------+ [/code] Thanks in advance for your help? [/QUOTE]
Insert quotes…
Verification
Post reply
Top
Bottom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…