Re: MT4 Indicator requests and ideas
Posted: Tue Nov 18, 2025 12:10 pm
wow! that sounds good-- I'll keep that in mindBeatlemaniaSA wrote: Mon Nov 17, 2025 8:27 pm Dude,
Maybe learn to use AI to express your ideas? Learn to ask the right questions.
Done by GROK in a couple of seconds. It may not be absolutely perfect, but a great place to start.
Question: Grok, can you make an MT4 indicator that will highlight the open, close, high and low of the 6am GMT candle every day?
Here's a clean and efficient MT4 custom indicator that will automatically highlight the **daily 6:00 AM GMT candle** (which is the first full candle after the typical Forex daily rollover).
This indicator draws:
- A rectangle covering the full High-Low range of the 6 AM GMT candle
- Horizontal lines for Open and Close prices
- Labels showing O, H, L, C values
- Works on any timeframe (even M1) and updates automatically each day
### Indicator Name: Daily_6AM_GMT_Candle_Highlighter.mq4
### How to install:Code: Select all
#property copyright "Grok @ xAI - 2025" #property link "https://x.ai" #property version "1.00" #property strict #property indicator_chart_window // Input parameters input color RectangleColor = clrDarkOrange; // Color of the high-low rectangle input color OpenCloseColor = clrWhite; // Color of Open/Close lines input int RectangleOpacity = 15; // 0-255 (lower = more transparent) input bool ShowLabels = true; // Show O/H/L/C labels input int FontSize = 9; // Global variables datetime lastBarDate = 0; //+------------------------------------------------------------------+ int OnInit() { IndicatorShortName("6 AM GMT Candle Highlighter"); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ void OnDeinit(const int reason) { ObjectsDeleteAll(0, "6AM_"); } //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { datetime currentBarTime = time[rates_total-1]; datetime currentDay = currentBarTime - (currentBarTime % 86400); // Midnight GMT of today // We only need to recalculate once per day if(currentDay == lastBarDate) return(rates_total); lastBarDate = currentDay; // Clean previous objects ObjectsDeleteAll(0, "6AM_"); // Find the 6 AM GMT candle datetime targetTime = currentDay + 6*3600; // 6:00 AM GMT today int shift = iBarShift(NULL, 0, targetTime, true); if(shift == -1) return(rates_total); // Candle not formed yet (e.g., weekend) double o = Open[shift]; double h = High[shift]; double l = Low[shift]; double c = Close[shift]; datetime candleTime = Time[shift]; datetime nextCandleTime = (iTime(NULL,0,shift-1) != 0) ? iTime(NULL,0,shift-1) : TimeCurrent()+PeriodSeconds(); string namePrefix = "6AM_"+TimeToString(candleTime,TIME_DATE); // 1. High-Low Rectangle ObjectCreate(0, namePrefix+"_Rect", OBJ_RECTANGLE, 0, candleTime, h, nextCandleTime, l); ObjectSetInteger(0, namePrefix+"_Rect", OBJPROP_COLOR, RectangleColor); ObjectSetInteger(0, namePrefix+"_Rect", OBJPROP_BACK, true); ObjectSetInteger(0, namePrefix+"_Rect", OBJPROP_STYLE, STYLE_SOLID); ObjectSetInteger(0, namePrefix+"_Rect", OBJPROP_WIDTH, 1); ObjectSetInteger(0, namePrefix+"_Rect", OBJPROP_BACK_FILL, true); ObjectSetInteger(0, namePrefix+"_Rect", OBJPROP_TRANSPARENCY, 255-RectangleOpacity*255/100); // 2. Open Line ObjectCreate(0, namePrefix+"_Open", OBJ_HLINE, 0, 0, o); ObjectSetInteger(0, namePrefix+"_Open", OBJPROP_COLOR, OpenCloseColor); ObjectSetInteger(0, namePrefix+"_Open", OBJPROP_STYLE, STYLE_DOT); ObjectSetInteger(0, namePrefix+"_Open", OBJPROP_WIDTH, 1); // 3. Close Line ObjectCreate(0, namePrefix+"_Close", OBJ_HLINE, 0, 0, c); ObjectSetInteger(0, namePrefix+"_Close", OBJPROP_COLOR, OpenCloseColor); ObjectSetInteger(0, namePrefix+"_Close", OBJPROP_STYLE, STYLE_DOT); ObjectSetInteger(0, namePrefix+"_Close", OBJPROP_WIDTH, 1); // 4. Labels (optional) if(ShowLabels) { string labelText = StringFormat("6AM GMT\nO: %.5f\nH: %.5f\nL: %.5f\nC: %.5f", o,h,l,c); ObjectCreate(0, namePrefix+"_Label", OBJ_TEXT, 0, candleTime + (nextCandleTime-candleTime)/2, h*1.0005); ObjectSetString(0, namePrefix+"_Label", OBJPROP_TEXT, labelText); ObjectSetInteger(0, namePrefix+"_Label", OBJPROP_COLOR, clrYellow); ObjectSetInteger(0, namePrefix+"_Label", OBJPROP_FONTSIZE, FontSize); ObjectSetString(0, namePrefix+"_Label", OBJPROP_FONT, "Arial Bold"); ObjectSetInteger(0, namePrefix+"_Label", OBJPROP_ANCHOR, ANCHOR_TOP); } ChartRedraw(); return(rates_total); }
1. Open MetaEditor (in MT4: Tools → MetaQuotes Language Editor)
2. File → New → Indicator → From template → Next → Name it `Daily_6AM_GMT_Candle_Highlighter`
3. Replace all code with the one above
4. Compile (F7) – no errors should appear
5. Restart MT4 or refresh the Navigator
6. Drag the indicator onto any chart
### Features:
- Works on any symbol and any timeframe
- Automatically finds the correct 6 AM GMT candle every day
- Skips weekends
- Very lightweight (only updates once per day)
- Customizable colors and transparency
thanks for your help