#property copyright "Michael E Wilkinson DDDS Copyright © 2009" #property link "mewddsltd@msn.com" #property indicator_chart_window #property indicator_buffers 7 #property indicator_color1 Red #property indicator_color2 Navy #property indicator_color3 Red #property indicator_color4 Blue #property indicator_color5 Navy #property indicator_color6 Red #property indicator_color7 Black extern int ShowSR = 2; extern int NumberOfHighlights = 13; extern int FillGapLevel.1 = 500; extern int FillGapLevel.2 = 1000; extern string Note1 = "---Consider these arrows---"; extern string Note2 = " Up = 217 / Down = 218"; extern string Note3 = " Up = 225 / Down = 226"; extern string Note4 = " Up = 233 / Down = 234"; extern string Note5 = " Up = 241 / Down = 242"; extern int ArrowUp = 233; extern int ArrowDn = 234; extern bool ShowPivotArrows = TRUE; extern bool HighlightMonday = TRUE; extern bool AlertsOn = TRUE; extern bool alertsMessage = TRUE; extern bool alertsSound = FALSE; extern bool alertsEmail = FALSE; extern double XArwRange = 1.5; extern color tColorTxt = Navy; extern color tColor1 = Navy; extern color tColor2 = FireBrick; extern color tColor3 = DeepSkyBlue; extern color tColor4 = OrangeRed; extern color tColor5 = Green; extern color tColor6 = Gold; extern color tColor7 = Navy; extern color tColor8 = FireBrick; extern color tMonday = LightCyan; int gi_212 = 10000; int gi_216 = 1; double gd_220; string g_name_228; string g_name_236; string g_name_244; extern int GMTShift = 2; extern string PivotNote1 = "---Choose a timeframe---"; extern string PivotNote2 = "0 = 1 Min Pivot"; extern string PivotNote3 = "1 = 5 Min Pivot // 2 = 15 Min Pivot"; extern string PivotNote4 = "3 = 30 Min Pivot // 4 = 1 Hour Pivot"; extern string PivotNote5 = "5 = 4 Hour Pivot // 6 = Daily Pivot"; extern string PivotNote6 = "7 = Weekly Pivot // 8 = Montly Pivot"; extern int pvtPeriod = 6; extern string PivotNote7 = "---Choose a pivot type---"; extern string PivotNote8 = "1 = Camarilla // 2 = Classic"; extern string PivotNote9 = "3 = Demark // 4 = Fibonacci"; extern string PivotNote10 = "5 = Woodie"; extern int pvtType = 5; extern string PivotNote11 = "---Choose a pivot point formula---"; extern string PivotNote12 = "1 = (H+L+C)/3 // 2 = (H+L+O)/3"; extern string PivotNote13 = "3 = (H+L+C+O)/4 // 4 = (H+L+C+C)/4"; extern string PivotNote14 = "5 = (H+L+O+0)/4 // 6 = (H+L)/2"; extern string PivotNote15 = "7 = (H+C)/2 // 8 = (L+C)/2"; extern int pvtFormula = 1; extern string RName = "AlertLine.Resistance"; extern string SName = "AlertLine.Support"; extern color ResistanceColor = Navy; extern color SupportColor = FireBrick; extern int ResistanceStyle = 1; extern int SupportStyle = 1; extern bool AutoMove = TRUE; extern int AlertPipRange = 0; int g_timeframe_428 = 0; double g_ibuf_432[]; double g_ibuf_436[]; double g_ibuf_440[]; double g_ibuf_444[]; double g_ibuf_448[]; double g_ibuf_452[]; double g_ibuf_456[]; double gd_460; double gd_476; double gd_unused_484 = 0.091667; double gd_unused_492 = 0.183333; double gd_500 = 0.275; double gd_508 = 0.55; datetime gt_unused_516; string gs_nothing_520 = "nothing"; datetime g_time_528; int AuthorizedDate() { bool li_ret_0; string ls_4 = "2009.12.31"; int l_str2time_12 = StrToTime(ls_4); if (TimeCurrent() <= l_str2time_12) li_ret_0 = TRUE; else li_ret_0 = FALSE; return (li_ret_0); } int AuthorizedAccount(int ai_0) { bool li_ret_4 = FALSE; if (ai_0 == 6025474 || ai_0 == 6048211 || ai_0 == 6048211 || ai_0 == 5569156 || ai_0 == 2088182226 || ai_0 == 2088203736 || ai_0 == 6046489 || ai_0 == 2368036 || ai_0 == 5661503 || ai_0 == 11201 || ai_0 == 1139824 || ai_0 == 6054916 || ai_0 == 5672146 || ai_0 == 6054298 || ai_0 == 6056548 || ai_0 == 2413999 || ai_0 == 1612010 || ai_0 == 1612012 || ai_0 == 1612015 || ai_0 == 1613288 || ai_0 == 1613289 || ai_0 == 1613290 || ai_0 == 1613292 || ai_0 == 1613293 || ai_0 == 1614331 || ai_0 == 5635503 || ai_0 == 2088200531) li_ret_4 = TRUE; else li_ret_4 = FALSE; return (li_ret_4); } int AuthorizedKey(int ai_0) { bool li_ret_4 = FALSE; int li_8 = 1 * StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 0, 2)); int li_12 = 3 * StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 2, 2)); int li_16 = 5 * StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 4, 2)); int li_20 = StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 6, 2)) * 2; int li_24 = StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 8, 2)) << 2; int li_28 = 6 * StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 10, 2)); int li_32 = li_8 + li_12 + li_16 + li_20 + li_24 + li_28; if (li_32 == 57 || li_32 == 61 || li_32 == 67 || li_32 == 76 || li_32 == 200 || li_32 == 204 || li_32 == 206 || li_32 == 211 || li_32 == 213 || li_32 == 225 || li_32 == 254 || li_32 == 311 || li_32 == 349 || li_32 == 354 || li_32 == 378 || li_32 == 383 || li_32 == 417 || li_32 == 456 || li_32 == 495 || li_32 == 514 || li_32 == 518 || li_32 == 522 || li_32 == 546 || li_32 == 576 || li_32 == 602 || li_32 == 689) li_ret_4 = TRUE; else li_ret_4 = FALSE; return (li_ret_4); } void calcPVT() { int l_shift_4; int li_16; double ld_20; double l_ihigh_28; double l_ilow_36; double l_iclose_44; double l_iopen_52; int li_8 = IndicatorCounted(); int li_12 = Bars - li_8; if (li_8 >= 0) { if (li_8 > 0) li_8--; for (int li_0 = li_12 - 1; li_0 >= 0; li_0--) { l_shift_4 = iBarShift(Symbol(), g_timeframe_428, Time[li_0] + 3600 * GMTShift, FALSE); li_16 = 0; l_ihigh_28 = iHigh(Symbol(), g_timeframe_428, l_shift_4 + 1 + li_16); l_ilow_36 = iLow(Symbol(), g_timeframe_428, l_shift_4 + 1 + li_16); l_iclose_44 = iClose(Symbol(), g_timeframe_428, l_shift_4 + 1 + li_16); l_iopen_52 = iOpen(Symbol(), g_timeframe_428, l_shift_4); gd_476 = l_ihigh_28 - l_ilow_36; if (pvtType == 3) { if (l_iclose_44 < l_iopen_52) ld_20 = l_ihigh_28 + 2.0 * l_ilow_36 + l_iclose_44; else { if (l_iclose_44 > l_iopen_52) ld_20 = 2.0 * l_ihigh_28 + l_ilow_36 + l_iclose_44; else if (l_iclose_44 == l_iopen_52) ld_20 = l_ihigh_28 + l_ilow_36 + 2.0 * l_iclose_44; } gd_460 = ld_20 / 4.0; } else { switch (pvtFormula) { case 1: gd_460 = (l_ihigh_28 + l_ilow_36 + l_iclose_44) / 3.0; break; case 2: gd_460 = (l_ihigh_28 + l_ilow_36 + l_iopen_52) / 3.0; break; case 3: gd_460 = (l_ihigh_28 + l_ilow_36 + l_iclose_44 + l_iopen_52) / 4.0; break; case 4: gd_460 = (l_ihigh_28 + l_ilow_36 + l_iclose_44 + l_iclose_44) / 4.0; break; case 5: gd_460 = (l_ihigh_28 + l_ilow_36 + l_iopen_52 + l_iopen_52) / 4.0; break; case 6: gd_460 = (l_ihigh_28 + l_ilow_36) / 2.0; break; case 7: gd_460 = (l_ihigh_28 + l_iclose_44) / 2.0; break; case 8: gd_460 = (l_ilow_36 + l_iclose_44) / 2.0; } } g_ibuf_432[li_0] = gd_460; switch (pvtType) { case 1: g_ibuf_444[li_0] = (l_ihigh_28 - l_ilow_36) * gd_500 + l_iclose_44; g_ibuf_448[li_0] = l_iclose_44 - (l_ihigh_28 - l_ilow_36) * gd_500; g_ibuf_440[li_0] = (l_ihigh_28 - l_ilow_36) * gd_508 + l_iclose_44; g_ibuf_452[li_0] = l_iclose_44 - (l_ihigh_28 - l_ilow_36) * gd_508; g_ibuf_436[li_0] = l_ihigh_28 / l_ilow_36 * l_iclose_44; g_ibuf_456[li_0] = l_iclose_44 - (g_ibuf_436[li_0] - l_iclose_44); break; case 2: g_ibuf_444[li_0] = 2.0 * gd_460 - l_ilow_36; g_ibuf_448[li_0] = 2.0 * gd_460 - l_ihigh_28; g_ibuf_440[li_0] = gd_460 + gd_476; g_ibuf_452[li_0] = gd_460 - gd_476; g_ibuf_436[li_0] = gd_460 + 2.0 * gd_476; g_ibuf_456[li_0] = gd_460 - 2.0 * gd_476; break; case 3: g_ibuf_436[li_0] = ld_20 / 2.0 - l_ilow_36; g_ibuf_456[li_0] = ld_20 / 2.0 - l_ihigh_28; break; case 4: g_ibuf_444[li_0] = gd_460 + gd_476 / 2.0; g_ibuf_448[li_0] = gd_460 - gd_476 / 2.0; g_ibuf_440[li_0] = gd_460 + 0.618 * gd_476; g_ibuf_452[li_0] = gd_460 - 0.618 * gd_476; g_ibuf_436[li_0] = gd_460 + 0.99 * gd_476; g_ibuf_456[li_0] = gd_460 - 0.99 * gd_476; break; case 5: g_ibuf_444[li_0] = 2.0 * gd_460 - l_ilow_36; g_ibuf_448[li_0] = 2.0 * gd_460 - l_ihigh_28; g_ibuf_440[li_0] = gd_460 + gd_476; g_ibuf_452[li_0] = gd_460 - gd_476; g_ibuf_436[li_0] = 2.0 * (gd_460 - l_ilow_36) + l_ihigh_28; g_ibuf_456[li_0] = 2.0 * (gd_460 - l_ihigh_28) + l_ilow_36; } } } } void pivotCrossed(double ad_0, double ad_8, bool ai_16) { if (ai_16) { ObjectMove(RName, 0, Time[0], ad_8); ObjectMove(SName, 0, Time[0], ad_0); gt_unused_516 = Time[0]; } double ld_20 = ObjectGet(SName, OBJPROP_PRICE1); double ld_28 = ObjectGet(RName, OBJPROP_PRICE1); if (iLow(Symbol(), 0, 0) - AlertPipRange * Point <= ld_20) doAlert(" - Current price has crossed Support", 1); if (iHigh(Symbol(), 0, 0) + AlertPipRange * Point >= ld_28) doAlert(" - Current price has crossed Resistance", 1); } int init() { switch (pvtPeriod) { case 0: g_timeframe_428 = 1; SetIndexLabel(3, "1 Min Pivot Point"); break; case 1: g_timeframe_428 = 5; SetIndexLabel(3, "5 Min Pivot Point"); break; case 2: g_timeframe_428 = 15; SetIndexLabel(3, "15 Min Pivot Point"); break; case 3: g_timeframe_428 = 30; SetIndexLabel(3, "30 Min Pivot Point"); break; case 4: g_timeframe_428 = 60; SetIndexLabel(3, "60 Min Pivot Point"); break; case 5: g_timeframe_428 = 240; SetIndexLabel(3, "4 Hour Pivot Point"); break; case 6: g_timeframe_428 = 1440; SetIndexLabel(3, "Daily Pivot Point"); break; case 7: g_timeframe_428 = 10080; SetIndexLabel(3, "Weekly Pivot Point"); break; case 8: g_timeframe_428 = 43200; SetIndexLabel(3, "Monthly Pivot Point"); } switch (ShowSR) { case 3: SetIndexBuffer(0, g_ibuf_436); SetIndexBuffer(1, g_ibuf_432); SetIndexBuffer(2, g_ibuf_456); break; case 2: SetIndexBuffer(0, g_ibuf_440); SetIndexBuffer(1, g_ibuf_432); SetIndexBuffer(2, g_ibuf_452); break; case 1: SetIndexBuffer(0, g_ibuf_444); SetIndexBuffer(1, g_ibuf_432); SetIndexBuffer(2, g_ibuf_448); } SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1); SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 1); SetIndexLabel(0, "Resistance"); SetIndexLabel(1, "PP"); SetIndexLabel(2, "Support"); if (HighlightMonday) { DeleteObjects(); for (int l_count_8 = 0; l_count_8 < NumberOfHighlights; l_count_8++) CreateObjects("Monday" + l_count_8, tMonday, TRUE); } string ls_12 = ""; string ls_20 = ""; switch (pvtType) { case 1: ls_12 = "Camarillo"; break; case 2: ls_12 = "Classic"; break; case 3: ls_12 = "Demark"; break; case 4: ls_12 = "Fibonacci"; break; case 5: ls_12 = "Woodie"; } switch (pvtFormula) { case 1: ls_20 = "(H+L+C)/3"; break; case 2: ls_20 = "(H+L+O)/3"; break; case 3: ls_20 = "(H+L+C+O)/4"; break; case 4: ls_20 = "(H+L+C+C)/4"; break; case 5: ls_20 = "(H+L+O+0)/4"; break; case 6: ls_20 = "(H+L)/2"; break; case 7: ls_20 = "(H+C)/2"; break; case 8: ls_20 = "(L+C)/2"; } if (Digits == 3 || Digits == 5) { gi_216 = 10; FillGapLevel.1 = 10 * FillGapLevel.1; FillGapLevel.2 = 10 * FillGapLevel.2; } ObjectDelete("pvtInfo"); ObjectCreate("pvtInfo", OBJ_LABEL, 0, 0, 0); ObjectSetText("pvtInfo", ls_12 + " // " + ls_20, 10, "Arial Bold", tColorTxt); ObjectSet("pvtInfo", OBJPROP_CORNER, 3); ObjectSet("pvtInfo", OBJPROP_XDISTANCE, 5); ObjectSet("pvtInfo", OBJPROP_YDISTANCE, 5); createLines(1, SName, SupportStyle, SupportColor); createLines(2, RName, ResistanceStyle, ResistanceColor); return (0); } int deinit() { ObjectDelete("StackSize"); ObjectDelete(g_name_228); ObjectDelete("PivotPoint"); ObjectDelete("Resistance"); ObjectDelete("Support"); ObjectDelete("txtPivotPoint"); ObjectDelete("txtResistance"); ObjectDelete("txtSupport"); ObjectDelete(g_name_236); ObjectDelete(g_name_244); ObjectDelete("pvtInfo"); ObjectDelete("R3"); ObjectDelete("S3"); ObjectDelete(RName); ObjectDelete(SName); Comment(""); DeleteObjects(); DeleteArrows(); return (0); } int start() { int li_4; int li_8; int li_12; int l_color_16; int l_color_20; int l_color_24; double ld_32; string l_text_48; string l_text_56; string l_text_64; int l_datetime_76; string ls_80; string ls_88; if (AuthorizedDate() && AuthorizedAccount(AccountNumber()) && AuthorizedKey(AccountNumber())) { li_12 = IndicatorCounted(); calcPVT(); if (AccountNumber() == 1612010 || AccountNumber() == 1612012 || AccountNumber() == 1612015 || AccountNumber() == 1613288 || AccountNumber() == 1613289 || AccountNumber() == 1613290 || AccountNumber() == 1613292 || AccountNumber() == 1613293 || AccountNumber() == 1614331 || AccountNumber() == 5635503) { l_color_16 = tColorTxt; l_color_20 = tColorTxt; l_color_24 = tColorTxt; } else { l_color_16 = Red; l_color_20 = Navy; l_color_24 = Red; } SetPrice("PivotPoint", Time[0], g_ibuf_432[0], l_color_20); SetText("txtPivotPoint", "", Time[0], g_ibuf_432[0], l_color_20); switch (ShowSR) { case 1: SetPrice("Resistance", Time[0], g_ibuf_444[0], l_color_16); SetPrice("Support", Time[0], g_ibuf_448[0], l_color_24); SetText("txtResistance", "R1", Time[0], g_ibuf_444[0], l_color_16); SetText("txtSupport", "S1", Time[0], g_ibuf_448[0], l_color_24); break; case 2: SetPrice("Resistance", Time[0], g_ibuf_440[0], l_color_16); SetPrice("Support", Time[0], g_ibuf_452[0], l_color_24); SetText("txtResistance", "R2", Time[0], g_ibuf_440[0], l_color_16); SetText("txtSupport", "S2", Time[0], g_ibuf_452[0], l_color_24); break; case 3: SetPrice("Resistance", Time[0], g_ibuf_436[0], l_color_16); SetPrice("Support", Time[0], g_ibuf_456[0], l_color_24); SetText("txtResistance", "R3 ", Time[0], g_ibuf_436[0], l_color_16); SetText("txtSupport", "S3", Time[0], g_ibuf_456[0], l_color_24); } pivotCrossed(ObjectGet("txtSupport", OBJPROP_PRICE1), ObjectGet("txtResistance", OBJPROP_PRICE1), AutoMove); ld_32 = 0; if (li_12 > 0) li_12--; li_8 = Bars - li_12; for (int li_0 = li_8 - 1; li_0 >= 0; li_0--) { for (int l_index_40 = 0; l_index_40 <= li_4; l_index_40++) ld_32 += MathAbs(High[l_index_40] - Low[l_index_40]); gd_220 = ld_32 / (li_4 + 1); } DeleteArrows(); for (li_0 = 0; li_0 < WindowBarsPerChart(); li_0++) { if (ShowPivotArrows) { switch (ShowSR) { case 1: if (iHigh(Symbol(), 0, li_0 + 1) < g_ibuf_444[li_0 + 1] && iHigh(Symbol(), 0, li_0) >= g_ibuf_444[li_0]) DrawArrow(li_0, "down", tColor2, XArwRange, ArrowDn); else { if (iLow(Symbol(), 0, li_0 + 1) > g_ibuf_448[li_0 + 1] && iLow(Symbol(), 0, li_0) <= g_ibuf_448[li_0]) DrawArrow(li_0, "up", tColor1, XArwRange, ArrowUp); else { if (FillGapLevel.1 != 0 && iHigh(Symbol(), 0, li_0 + 1) < g_ibuf_444[li_0 + 1] + FillGapLevel.1 * Point && iHigh(Symbol(), 0, li_0) >= g_ibuf_444[li_0] + FillGapLevel.1 * Point) DrawArrow(li_0, "down", tColor4, XArwRange, ArrowDn); else { if (FillGapLevel.1 != 0 && iLow(Symbol(), 0, li_0 + 1) > g_ibuf_448[li_0 + 1] - FillGapLevel.1 * Point && iLow(Symbol(), 0, li_0) <= g_ibuf_448[li_0] - FillGapLevel.1 * Point) DrawArrow(li_0, "up", tColor3, XArwRange, ArrowUp); else { if (FillGapLevel.2 != 0 && iHigh(Symbol(), 0, li_0 + 1) < g_ibuf_444[li_0 + 1] + FillGapLevel.2 * Point && iHigh(Symbol(), 0, li_0) >= g_ibuf_444[li_0] + FillGapLevel.2 * Point) DrawArrow(li_0, "down", tColor6, XArwRange, ArrowDn); else if (FillGapLevel.2 != 0 && iLow(Symbol(), 0, li_0 + 1) > g_ibuf_448[li_0 + 1] - FillGapLevel.2 * Point && iLow(Symbol(), 0, li_0) <= g_ibuf_448[li_0] - FillGapLevel.2 * Point) DrawArrow(li_0, "up", tColor5, XArwRange, ArrowUp); } } } } break; case 2: if (iHigh(Symbol(), 0, li_0 + 1) < g_ibuf_440[li_0 + 1] && iHigh(Symbol(), 0, li_0) >= g_ibuf_440[li_0]) DrawArrow(li_0, "down", tColor2, XArwRange, ArrowDn); else { if (iLow(Symbol(), 0, li_0 + 1) > g_ibuf_452[li_0 + 1] && iLow(Symbol(), 0, li_0) <= g_ibuf_452[li_0]) DrawArrow(li_0, "up", tColor1, XArwRange, ArrowUp); else { if (FillGapLevel.1 != 0 && iHigh(Symbol(), 0, li_0 + 1) < g_ibuf_440[li_0 + 1] + FillGapLevel.1 * Point && iHigh(Symbol(), 0, li_0) >= g_ibuf_440[li_0] + FillGapLevel.1 * Point) DrawArrow(li_0, "down", tColor4, XArwRange, ArrowDn); else { if (FillGapLevel.1 != 0 && iLow(Symbol(), 0, li_0 + 1) > g_ibuf_452[li_0 + 1] - FillGapLevel.1 * Point && iLow(Symbol(), 0, li_0) <= g_ibuf_452[li_0] - FillGapLevel.1 * Point) DrawArrow(li_0, "up", tColor3, XArwRange, ArrowUp); else { if (FillGapLevel.2 != 0 && iHigh(Symbol(), 0, li_0 + 1) < g_ibuf_440[li_0 + 1] + FillGapLevel.2 * Point && iHigh(Symbol(), 0, li_0) >= g_ibuf_440[li_0] + FillGapLevel.2 * Point) DrawArrow(li_0, "down", tColor6, XArwRange, ArrowDn); else if (FillGapLevel.2 != 0 && iLow(Symbol(), 0, li_0 + 1) > g_ibuf_452[li_0 + 1] - FillGapLevel.2 * Point && iLow(Symbol(), 0, li_0) <= g_ibuf_452[li_0] - FillGapLevel.2 * Point) DrawArrow(li_0, "up", tColor5, XArwRange, ArrowUp); } } } } break; case 3: if (iHigh(Symbol(), 0, li_0 + 1) < g_ibuf_436[li_0 + 1] && iHigh(Symbol(), 0, li_0) >= g_ibuf_436[li_0]) DrawArrow(li_0, "down", tColor2, XArwRange, ArrowDn); else { if (iLow(Symbol(), 0, li_0 + 1) > g_ibuf_456[li_0 + 1] && iLow(Symbol(), 0, li_0) <= g_ibuf_456[li_0]) DrawArrow(li_0, "up", tColor1, XArwRange, ArrowUp); else { if (FillGapLevel.1 != 0 && iHigh(Symbol(), 0, li_0 + 1) < g_ibuf_436[li_0 + 1] + FillGapLevel.1 * Point && iHigh(Symbol(), 0, li_0) >= g_ibuf_436[li_0] + FillGapLevel.1 * Point) DrawArrow(li_0, "down", tColor4, XArwRange, ArrowDn); else { if (FillGapLevel.1 != 0 && iLow(Symbol(), 0, li_0 + 1) > g_ibuf_456[li_0 + 1] - FillGapLevel.1 * Point && iLow(Symbol(), 0, li_0) <= g_ibuf_456[li_0] - FillGapLevel.1 * Point) DrawArrow(li_0, "up", tColor3, XArwRange, ArrowUp); else { if (FillGapLevel.2 != 0 && iHigh(Symbol(), 0, li_0 + 1) < g_ibuf_436[li_0 + 1] + FillGapLevel.2 * Point && iHigh(Symbol(), 0, li_0) >= g_ibuf_436[li_0] + FillGapLevel.2 * Point) DrawArrow(li_0, "down", tColor6, XArwRange, ArrowDn); else if (FillGapLevel.2 != 0 && iLow(Symbol(), 0, li_0 + 1) > g_ibuf_456[li_0 + 1] - FillGapLevel.2 * Point && iLow(Symbol(), 0, li_0) <= g_ibuf_456[li_0] - FillGapLevel.2 * Point) DrawArrow(li_0, "up", tColor5, XArwRange, ArrowUp); } } } } } } } switch (ShowSR) { case 1: l_text_48 = "S1 to R1 = " + DoubleToStr((NormalizeDouble(g_ibuf_444[0], Digits) - NormalizeDouble(g_ibuf_448[0], Digits)) / Point / gi_216, 0); l_text_56 = "Pivot to R1 = " + DoubleToStr((NormalizeDouble(g_ibuf_444[0], Digits) - NormalizeDouble(g_ibuf_432[0], Digits)) / Point / gi_216, 0); l_text_64 = "Pivot to S1 = " + DoubleToStr((NormalizeDouble(g_ibuf_432[0], Digits) - NormalizeDouble(g_ibuf_448[0], Digits)) / Point / gi_216, 0); break; case 2: l_text_48 = "S2 to R2 = " + DoubleToStr((NormalizeDouble(g_ibuf_440[0], Digits) - NormalizeDouble(g_ibuf_452[0], Digits)) / Point / gi_216, 0); l_text_56 = "Pivot to R2 = " + DoubleToStr((NormalizeDouble(g_ibuf_440[0], Digits) - NormalizeDouble(g_ibuf_432[0], Digits)) / Point / gi_216, 0); l_text_64 = "Pivot to S2 = " + DoubleToStr((NormalizeDouble(g_ibuf_432[0], Digits) - NormalizeDouble(g_ibuf_452[0], Digits)) / Point / gi_216, 0); break; case 3: l_text_48 = "S3 to R3 = " + DoubleToStr((NormalizeDouble(g_ibuf_436[0], Digits) - NormalizeDouble(g_ibuf_456[0], Digits)) / Point / gi_216, 0); l_text_56 = "Pivot to R3 = " + DoubleToStr((NormalizeDouble(g_ibuf_436[0], Digits) - NormalizeDouble(g_ibuf_432[0], Digits)) / Point / gi_216, 0); l_text_64 = "Pivot to S3 = " + DoubleToStr((NormalizeDouble(g_ibuf_432[0], Digits) - NormalizeDouble(g_ibuf_456[0], Digits)) / Point / gi_216, 0); } g_name_228 = "S.R"; ObjectDelete(g_name_228); ObjectCreate(g_name_228, OBJ_LABEL, 0, 0, 0); ObjectSetText(g_name_228, l_text_48, 10, "Arial Bold", tColorTxt); ObjectSet(g_name_228, OBJPROP_CORNER, 3); ObjectSet(g_name_228, OBJPROP_XDISTANCE, 5); ObjectSet(g_name_228, OBJPROP_YDISTANCE, 53); g_name_236 = "PP.R"; ObjectDelete(g_name_236); ObjectCreate(g_name_236, OBJ_LABEL, 0, 0, 0); ObjectSetText(g_name_236, l_text_56, 10, "Arial Bold", tColorTxt); ObjectSet(g_name_236, OBJPROP_CORNER, 3); ObjectSet(g_name_236, OBJPROP_XDISTANCE, 5); ObjectSet(g_name_236, OBJPROP_YDISTANCE, 37); g_name_244 = "S.PP"; ObjectDelete(g_name_244); ObjectCreate(g_name_244, OBJ_LABEL, 0, 0, 0); ObjectSetText(g_name_244, l_text_64, 10, "Arial Bold", tColorTxt); ObjectSet(g_name_244, OBJPROP_CORNER, 3); ObjectSet(g_name_244, OBJPROP_XDISTANCE, 5); ObjectSet(g_name_244, OBJPROP_YDISTANCE, 21); if (HighlightMonday) { l_datetime_76 = TimeCurrent(); ls_80 = "00:00"; ls_88 = "24:00"; for (int l_count_96 = 0; l_count_96 < NumberOfHighlights; l_count_96++) { DrawObjects(l_datetime_76, "Monday" + l_count_96, ls_80, ls_88, TRUE, 1); for (l_datetime_76 = decDateTradeDay(l_datetime_76); TimeDayOfWeek(l_datetime_76) != 1; l_datetime_76 = decDateTradeDay(l_datetime_76)) { } } } return (0); } Alert("Use of this indicator is not authorized on this account!"); return (-1); } void SetPrice(string a_name_0, int a_datetime_8, double a_price_12, color a_color_20) { if (ObjectFind(a_name_0) == -1) { ObjectCreate(a_name_0, OBJ_ARROW, 0, a_datetime_8, a_price_12); ObjectSet(a_name_0, OBJPROP_COLOR, a_color_20); ObjectSet(a_name_0, OBJPROP_WIDTH, 1); ObjectSet(a_name_0, OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE); return; } ObjectSet(a_name_0, OBJPROP_TIME1, a_datetime_8); ObjectSet(a_name_0, OBJPROP_PRICE1, a_price_12); ObjectSet(a_name_0, OBJPROP_COLOR, a_color_20); ObjectSet(a_name_0, OBJPROP_WIDTH, 1); ObjectSet(a_name_0, OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE); } void SetText(string a_name_0, string a_text_8, int a_datetime_16, double a_price_20, color a_color_28) { if (ObjectFind(a_name_0) == -1) { ObjectCreate(a_name_0, OBJ_TEXT, 0, a_datetime_16, a_price_20); ObjectSetText(a_name_0, a_text_8, 9, "Arial", a_color_28); ObjectSet(a_name_0, OBJPROP_YDISTANCE, 20); ObjectSet(a_name_0, OBJPROP_CORNER, 2); return; } ObjectSetText(a_name_0, a_text_8, 9, "Arial", a_color_28); ObjectSet(a_name_0, OBJPROP_TIME1, a_datetime_16); ObjectSet(a_name_0, OBJPROP_PRICE1, a_price_20); ObjectSet(a_name_0, OBJPROP_YDISTANCE, 20); ObjectSet(a_name_0, OBJPROP_CORNER, 2); } void doAlert(string as_0, int ai_8) { string l_str_concat_12; int li_20 = ai_8; if (li_20 == 1) { if (gs_nothing_520 != as_0 || g_time_528 != Time[0]) { gs_nothing_520 = as_0; g_time_528 = Time[0]; l_str_concat_12 = StringConcatenate(Symbol(), as_0, " at ", TimeToStr(TimeLocal(), TIME_SECONDS)); if (alertsMessage) { Alert(l_str_concat_12); Print(l_str_concat_12); if (alertsSound) PlaySound("alert2.wav"); } if (alertsSound) PlaySound("alert2.wav"); if (alertsEmail) SendMail(StringConcatenate(Symbol(), " RSI crossing"), l_str_concat_12); } } } void DrawArrow(int ai_0, string as_4, color a_color_12, int ai_16, int ai_20) { gi_212++; string l_name_24 = "PivotSignal" + pvtType + pvtFormula + GMTShift + gi_212; ObjectCreate(l_name_24, OBJ_ARROW, 0, Time[ai_0], 0); if (as_4 == "up") { ObjectSet(l_name_24, OBJPROP_PRICE1, Low[ai_0] - ai_16 * gd_220); ObjectSet(l_name_24, OBJPROP_ARROWCODE, ai_20); ObjectSet(l_name_24, OBJPROP_COLOR, a_color_12); return; } if (as_4 == "down") { ObjectSet(l_name_24, OBJPROP_PRICE1, High[ai_0] + ai_16 * gd_220); ObjectSet(l_name_24, OBJPROP_ARROWCODE, ai_20); ObjectSet(l_name_24, OBJPROP_COLOR, a_color_12); } } void DeleteArrows() { while (gi_212 > 0) { ObjectDelete("PivotSignal" + pvtType + pvtFormula + GMTShift + gi_212); gi_212--; } } void CreateObjects(string a_name_0, color a_color_8, int a_bool_12) { ObjectCreate(a_name_0, OBJ_RECTANGLE, 0, 0, 0, 0, 0); ObjectSet(a_name_0, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(a_name_0, OBJPROP_COLOR, a_color_8); ObjectSet(a_name_0, OBJPROP_BACK, a_bool_12); } void DeleteObjects() { for (int l_count_0 = 0; l_count_0 < NumberOfHighlights; l_count_0++) { ObjectDelete("Monday" + l_count_0); ObjectDelete("BreakOut1" + l_count_0); ObjectDelete("BreakOut2" + l_count_0); } } int decDateTradeDay(int ai_0) { int li_4 = TimeYear(ai_0); int li_8 = TimeMonth(ai_0); int li_12 = TimeDay(ai_0); int l_hour_16 = TimeHour(ai_0); int l_minute_20 = TimeMinute(ai_0); li_12--; if (li_12 == 0) { li_8--; if (li_8 == 0) { li_4--; li_8 = 12; } if (li_8 == 1 || li_8 == 3 || li_8 == 5 || li_8 == 7 || li_8 == 8 || li_8 == 10 || li_8 == 12) li_12 = 31; if (li_8 == 2) { if (MathMod(li_4, 4) == 0.0) li_12 = 29; else li_12 = 28; } if (li_8 == 4 || li_8 == 6 || li_8 == 9 || li_8 == 11) li_12 = 30; } return (StrToTime(li_4 + "." + li_8 + "." + li_12 + " " + l_hour_16 + ":" + l_minute_20)); } void DrawObjects(int ai_0, string a_name_4, string as_12, string as_20, int a_bool_28, bool ai_32) { double l_high_44; double l_low_52; int l_str2time_36 = StrToTime(TimeToStr(ai_0, TIME_DATE) + " " + as_12); int l_str2time_40 = StrToTime(TimeToStr(ai_0, TIME_DATE) + " " + as_20); int l_shift_60 = iBarShift(NULL, 0, l_str2time_36); int l_shift_64 = iBarShift(NULL, 0, l_str2time_40); if (ai_32) { l_high_44 = WindowPriceMax(); l_low_52 = WindowPriceMin(); } else { l_high_44 = High[iHighest(NULL, 0, MODE_HIGH, l_shift_60 - l_shift_64, l_shift_64)]; l_low_52 = Low[iLowest(NULL, 0, MODE_LOW, l_shift_60 - l_shift_64, l_shift_64)]; } ObjectSet(a_name_4, OBJPROP_TIME1, l_str2time_36); ObjectSet(a_name_4, OBJPROP_PRICE1, l_high_44); ObjectSet(a_name_4, OBJPROP_TIME2, l_str2time_40); ObjectSet(a_name_4, OBJPROP_PRICE2, l_low_52); ObjectSet(a_name_4, OBJPROP_BACK, a_bool_28); } void createLines(int ai_0, string a_name_4, int a_style_12, color a_color_16) { if (ai_0 == 1) ObjectCreate(a_name_4, OBJ_HLINE, 0, 0, Bid); else if (ai_0 == 2) ObjectCreate(a_name_4, OBJ_HLINE, 0, 0, Ask); ObjectSet(a_name_4, OBJPROP_STYLE, a_style_12); ObjectSet(a_name_4, OBJPROP_COLOR, a_color_16); }