DDFX 4 SDX-TzPivots v3
Download scriptThis script is designed to serve as a comprehensive visual navigation tool for traders using the MetaTrader platform. It automatically calculates and plots various technical analysis levels—specifically Pivot Points, Fibonacci levels, and session markers—directly onto your trading chart to help identify potential support and resistance zones.
Core Functionality
Dynamic Pivot Point Calculations The primary logic of the script revolves around identifying "Pivots." Depending on your settings, it can calculate these in two different ways:
- Standard Fibonacci Pivots: It uses a specific mathematical formula incorporating high, low, and closing prices to project resistance (R1-R5) and support (S1-S5) levels.
- Advanced Multi-Level Pivots: When the Fibonacci mode is active, it provides an expanded range of levels (including R4, R5, S4, and S5) based on specific Fibonacci ratios.
Intermediate and Mid-Point Levels To provide a more granular view of the market's structure, the script calculates "Mid-Pivots" (MR1–MR5 and MS1–MS5). These are essentially the halfway points between the major pivot levels, helping traders identify smaller "mini-zones" where price might stall or reverse.
Session and Historical Markers Beyond daily pivots, the script includes several toggleable visual aids to help contextualize current price action:
- Yesterday’s Range: It can plot the high and low prices from the previous trading day.
- Today’s Opening Price: A dedicated line marks exactly where the current day's session began.
- Camarilla Pivots: The script includes a toggle for Camarilla rotation levels, which are often used by day traders to identify specific breakout points.
- Period Separators: It automatically draws vertical lines and labels (such as "Yesterday" and "Today") to clearly distinguish between different trading sessions on the chart.
Visual and User Experience Features
- Customizable Aesthetics: Users can modify the colors, line styles, and thicknesses for every single level (Pivot, Fibonacci, Camarilla, etc.) to ensure the chart remains clean and readable based on personal preference.
- Automatic Labeling: The script places clear text labels on the chart so you can instantly identify which line is which without needing to hover over them.
- On-Screen Dashboard: If enabled, the script provides a "Comment" box in the corner of the screen. This displays real-time statistics including the pip range for both yesterday and today, as well as the exact high and low prices reached in both periods.
- Smart Memory Management: The script is designed to clean up after itself; when removed from a chart, it automatically deletes the lines and labels it created, ensuring your platform remains uncluttered.
Summary of Usage
This tool is built for traders who rely on "Level Trading." By automating the heavy math required to calculate complex pivot structures and Fibonacci ratios, it allows you to focus on price action while the script handles the constant recalculation of support and resistance zones as new data arrives.
/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
Website: http://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright "Copyright Shimodax"
#property link "http://www.strategybuilderfx.com"
#property indicator_chart_window
extern int Local__HrsServerTzFromGMT = 0;
extern int Destination__HrsNewTZfromGMT = 0;
extern int Show_1Daily_2FibonacciPivots = 2;
extern bool FullScreenLinesMarginPrices = FALSE;
extern int MoveLabels_LR_DecrIncr = 0;
extern color R5_Color = Red;
extern int R5_LineStyle_01234 = 2;
extern int R5_SolidLineThickness = 1;
extern color R4_Color = Red;
extern int R4_LineStyle_01234 = 2;
extern int R4_SolidLineThickness = 1;
extern color R3_Color = Red;
extern int R3_LineStyle_01234 = 2;
extern int R3_SolidLineThickness = 1;
extern color R2_Color = Crimson;
extern int R2_LineStyle_01234 = 2;
extern int R2_SolidLineThickness = 1;
extern color R1_Color = FireBrick;
extern int R1_LineStyle_01234 = 2;
extern int R1_SolidLineThickness = 1;
extern color CentralPivotColor = MediumBlue;
extern int CentralPivotLineStyle_01234 = 0;
extern int CentralPivotSolidLineThickness = 1;
extern color S1_Color = DarkGreen;
extern int S1_LineStyle_01234 = 2;
extern int S1_SolidLineThickness = 1;
extern color S2_Color = Green;
extern int S2_LineStyle_01234 = 2;
extern int S2_SolidLineThickness = 1;
extern color S3_Color = ForestGreen;
extern int S3_LineStyle_01234 = 2;
extern int S3_SolidLineThickness = 1;
extern color S4_Color = ForestGreen;
extern int S4_LineStyle_01234 = 2;
extern int S4_SolidLineThickness = 1;
extern color S5_Color = ForestGreen;
extern int S5_LineStyle_01234 = 2;
extern int S5_SolidLineThickness = 1;
extern color MidPivotsColor = Gray;
extern int MidPivotsLineStyle_01234 = 2;
extern int MidPivotsLineThickness = 1;
extern bool ShowMidPivots = TRUE;
extern color YesterdayHighLowColor = DarkOrange;
extern int HighLowLineStyle_01234 = 4;
extern int HighLowSolidLineThickness = 1;
extern bool ShowYesterdayHighLow = FALSE;
extern color TodayOpenColor = DodgerBlue;
extern int TodayOpenLineStyle_01234 = 4;
extern int TodayOpenSolidLineThickness = 1;
extern bool ShowTodayOpen = FALSE;
extern color CamarillaColor = Fuchsia;
extern int CamarillaLineStyle_01234 = 4;
extern int CamarillaSolidLineThickness = 1;
extern bool ShowCamarilla = FALSE;
extern color PeriodSeparatorLinesColor = Yellow;
extern int SeparatorLinesStyle_01234 = 0;
extern int SeparatorLinesThickness = 1;
extern bool ShowPeriodSeparatorLines = TRUE;
extern color PeriodSeparatorsLabelsColor = Red;
extern int PlaceAt_TopBot_12_OfChart = 2;
extern int SeparatorLabelFontSize = 9;
extern string SeparatorLabelFontStyle = "Arial Bold";
extern bool ShowPeriodSeparatorLabels = TRUE;
extern color PivotLinesLabelColor = Gray;
extern int LineLabelsFontSize = 9;
extern string LineLabelsFontStyle = "Arial";
extern bool LineLabelsIncludePrice = FALSE;
extern int AutoLabelerSensorAdjust = 0;
extern bool ShowComment = FALSE;
extern bool ShowTestComment = FALSE;
int gi_364;
int gi_368 = 0;
int gi_372;
int g_datetime_376 = 0;
int g_timeframe_380 = 0;
int init() {
deinit();
if (Ask > 10.0) gi_372 = 2;
else gi_372 = 4;
Print("Period= ", Period());
return (0);
}
int deinit() {
string l_name_16;
int l_objs_total_0 = ObjectsTotal();
for (int l_objs_total_12 = l_objs_total_0; l_objs_total_12 >= 0; l_objs_total_12--) {
l_name_16 = ObjectName(l_objs_total_12);
if (StringSubstr(l_name_16, 0, 7) == "[PIVOT]") ObjectDelete(l_name_16);
}
string l_var_name_4 = Symbol() + "p";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "r1";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "r2";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "r3";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "r4";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "r5";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "s1";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "s2";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "s3";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "s4";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "s5";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "mr5";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "mr4";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "mr3";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "mr2";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "mr1";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "ms1";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "ms2";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "ms3";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "ms4";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "ms5";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "yh";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "yl";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "to";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "cr1";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "cr2";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "cs1";
GlobalVariableDel(l_var_name_4);
l_var_name_4 = Symbol() + "cs2";
Comment(" ");
return (0);
}
int start() {
double ld_108;
double ld_116;
double ld_124;
double ld_132;
double ld_140;
double ld_148;
double ld_180;
double ld_188;
double ld_196;
double ld_204;
double ld_212;
double ld_220;
double ld_228;
double ld_236;
double ld_244;
double ld_252;
double ld_260;
double ld_268;
double ld_276;
double ld_284;
string ls_292;
gi_364 = MoveLabels_LR_DecrIncr + 60;
datetime l_time_0 = 0;
datetime lt_unused_4 = 0;
int li_8 = 0;
int li_12 = 0;
double ld_16 = 0;
double ld_24 = 0;
double l_open_32 = 0;
double ld_40 = 0;
double l_open_48 = 0;
double ld_56 = 0;
double l_close_64 = 0;
int li_72 = 0;
int li_76 = 0;
int li_80 = 0;
g_timeframe_380 = Period();
g_datetime_376 = TimeCurrent();
if (Period() > PERIOD_D1) {
Alert("Error - Chart period is greater than 1 day.");
return (-1);
}
ComputeDayIndices(Local__HrsServerTzFromGMT, Destination__HrsNewTZfromGMT, li_72, li_76, li_80);
l_time_0 = Time[li_72];
string l_var_name_84 = Symbol() + "st";
double l_time_92 = l_time_0;
GlobalVariableSet(l_var_name_84, l_time_92);
lt_unused_4 = Time[li_76];
ld_40 = -99999;
ld_56 = 99999;
for (int li_100 = li_76; li_100 >= li_80; li_100--) {
if (l_open_48 == 0.0) l_open_48 = Open[li_100];
ld_40 = MathMax(High[li_100], ld_40);
ld_56 = MathMin(Low[li_100], ld_56);
l_close_64 = Close[li_100];
}
l_open_32 = Open[li_72];
ld_16 = -99999;
ld_24 = 99999;
for (int li_104 = li_72; li_104 >= 0; li_104--) {
ld_16 = MathMax(ld_16, High[li_104]);
ld_24 = MathMin(ld_24, Low[li_104]);
}
if (ShowPeriodSeparatorLines == TRUE) {
if (SeparatorLinesStyle_01234 > STYLE_SOLID) SeparatorLinesThickness = 1;
ld_108 = WindowPriceMax();
ld_116 = WindowPriceMin();
ld_124 = ld_108 - ld_116;
ld_132 = ld_124 / 5000.0;
ld_140 = ld_124 / (300 / SeparatorLabelFontSize);
ld_148 = ld_108 - ld_132;
if (PlaceAt_TopBot_12_OfChart == 2) ld_148 = ld_116 + ld_140;
SetTimeLine("YesterdayStart", "Yesterday", li_76 + 0, PeriodSeparatorsLabelsColor, ld_148);
SetTimeLine("YesterdayEnd", "Today", li_72 + 0, PeriodSeparatorsLabelsColor, ld_148);
}
double ld_172 = ld_16 - ld_24;
double ld_164 = ld_40 - ld_56;
double ld_156 = (ld_40 + ld_56 + l_close_64) / 3.0;
if (Show_1Daily_2FibonacciPivots == 1) {
ld_180 = 2.0 * ld_156 - ld_56;
ld_188 = ld_156 + (ld_40 - ld_56);
ld_196 = 2.0 * ld_156 + (ld_40 - 2.0 * ld_56);
ld_220 = 2.0 * ld_156 - ld_40;
ld_228 = ld_156 - (ld_40 - ld_56);
ld_236 = 2.0 * ld_156 - (2.0 * ld_40 - ld_56);
}
if (Show_1Daily_2FibonacciPivots == 2) {
ld_180 = ld_156 + ld_164 / 2.0;
ld_188 = ld_156 + 0.618 * ld_164;
ld_196 = ld_156 + ld_164;
ld_204 = ld_156 + 1.618 * ld_164;
ld_212 = ld_156 + 2.618 * ld_164;
ld_228 = ld_156 - 0.618 * ld_164;
ld_220 = ld_156 - ld_164 / 2.0;
ld_236 = ld_156 - ld_164;
ld_244 = ld_156 - 1.618 * ld_164;
ld_252 = ld_156 - 2.618 * ld_164;
}
ld_156 = NormalizeDouble(ld_156, gi_372);
l_var_name_84 = Symbol() + "p";
l_time_92 = ld_156;
GlobalVariableSet(l_var_name_84, l_time_92);
ld_180 = NormalizeDouble(ld_180, gi_372);
l_var_name_84 = Symbol() + "r1";
l_time_92 = ld_180;
GlobalVariableSet(l_var_name_84, l_time_92);
ld_188 = NormalizeDouble(ld_188, gi_372);
l_var_name_84 = Symbol() + "r2";
l_time_92 = ld_188;
GlobalVariableSet(l_var_name_84, l_time_92);
ld_196 = NormalizeDouble(ld_196, gi_372);
l_var_name_84 = Symbol() + "r3";
l_time_92 = ld_196;
GlobalVariableSet(l_var_name_84, l_time_92);
ld_204 = NormalizeDouble(ld_204, gi_372);
l_var_name_84 = Symbol() + "r4";
l_time_92 = ld_204;
GlobalVariableSet(l_var_name_84, l_time_92);
ld_212 = NormalizeDouble(ld_212, gi_372);
l_var_name_84 = Symbol() + "r5";
l_time_92 = ld_212;
GlobalVariableSet(l_var_name_84, l_time_92);
ld_220 = NormalizeDouble(ld_220, gi_372);
l_var_name_84 = Symbol() + "s1";
l_time_92 = ld_220;
GlobalVariableSet(l_var_name_84, l_time_92);
ld_228 = NormalizeDouble(ld_228, gi_372);
l_var_name_84 = Symbol() + "s2";
l_time_92 = ld_228;
GlobalVariableSet(l_var_name_84, l_time_92);
ld_236 = NormalizeDouble(ld_236, gi_372);
l_var_name_84 = Symbol() + "s3";
l_time_92 = ld_236;
GlobalVariableSet(l_var_name_84, l_time_92);
ld_244 = NormalizeDouble(ld_244, gi_372);
l_var_name_84 = Symbol() + "s4";
l_time_92 = ld_244;
GlobalVariableSet(l_var_name_84, l_time_92);
ld_252 = NormalizeDouble(ld_252, gi_372);
l_var_name_84 = Symbol() + "s5";
l_time_92 = ld_252;
GlobalVariableSet(l_var_name_84, l_time_92);
li_12 = Time[li_72];
li_8 = Time[li_72 + 0];
if (FullScreenLinesMarginPrices == TRUE) {
li_12 = Time[0] - 60 * (gi_364 * Period());
li_8 = Time[0] - 60 * (gi_364 * Period());
}
if (R5_LineStyle_01234 > 0) R5_SolidLineThickness = 0;
if (R4_LineStyle_01234 > 0) R4_SolidLineThickness = 0;
if (R3_LineStyle_01234 > 0) R3_SolidLineThickness = FALSE;
if (R2_LineStyle_01234 > 0) R2_SolidLineThickness = FALSE;
if (R1_LineStyle_01234 > 0) R1_SolidLineThickness = FALSE;
if (S1_LineStyle_01234 > 0) S1_SolidLineThickness = FALSE;
if (S2_LineStyle_01234 > 0) S2_SolidLineThickness = FALSE;
if (S3_LineStyle_01234 > 0) S3_SolidLineThickness = FALSE;
if (S4_LineStyle_01234 > 0) S4_SolidLineThickness = 0;
if (S5_LineStyle_01234 > 0) S5_SolidLineThickness = 0;
SetLevel(" R1 ", ld_180, R1_Color, R1_LineStyle_01234, R1_SolidLineThickness, li_8, li_12);
SetLevel(" R2 ", ld_188, R2_Color, R2_LineStyle_01234, R2_SolidLineThickness, li_8, li_12);
SetLevel(" R3 ", ld_196, R3_Color, R3_LineStyle_01234, R3_SolidLineThickness, li_8, li_12);
SetLevel(" S1 ", ld_220, S1_Color, S1_LineStyle_01234, S1_SolidLineThickness, li_8, li_12);
SetLevel(" S2 ", ld_228, S2_Color, S2_LineStyle_01234, S2_SolidLineThickness, li_8, li_12);
SetLevel(" S3 ", ld_236, S3_Color, S3_LineStyle_01234, S3_SolidLineThickness, li_8, li_12);
if (Show_1Daily_2FibonacciPivots == 1) SetLevel(" DPV ", ld_156, CentralPivotColor, CentralPivotLineStyle_01234, CentralPivotSolidLineThickness, li_8, li_12);
if (Show_1Daily_2FibonacciPivots == 2) {
SetLevel(" FPV ", ld_156, CentralPivotColor, CentralPivotLineStyle_01234, CentralPivotSolidLineThickness, li_8, li_12);
SetLevel(" R4 ", ld_204, R3_Color, R5_LineStyle_01234, R3_SolidLineThickness, li_8, li_12);
SetLevel(" R5 ", ld_212, R3_Color, R4_LineStyle_01234, R3_SolidLineThickness, li_8, li_12);
SetLevel(" S4 ", ld_244, S3_Color, S4_LineStyle_01234, S3_SolidLineThickness, li_8, li_12);
SetLevel(" S5 ", ld_252, S3_Color, S5_LineStyle_01234, S3_SolidLineThickness, li_8, li_12);
}
if (ShowMidPivots == TRUE) {
li_12 = Time[li_72];
li_8 = Time[li_72 + 0];
if (FullScreenLinesMarginPrices == TRUE) {
li_12 = Time[0] - 60 * (gi_364 * Period());
li_8 = Time[0] - 60 * (gi_364 * Period());
}
if (MidPivotsLineStyle_01234 > 0) MidPivotsLineThickness = FALSE;
SetLevel("MR5", (ld_204 + ld_212) / 2.0, MidPivotsColor, MidPivotsLineStyle_01234, MidPivotsLineThickness, li_8, li_12);
SetLevel("MR4", (ld_196 + ld_204) / 2.0, MidPivotsColor, MidPivotsLineStyle_01234, MidPivotsLineThickness, li_8, li_12);
SetLevel("MR3", (ld_188 + ld_196) / 2.0, MidPivotsColor, MidPivotsLineStyle_01234, MidPivotsLineThickness, li_8, li_12);
SetLevel("MR2", (ld_180 + ld_188) / 2.0, MidPivotsColor, MidPivotsLineStyle_01234, MidPivotsLineThickness, li_8, li_12);
SetLevel("MR1", (ld_156 + ld_180) / 2.0, MidPivotsColor, MidPivotsLineStyle_01234, MidPivotsLineThickness, li_8, li_12);
SetLevel("MS1", (ld_156 + ld_220) / 2.0, MidPivotsColor, MidPivotsLineStyle_01234, MidPivotsLineThickness, li_8, li_12);
SetLevel("MS2", (ld_220 + ld_228) / 2.0, MidPivotsColor, MidPivotsLineStyle_01234, MidPivotsLineThickness, li_8, li_12);
SetLevel("MS3", (ld_228 + ld_236) / 2.0, MidPivotsColor, MidPivotsLineStyle_01234, MidPivotsLineThickness, li_8, li_12);
SetLevel("MS4", (ld_236 + ld_244) / 2.0, MidPivotsColor, MidPivotsLineStyle_01234, MidPivotsLineThickness, li_8, li_12);
SetLevel("MS5", (ld_244 + ld_252) / 2.0, MidPivotsColor, MidPivotsLineStyle_01234, MidPivotsLineThickness, li_8, li_12);
l_var_name_84 = Symbol() + "mr5";
l_time_92 = (ld_204 + ld_212) / 2.0;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "mr4";
l_time_92 = (ld_196 + ld_204) / 2.0;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "mr3";
l_time_92 = (ld_188 + ld_196) / 2.0;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "mr2";
l_time_92 = (ld_180 + ld_188) / 2.0;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "mr1";
l_time_92 = (ld_156 + ld_180) / 2.0;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "ms1";
l_time_92 = (ld_156 + ld_220) / 2.0;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "ms2";
l_time_92 = (ld_220 + ld_228) / 2.0;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "ms3";
l_time_92 = (ld_228 + ld_236) / 2.0;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "ms4";
l_time_92 = (ld_236 + ld_244) / 2.0;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "ms5";
l_time_92 = (ld_244 + ld_252) / 2.0;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
}
if (ShowYesterdayHighLow == TRUE) {
li_12 = Time[li_72 + 10];
li_8 = Time[li_76 + 1];
if (FullScreenLinesMarginPrices == TRUE) {
li_12 = Time[0] - 60 * (gi_364 * Period());
li_8 = Time[0] - 60 * (gi_364 * Period());
}
if (HighLowLineStyle_01234 > 0) HighLowSolidLineThickness = FALSE;
SetLevel("yHigh", ld_40, YesterdayHighLowColor, HighLowLineStyle_01234, HighLowSolidLineThickness, li_8, li_12);
SetLevel("yLow ", ld_56, YesterdayHighLowColor, HighLowLineStyle_01234, HighLowSolidLineThickness, li_8, li_12);
l_var_name_84 = Symbol() + "yh";
l_time_92 = ld_40;
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "yl";
l_time_92 = ld_56;
GlobalVariableSet(l_var_name_84, l_time_92);
}
if (ShowTodayOpen == TRUE) {
li_12 = Time[li_72 + 10];
li_8 = Time[li_72 + 1];
if (FullScreenLinesMarginPrices == TRUE) {
li_12 = Time[0] - 60 * (gi_364 * Period());
li_8 = Time[0] - 60 * (gi_364 * Period());
}
if (TodayOpenLineStyle_01234 > 0) TodayOpenSolidLineThickness = FALSE;
SetLevel("Open", l_open_32, TodayOpenColor, TodayOpenLineStyle_01234, TodayOpenSolidLineThickness, li_8, li_12);
l_var_name_84 = Symbol() + "to";
l_time_92 = l_open_32;
GlobalVariableSet(l_var_name_84, l_time_92);
}
if (ShowCamarilla == TRUE) {
li_12 = Time[li_72 + 10];
li_8 = Time[li_72 + 1];
if (FullScreenLinesMarginPrices == TRUE) {
li_12 = Time[0] - 60 * (gi_364 * Period());
li_8 = Time[0] - 60 * (gi_364 * Period());
}
if (CamarillaLineStyle_01234 > 0) CamarillaSolidLineThickness = FALSE;
ld_260 = 0.55 * ld_164 + l_close_64;
ld_268 = 0.27 * ld_164 + l_close_64;
ld_276 = l_close_64 - 0.27 * ld_164;
ld_284 = l_close_64 - 0.55 * ld_164;
SetLevel("CR1", ld_268, CamarillaColor, CamarillaLineStyle_01234, CamarillaSolidLineThickness, li_8, li_12);
SetLevel("CR2", ld_260, CamarillaColor, CamarillaLineStyle_01234, CamarillaSolidLineThickness, li_8, li_12);
SetLevel("CS1", ld_276, CamarillaColor, CamarillaLineStyle_01234, CamarillaSolidLineThickness, li_8, li_12);
SetLevel("CS2", ld_284, CamarillaColor, CamarillaLineStyle_01234, CamarillaSolidLineThickness, li_8, li_12);
l_var_name_84 = Symbol() + "cr1";
l_time_92 = ld_268;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "cr2";
l_time_92 = ld_260;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "cs1";
l_time_92 = ld_276;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
l_var_name_84 = Symbol() + "cs2";
l_time_92 = ld_284;
l_time_92 = NormalizeDouble(l_time_92, gi_372);
GlobalVariableSet(l_var_name_84, l_time_92);
}
if (ShowComment) {
ls_292 = " ";
ls_292 = ls_292 + "-- Good luck with your trading! ---\n";
ls_292 = ls_292 + "Range: Yesterday " + DoubleToStr(MathRound(ld_164 / Point), 0) + " pips, Today " + DoubleToStr(MathRound(ld_172 / Point), 0) + " pips"
+ "\n";
ls_292 = ls_292 + "Highs: Yesterday " + DoubleToStr(ld_40, Digits) + ", Today " + DoubleToStr(ld_16, Digits)
+ "\n";
ls_292 = ls_292 + "Lows: Yesterday " + DoubleToStr(ld_56, Digits) + ", Today " + DoubleToStr(ld_24, Digits)
+ "\n";
ls_292 = ls_292 + "Close: Yesterday " + DoubleToStr(l_close_64, Digits)
+ "\n";
Comment(ls_292);
}
return (0);
}
void ComputeDayIndices(int ai_0, int ai_4, int &ai_8, int &ai_12, int &ai_16) {
int li_52;
int li_60;
int li_64;
int li_20 = ai_0 - ai_4;
int li_24 = 3600 * li_20;
int li_28 = 1440;
int li_32 = li_28 / Period();
int l_day_of_week_36 = TimeDayOfWeek(Time[0] - li_24);
int li_40 = -1;
ai_8 = 0;
ai_12 = 0;
ai_16 = 0;
switch (l_day_of_week_36) {
case 6:
case 0:
li_40 = 5;
break;
case 1: break;
default:
li_40 = l_day_of_week_36 - 1;
}
for (int li_48 = 1; li_48 <= li_32 + 1; li_48++) {
li_52 = Time[li_48] - li_24;
if (TimeDayOfWeek(li_52) != l_day_of_week_36) {
ai_8 = li_48 - 1;
break;
}
}
for (int l_count_56 = 0; l_count_56 <= li_32 * 2 + 1; l_count_56++) {
li_60 = Time[li_48 + l_count_56] - li_24;
if (TimeDayOfWeek(li_60) == li_40) {
ai_16 = li_48 + l_count_56;
break;
}
}
for (l_count_56 = 1; l_count_56 <= li_32; l_count_56++) {
li_64 = Time[ai_16 + l_count_56] - li_24;
if (TimeDayOfWeek(li_64) != li_40) {
ai_12 = ai_16 + l_count_56 - 1;
return;
}
}
}
void SetLevel(string as_0, double a_price_8, color a_color_16, int a_style_20, int a_width_24, int a_datetime_28, int a_datetime_32) {
int li_68;
int li_72;
string ls_76;
int li_unused_36 = Digits;
string l_name_40 = "[PIVOT] " + as_0 + " Label";
string l_name_48 = "[PIVOT] " + as_0 + " Line";
int li_64 = 2;
if (FullScreenLinesMarginPrices == TRUE) li_64 = 1;
if (ObjectFind(l_name_48) != 0) {
ObjectCreate(l_name_48, li_64, 0, a_datetime_28, a_price_8, Time[0], a_price_8);
ObjectSet(l_name_48, OBJPROP_STYLE, a_style_20);
ObjectSet(l_name_48, OBJPROP_COLOR, a_color_16);
ObjectSet(l_name_48, OBJPROP_WIDTH, a_width_24);
} else {
ObjectMove(l_name_48, 1, Time[0], a_price_8);
ObjectMove(l_name_48, 0, a_datetime_28, a_price_8);
}
if (FullScreenLinesMarginPrices == FALSE) {
li_68 = 1000;
if (Period() == PERIOD_M1) li_68 = AutoLabelerSensorAdjust + 132;
if (Period() == PERIOD_M5) li_68 = AutoLabelerSensorAdjust + 130;
li_72 = Time[0] - 60 * (gi_364 * Period());
ls_76 = "A= " + li_72 + " startlabel = " + a_datetime_32 + " Time[0]-startlabel)/Period()/60 = " + ((Time[0] - a_datetime_32) / Period() / 60);
if (gi_368 > 0 || (Time[0] - a_datetime_32) / Period() / 60 >= li_68) {
a_datetime_32 = li_72;
gi_368++;
}
ls_76 = ls_76 + (" B = " + gi_368 + " AdjustSensor = " + li_68 + " startlabel = " + a_datetime_32 + " MoveLabel setting = " + gi_364 + " period = " +
Period());
if (ShowTestComment == TRUE) Comment(ls_76);
else Comment(" ");
}
if (ObjectFind(l_name_40) != 0) ObjectCreate(l_name_40, OBJ_TEXT, 0, a_datetime_32, a_price_8);
else ObjectMove(l_name_40, 0, a_datetime_32, a_price_8);
string l_text_56 = " " + as_0;
if (LineLabelsIncludePrice && StrToInteger(as_0) == 0) l_text_56 = l_text_56 + ": " + DoubleToStr(a_price_8, Digits);
ObjectSetText(l_name_40, l_text_56, LineLabelsFontSize, LineLabelsFontStyle, PivotLinesLabelColor);
}
void SetTimeLine(string as_0, string a_text_8, int ai_16, int ai_unused_20, double a_price_24) {
string l_name_32 = "[PIVOT] " + as_0;
int l_time_40 = Time[ai_16];
if (ObjectFind(l_name_32) != 0) {
ObjectCreate(l_name_32, OBJ_TREND, 0, l_time_40, 0, l_time_40, 100);
ObjectSet(l_name_32, OBJPROP_STYLE, SeparatorLinesStyle_01234);
ObjectSet(l_name_32, OBJPROP_COLOR, PeriodSeparatorLinesColor);
ObjectSet(l_name_32, OBJPROP_WIDTH, SeparatorLinesThickness);
} else {
ObjectMove(l_name_32, 0, l_time_40, 0);
ObjectMove(l_name_32, 1, l_time_40, 100);
}
if (ShowPeriodSeparatorLabels == TRUE) {
if (ObjectFind(l_name_32 + " Label") != 0) ObjectCreate(l_name_32 + " Label", OBJ_TEXT, 0, l_time_40, a_price_24);
else ObjectMove(l_name_32 + " Label", 0, l_time_40, a_price_24);
ObjectSetText(l_name_32 + " Label", a_text_8, SeparatorLabelFontSize, SeparatorLabelFontStyle, PeriodSeparatorsLabelsColor);
}
}
Comments