SHI_MFzone
Download scriptThis tool is designed to visually highlight a specific "Minimum Funding" (MF) zone on your trading chart. It acts as a visual boundary marker, helping traders identify a critical price range based on predefined levels.
How the Logic Works
1. Defining the Zone The script works by establishing a fixed corridor between two specific price points: a high level and a low level. This creates a "zone" rather than just a single line, allowing you to see exactly where the area of interest lies on your screen.
2. Visual Representation When you apply this tool, it draws three primary elements on your chart:
- The Shaded Area: A colored rectangle that fills the space between your high and low levels. You can choose whether this area appears as a background highlight or a standard foreground shape.
- Boundary Lines: Two distinct horizontal lines mark the exact upper and lower limits of the zone.
- Labels: Small text markers are placed at the boundaries to clearly identify the area as the "MF-zone."
3. Automated Time Filtering The script includes specific logic to ensure it only operates on relevant timeframes. It is programmed to ignore any charts larger than the Daily timeframe. Furthermore, it contains a unique filter that automatically seeks out and anchors the visual zone based on specific days of the week (specifically looking for the transition between the end of the week and the start of the next).
4. Dynamic Positioning Instead of staying static in one place forever, the script is designed to move. As time progresses and new candles form, the tool automatically updates its position on the chart to remain relevant to the most current trading period, ensuring that the "MF-zone" is always visible where you need it most.
5. Clean Up To keep your workspace organized, the script is designed to be tidy; if you remove the indicator from your chart, it automatically deletes all the boxes, lines, and text labels it created, leaving your chart clean.
//+------------------------------------------------------------------+
//| SHI_MFzone.mq4 |
//| Copyright © 2005, Shurka |
//| shforex@narod.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Shurka"
#property link "shforex@narod.ru"
#property indicator_chart_window
//#property indicator_buffers 2
extern double HighLevel=1.21;
extern double LowLevel=1.2;
extern bool Painting=True;
extern bool Fon=True;
extern color BackColor=Wheat; //öâåò çàêðàøèâàíèÿ êàíàëà
extern color LinesColor=DarkGray;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
ObjectCreate("MFChan",OBJ_RECTANGLE,0,Time[1],HighLevel,Time[0],LowLevel);
ObjectSet("MFChan",OBJPROP_COLOR,BackColor);
if(Fon) ObjectSet("MFChan",OBJPROP_BACK,true);
else ObjectSet("MFChan",OBJPROP_BACK,false);
ObjectCreate("MFhiLine",OBJ_TREND,0,Time[1],HighLevel,Time[0]+Period()*60*7,HighLevel);
ObjectCreate("MFloLine",OBJ_TREND,0,Time[1],LowLevel,Time[0]+Period()*60*7,LowLevel);
ObjectSet("MFhiLine",OBJPROP_RAY,False);
ObjectSet("MFloLine",OBJPROP_RAY,False);
ObjectSet("MFhiLine",OBJPROP_COLOR,LinesColor);
ObjectSet("MFloLine",OBJPROP_COLOR,LinesColor);
ObjectCreate("MFtext",OBJ_TEXT,0,Time[0]+Period()*60*7,HighLevel);
ObjectSetText("MFtext", "MF-zone", 8, "Arial", Blue);
ObjectCreate("MFtextL",OBJ_TEXT,0,Time[0]+Period()*60*7,LowLevel+Point*6);
ObjectSetText("MFtextL", "MF-zone", 8, "Arial", Blue);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("MFChan"); ObjectDelete("MFbar"); ObjectDelete("MFhiLine");
ObjectDelete("MFloLine"); ObjectDelete("MFtext"); ObjectDelete("MFtextL");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if (Period()>PERIOD_D1) return;
for(int i=0;TimeDayOfWeek(Time[i])!=1 || TimeDayOfWeek(Time[i+1])!=5;i++) continue;
ObjectSet("MFhiLine",OBJPROP_TIME1,Time[i]);
ObjectSet("MFloLine",OBJPROP_TIME1,Time[i]);
if(Painting==True) ObjectSet("MFChan",OBJPROP_TIME1,Time[i]);
else ObjectDelete("MFChan");
return(0);
}
//+------------------------------------------------------------------+
Comments