5days
Download scriptThis tool is designed to enhance the visual clarity of your trading charts by automatically labeling the days of the week directly on your price action. It serves as a convenient navigational aid, helping you quickly identify specific trading days as you scroll through historical data.
How It Works
The script scans your chart to identify where one day ends and another begins. When it detects a new day, it places a text label on the chart (such as "Monday," "Tuesday," etc.) at the bottom of the corresponding price bar. This allows for a seamless visual flow, making it much easier to track weekly cycles or specific historical dates without having to constantly check the date in the corner of your screen.
Key Features
- Customizable Visibility: You have full control over which days appear on your chart. If you only want to see certain days of the week while hiding others, you can toggle them on or off individually.
- Personalized Styling: To ensure the labels fit your specific trading setup, the script allows you to customize the font type, the size of the text, and the color for each individual day.
- Adjustable Positioning: The tool includes an offset feature, which gives you the ability to move the text labels slightly above or below the price candles to ensure they don't overlap with your other indicators or price data.
- Smart Timeframe Detection: The logic is optimized to work specifically on intraday timeframes (like 1-hour or 15-minute charts). If you switch to a higher timeframe, such as a Weekly chart, the labels will automatically hide to keep your view clean.
- Historical Lookback: You can define how far back into the past the script should look to place these labels, allowing you to organize several weeks of historical data at once.
Summary for Traders
Essentially, this is an organizational tool. It removes the manual work of identifying dates and replaces it with a clean, color-coded timeline. By providing a clear visual "map" of the trading week, it helps you stay oriented during high-volatility sessions and simplifies your analysis of past market behavior.
#property copyright "© 2006 RickD"
#property link "www.fxstrategy.ca"
#property indicator_chart_window
#property indicator_buffers 0
extern string __1__ = "";
extern int MaxDays = 20;
extern int FontSize = 10;
extern string FontName = "Verdana";
extern int Offset = 30;
extern string __2__ = "";
extern string Text1 = "monday";
extern string Text2 = "tuesday";
extern string Text3 = "wednesday";
extern string Text4 = "thursday";
extern string Text5 = "friday";
extern string __3__ = "";
extern color Color1 = DeepPink;
extern color Color2 = Aquamarine;
extern color Color3 = Yellow;
extern color Color4 = DodgerBlue;
extern color Color5 = Coral;
extern string __4__ = "";
extern bool ShowDay1 = true;
extern bool ShowDay2 = true;
extern bool ShowDay3 = true;
extern bool ShowDay4 = true;
extern bool ShowDay5 = true;
string Text[5];
color Color[5];
bool ShowDay[5];
string prefix = "5days_";
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void init() {
Text[0] = Text1;
Text[1] = Text2;
Text[2] = Text3;
Text[3] = Text4;
Text[4] = Text5;
Color[0] = Color1;
Color[1] = Color2;
Color[2] = Color3;
Color[3] = Color4;
Color[4] = Color5;
ShowDay[0] = ShowDay1;
ShowDay[1] = ShowDay2;
ShowDay[2] = ShowDay3;
ShowDay[3] = ShowDay4;
ShowDay[4] = ShowDay5;
clear();
show();
}
void deinit() {
clear();
}
void start()
{
show();
}
void show() {
int P = Period();
if (P > PERIOD_D1) return;
string name = "";
int cnt = MathMin(Bars, PERIOD_D1/P*MaxDays);
for (int i=0; i < cnt; i++)
{
if (TimeDayOfWeek(Time[i]) != TimeDayOfWeek(Time[i+1]))
{
name = prefix + TimeToStr(Time[i]);
int res = ObjectFind(name);
if (res == -1)
{
int day = TimeDayOfWeek(Time[i]);
if (!ShowDay[day-1]) continue;
ObjectCreate(name, OBJ_TEXT, 0, Time[i], Low[i]-Offset*Point);
ObjectSetText(name, Text[day-1], FontSize, FontName, Color[day-1]);
}
}
}
}
void clear() {
int P = Period();
if (P > PERIOD_D1) return;
string prefix = "5days_";
string name = "";
int cnt = MathMin(Bars, PERIOD_D1/P*MaxDays);
for (int i=0; i < cnt; i++)
{
name = prefix + TimeToStr(Time[i]);
int res = ObjectFind(name);
ObjectDelete(name);
}
}
Comments