i-Monday_Sig_v1
Download scriptThis tool is designed as a visual trading assistant for MetaTrader, specifically crafted to identify potential entry points based on the "Monday System." Rather than using complex moving averages or high-frequency calculations, this script focuses on specific timing and price relationships at the start of thetrading week.
Core Functionality
The primary purpose of this script is to automatically place visual markers (arrows) on your trading chart to highlight potential buy and sell opportunities. It looks for a very specific set of conditions that occur during the early hours of the market week.
How the Logic Works
To determine when to display a signal, the tool monitors three specific criteria:
- The Day: The script specifically watches for Monday trading sessions.
- The Time: It looks for a specific hour defined in the settings (by default, 11:00 AM). It only triggers a signal at the exact start of that hour (minute 00).
- Price Relationship: Once it identifies the correct time on a Monday, it compares the opening price of the previous daily candle to the closing price of the current candle.
Signal Generation
When the time and day conditions are met, the script evaluates the direction of the market:
- Buy Signals: If the previous daily open was higher than the current close, a blue marker is placed below the price.
- Sell Signals: If the previous daily open was lower than the current close, a red marker is placed above the price.
User Experience & Visuals
The script includes an intelligent spacing system to ensure the markers are easy to read. Depending on which timeframe you are viewing (e.g., 1-minute charts vs. 4-hour charts), the tool automatically adjusts how far away from the candle the arrows appear. This prevents the signals from overlapping with the price bars, ensuring a clean and professional appearance on your screen.
Key Customizations
Users can manually adjust the following to tailor the tool to their needs:
- Opening Hour: You can change the specific hour of the day you wish to monitor for signals.
- History Depth: You can choose how many previous bars of data the script should analyze on your chart.
//+------------------------------------------------------------------+
//| i-Monday_Sig.mq4 |
//| Êèì Èãîðü Â. aka KimIV |
//| http://www.kimiv.ru |
//| |
//| 01.12.2005 Ñèãíàëû âõîäîâ è âûõîäîâ ïî ñèñòåìå Ïîíåäåëüíèê. |
//+------------------------------------------------------------------+
#property copyright "Êèì Èãîðü Â. aka KimIV"
#property link "http://www.kimiv.ru"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//------- Âíåøíèå ïàðàìåòðû èíäèêàòîðà -------------------------------
extern int HourOpenPos =11; // Âðåìÿ îòêðûòèÿ ïîêóïêè
extern int NumberOfBars=10000; // Êîëè÷åñòâî áàðîâ îáñ÷¸òà (0-âñå)
//------- Ãëîáàëüíûå ïåðåìåííûå --------------------------------------
int ArrowInterval;
//------- Ïîêëþ÷åíèå âíåøíèõ ìîäóëåé ---------------------------------
//------- Áóôåðû èíäèêàòîðà ------------------------------------------
double SigBuy[];
double SigSell[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init()
{
SetIndexBuffer(0, SigBuy);
SetIndexStyle (0, DRAW_ARROW);
SetIndexArrow (0, 233);
SetIndexEmptyValue(0, EMPTY_VALUE);
SetIndexBuffer(1, SigSell);
SetIndexStyle (1, DRAW_ARROW);
SetIndexArrow (1, 234);
SetIndexEmptyValue(1, EMPTY_VALUE);
ArrowInterval=GetArrowInterval();
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
void start()
{
double ms[2];
int loopbegin, shift;
//----
if (NumberOfBars==0) loopbegin=Bars-1;
else loopbegin=NumberOfBars-1;
for(shift=loopbegin; shift>=0; shift--)
{
ms[0]=EMPTY_VALUE;
ms[1]=EMPTY_VALUE;
GetSignals(shift, ms);
SigBuy[shift]=ms[0];
SigSell[shift]=ms[1];
}
}
//+------------------------------------------------------------------+
//| Âîçâðàùàåò ñèãíàëû |
//+------------------------------------------------------------------+
void GetSignals(int nb, double& ms[])
{
int nsb=iBarShift(NULL, PERIOD_D1, Time[nb]);
double Op1=iOpen (NULL, PERIOD_D1, nsb+1);
double Cl1=iClose(NULL, 0, nb+1);
if (TimeDayOfWeek(Time[nb])==1 && TimeHour(Time[nb])==HourOpenPos && TimeMinute(Time[nb])==0)
{
if (Op1>Cl1) ms[0]=Low[nb]-ArrowInterval*Point;
if (Op1<Cl1) ms[1]=High[nb]+ArrowInterval*Point;
}
}
//+------------------------------------------------------------------+
//| Âîçâðàùàåò èíòåðâàë óñòàíîâêè ñèãíàëüíûõ óêàçàòåëåé |
//+------------------------------------------------------------------+
int GetArrowInterval()
{
int p=Period();
switch(p)
{
case 1: return(5);
case 5: return(7);
case 15: return(10);
case 30: return(15);
case 60: return(20);
case 240: return(30);
case 1440: return(80);
case 10080: return(150);
case 43200: return(250);
}
}
//+------------------------------------------------------------------+
Comments