//===================================================================// // Transl_TREND_alexcud_v_1-01.mq5 || // Copyright © 2012.05.02, Alexander || // ICQ: 609928564 | email: I-m-hungree@yandex.ru | skype:i_m_hungree || //===================================================================|| // --------------------------- || // The source code information || // --------------------------- || // || // TREND_alexcud v_2MEn.mq4 || // Copyright © 2007, Aleksander Kudimov || // alexcud@rambler.ru ki || //===================================================================\\ #property copyright "Copyright © 2012, Im_hungry" #property version "1.01" #property link "TREND_alexcud_1-01 by Im_hungry" #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 1 //=================================================================// input string Section_1 = "======== General Setting"; input ENUM_TIMEFRAMES TF1 = PERIOD_M15; // TF1 input ENUM_TIMEFRAMES TF2 = PERIOD_H1; // TF2 input ENUM_TIMEFRAMES TF3 = PERIOD_H4; // TF3 input int overPerc = 75; // Percentage for alert input int alertmode = 0; // alertmode 0 off, 1 on input int maTrendPeriodv_1 = 5; // maTrendPeriodv_1 input int maTrendPeriodv_2 = 8; // maTrendPeriodv_2 input int maTrendPeriodv_3 = 13; // maTrendPeriodv_3 input int maTrendPeriodv_4 = 21; // maTrendPeriodv_4 input int maTrendPeriodv_5 = 34; // maTrendPeriodv_5 input bool AlertsOn = false; // Alerting input bool AlertsOnCurrent = true; // Alert on current bar input bool AlertsOnBody = true; // Alert on body color change input bool AlertsMessage = true; // Show alert message input bool AlertsSound = false; // Play alert sound input bool AlertsEmail = false; // Send email message //=================================================================// // global parameters || //=================================================================// color co11v , co41v , co61v, co12v , co42v , co62v, co13v , co43v , co63v, co14v , co44v , co64v, co15v , co45v , co65v; string H11v, H41v, D11v, H12v, H42v, D12v, H13v, H43v, D13v, H14v, H44v, D14v, H15v, H45v, D15v, short_name ="TREND_alexcud"; double acv_TF1[], acv_TF2[], acv_TF3[], MaH11v[], MaH41v[], MaD11v[], MaH12v[], MaH42v[], MaD12v[], MaH13v[], MaH43v[], MaD13v[], MaH14v[], MaH44v[], MaD14v[], MaH15v[], MaH45v[], MaD15v[], uitot[], ditot[], u1x5v, u1x8v, u1x13v, u1x21v, u1x34v, u2x5v, u2x8v, u2x13v, u2x21v, u2x34v, u3x5v, u3x8v, u3x13v, u3x21v, u3x34v, u1acv, u2acv, u3acv, d1x5v, d1x8v, d1x13v, d1x21v, d1x34v, d2x5v, d2x8v, d2x13v, d2x21v, d2x34v, d3x5v, d3x8v, d3x13v, d3x21v, d3x34v, d1acv, d2acv, d3acv; int handle_MaH11v, handle_MaH41v, handle_MaD11v, handle_MaH12v, handle_MaH42v, handle_MaD12v, handle_MaH13v, handle_MaH43v, handle_MaD13v, handle_MaH14v, handle_MaH44v, handle_MaD14v, handle_MaH15v, handle_MaH45v, handle_MaD15v, handle_acv_TF1, handle_acv_TF2, handle_acv_TF3; //=================================================================// // Custom indicator initialization function || //=================================================================// int OnInit() { handle_MaH11v = iMA (Symbol(), TF1, maTrendPeriodv_1, 0, MODE_SMA, PRICE_CLOSE); handle_MaH12v = iMA (Symbol(), TF1, maTrendPeriodv_2, 0, MODE_SMA, PRICE_CLOSE); handle_MaH13v = iMA (Symbol(), TF1, maTrendPeriodv_3, 0, MODE_SMA, PRICE_CLOSE); handle_MaH14v = iMA (Symbol(), TF1, maTrendPeriodv_4, 0, MODE_SMA, PRICE_CLOSE); handle_MaH15v = iMA (Symbol(), TF1, maTrendPeriodv_5, 0, MODE_SMA, PRICE_CLOSE); handle_MaH41v = iMA (Symbol(), TF2, maTrendPeriodv_1, 0, MODE_SMA, PRICE_CLOSE); handle_MaH42v = iMA (Symbol(), TF2, maTrendPeriodv_2, 0, MODE_SMA, PRICE_CLOSE); handle_MaH43v = iMA (Symbol(), TF2, maTrendPeriodv_3, 0, MODE_SMA, PRICE_CLOSE); handle_MaH44v = iMA (Symbol(), TF2, maTrendPeriodv_4, 0, MODE_SMA, PRICE_CLOSE); handle_MaH45v = iMA (Symbol(), TF2, maTrendPeriodv_5, 0, MODE_SMA, PRICE_CLOSE); handle_MaD11v = iMA (Symbol(), TF3, maTrendPeriodv_1, 0, MODE_SMA, PRICE_CLOSE); handle_MaD12v = iMA (Symbol(), TF3, maTrendPeriodv_2, 0, MODE_SMA, PRICE_CLOSE); handle_MaD13v = iMA (Symbol(), TF3, maTrendPeriodv_3, 0, MODE_SMA, PRICE_CLOSE); handle_MaD14v = iMA (Symbol(), TF3, maTrendPeriodv_4, 0, MODE_SMA, PRICE_CLOSE); handle_MaD15v = iMA (Symbol(), TF3, maTrendPeriodv_5, 0, MODE_SMA, PRICE_CLOSE); handle_acv_TF1 = iAC (Symbol(), TF1); handle_acv_TF2 = iAC (Symbol(), TF2); handle_acv_TF3 = iAC (Symbol(), TF3); if (handle_MaH11v < 0 || handle_MaH12v < 0 || handle_MaH13v < 0 || handle_MaH14v < 0 || handle_MaH15v < 0 || handle_MaH41v < 0 || handle_MaH42v < 0 || handle_MaH43v < 0 || handle_MaH44v < 0 || handle_MaH45v < 0 || handle_MaD11v < 0 || handle_MaD12v < 0 || handle_MaD13v < 0 || handle_MaD14v < 0 || handle_MaD15v < 0 || handle_acv_TF1 < 0 || handle_acv_TF2 < 0 || handle_acv_TF3 < 0) { Alert (" wrong load MA indicator "); return(-1); } //------ return(0); } //=================================================================// // delete || //=================================================================// void OnDeinit(const int reason) { IndicatorRelease(handle_MaH11v); IndicatorRelease(handle_MaH12v); IndicatorRelease(handle_MaH13v); IndicatorRelease(handle_MaH14v); IndicatorRelease(handle_MaH15v); IndicatorRelease(handle_MaH41v); IndicatorRelease(handle_MaH42v); IndicatorRelease(handle_MaH43v); IndicatorRelease(handle_MaH44v); IndicatorRelease(handle_MaH45v); IndicatorRelease(handle_MaD11v); IndicatorRelease(handle_MaD12v); IndicatorRelease(handle_MaD13v); IndicatorRelease(handle_MaD14v); IndicatorRelease(handle_MaD15v); IndicatorRelease(handle_acv_TF1); IndicatorRelease(handle_acv_TF2); IndicatorRelease(handle_acv_TF3); } //=================================================================// // Custom indicator iteration function || //=================================================================// int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //---- declarations of local variables for (int i=(int)MathMax(prev_calculated-1,0); i MaH11v[i+1]) { H11v = " /\\ "; co11v = Blue; u1x5v = 1; d1x5v = 0; } if (MaH11v[i] == MaH11v[i+1]) { H11v = " 0 "; co11v = Green; u1x5v = 0; d1x5v = 0; } if (MaH41v[i] < MaH41v[i+1]) { H41v = " V "; co41v = Red; u2x5v = 0; d2x5v = 1; } if (MaH41v[i] > MaH41v[i+1]) { H41v = " /\\ "; co41v = Blue; u2x5v = 1; d2x5v = 0; } if (MaH41v[i] == MaH41v[i+1]) { H41v = " 0 "; co41v = Green; u2x5v = 0; d2x5v = 0; } if (MaD11v[i] < MaD11v[i+1]) { D11v = " V "; co61v = Red; u3x5v = 0; d3x5v = 1; } if (MaD11v[i] > MaD11v[i+1]) { D11v = " /\\ "; co61v = Blue; u3x5v = 1; d3x5v = 0; } if (MaD11v[i] == MaD11v[i+1]) { D11v = " 0 "; co61v = Green; u3x5v = 0; d3x5v = 0; } //--- if (MaH12v[i] < MaH12v[i+1]) { H12v = " V "; co12v = Red; u1x8v = 0; d1x8v = 1; } if (MaH12v[i] > MaH12v[i+1]) { H12v = " /\\ "; co12v = Blue; u1x8v = 1; d1x8v = 0; } if (MaH12v[i] == MaH12v[i+1]) { H12v = " 0 "; co12v = Green; u1x8v = 0; d1x8v = 0; } if (MaH42v[i] < MaH42v[i+1]) { H42v = " V "; co42v = Red; u2x8v = 0; d2x8v = 1; } if (MaH42v[i] > MaH42v[i+1]) { H42v = " /\\ "; co42v = Blue; u2x8v = 1; d2x8v = 0; } if (MaH42v[i] == MaH42v[i+1]) { H42v = " 0 "; co42v = Green; u2x8v = 0; d2x8v = 0; } if (MaD12v[i] < MaD12v[i+1]) { D12v = " V "; co62v = Red; u3x8v = 0; d3x8v = 1; } if (MaD12v[i] > MaD12v[i+1]) { D12v = " /\\ "; co62v = Blue; u3x8v = 1; d3x8v = 0; } if (MaD12v[i] == MaD12v[i+1]) { D12v = " 0 "; co62v = Green; u3x8v = 0; d3x8v = 0; } //--- if (MaH13v[i] < MaH13v[i+1]) { H13v = " V "; co13v = Red; u1x13v = 0; d1x13v = 1; } if (MaH13v[i] > MaH13v[i+1]) { H13v = " /\\ "; co13v = Blue; u1x13v = 1; d1x13v = 0; } if (MaH13v[i] == MaH13v[i+1]) { H13v = " 0 "; co13v = Green; u1x13v = 0; d1x13v = 0; } if (MaH43v[i] < MaH43v[i+1]) { H43v = " V "; co43v = Red; u2x13v = 0; d2x13v = 1; } if (MaH43v[i] > MaH43v[i+1]) { H43v = " /\\ "; co43v = Blue; u2x13v = 1; d2x13v = 0; } if (MaH43v[i] == MaH43v[i+1]) { H43v = " 0 "; co43v = Green; u2x13v = 0; d2x13v = 0; } if (MaD13v[i] < MaD13v[i+1]) { D13v = " V "; co63v = Red; u3x13v = 0; d3x13v = 1; } if (MaD13v[i] > MaD13v[i+1]) { D13v = " /\\ "; co63v = Blue; u3x13v = 1; d3x13v = 0; } if (MaD13v[i] == MaD13v[i+1]) { D13v = " 0 "; co63v = Green; u3x13v = 0; d3x13v = 0; } //--- if (MaH14v[i] < MaH14v[i+1]) { H14v = " V "; co14v = Red; u1x21v = 0; d1x21v = 1; } if (MaH14v[i] > MaH14v[i+1]) { H14v = " /\\ "; co14v = Blue; u1x21v = 1; d1x21v = 0; } if (MaH14v[i] == MaH14v[i+1]) { H14v = " 0 "; co14v = Green; u1x21v = 0; d1x21v = 0; } if (MaH44v[i] < MaH44v[i+1]) { H44v = " V "; co44v = Red; u2x21v = 0; d2x21v = 1; } if (MaH44v[i] > MaH44v[i+1]) { H44v = " /\\ "; co44v = Blue; u2x21v = 1; d2x21v = 0; } if (MaH44v[i] == MaH44v[i+1]) { H44v = " 0 "; co44v = Green; u2x21v = 0; d2x21v = 0; } if (MaD14v[i] < MaD14v[i+1]) { D14v = " V "; co64v = Red; u3x21v = 0; d3x21v = 1; } if (MaD14v[i] > MaD14v[i+1]) { D14v = " /\\ "; co64v = Blue; u3x21v = 1; d3x21v = 0; } if (MaD14v[i] == MaD14v[i+1]) { D14v = " 0 "; co64v = Green; u3x21v = 0; d3x21v = 0; } //--- if (MaH15v[i] < MaH15v[i+1]) { H15v = " V "; co15v = Red; u1x34v = 0; d1x34v = 1; } if (MaH15v[i] > MaH15v[i+1]) { H15v = " /\\ "; co15v = Blue; u1x34v = 1; d1x34v = 0; } if (MaH15v[i] == MaH15v[i+1]) { H15v = " 0 "; co15v = Green; u1x34v = 0; d1x34v = 0; } if (MaH45v[i] < MaH45v[i+1]) { H45v = " V "; co45v = Red; u2x34v = 0; d2x34v = 1; } if (MaH45v[i] > MaH45v[i+1]) { H45v = " /\\ "; co45v = Blue; u2x34v = 1; d2x34v = 0; } if (MaH45v[i] == MaH45v[i+1]) { H45v = " 0 "; co45v = Green; u2x34v = 0; d2x34v = 0; } if (MaD15v[i] < MaD15v[i+1]) { D15v = " V "; co65v = Red; u3x34v = 0; d3x34v = 1; } if (MaD15v[i] > MaD15v[i+1]) { D15v = " /\\ "; co65v = Blue; u3x34v = 1; d3x34v = 0; } if (MaD15v[i] == MaD15v[i+1]) { D15v = " 0 "; co65v = Green; u3x34v = 0; d3x34v = 0; } //================== //------- ObjectSetString (0, "label_object1v", OBJPROP_TEXT, "TF1:"+(string)Find_tf(TF1)+""); ObjectSetInteger(0, "label_object1v", OBJPROP_FONTSIZE, 8); ObjectSetString (0, "label_object1v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "label_object1v", OBJPROP_COLOR, Lime); ObjectSetString (0, "label_object2v", OBJPROP_TEXT, "TF2:"+(string)Find_tf(TF2)+""); ObjectSetInteger(0, "label_object2v", OBJPROP_FONTSIZE, 8); ObjectSetString (0, "label_object2v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "label_object2v", OBJPROP_COLOR, Lime); ObjectSetString (0, "label_object3v", OBJPROP_TEXT, "TF3:"+(string)Find_tf(TF3)+""); ObjectSetInteger(0, "label_object3v", OBJPROP_FONTSIZE, 8); ObjectSetString (0, "label_object3v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "label_object3v", OBJPROP_COLOR, Lime); //--- ObjectSetString (0, "H11v", OBJPROP_TEXT, H11v); ObjectSetInteger(0, "H11v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "H11v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "H11v", OBJPROP_COLOR, co11v); ObjectSetString (0, "H12v", OBJPROP_TEXT, H12v); ObjectSetInteger(0, "H12v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "H12v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "H12v", OBJPROP_COLOR, co12v); ObjectSetString (0, "H13v", OBJPROP_TEXT, H13v); ObjectSetInteger(0, "H13v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "H13v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "H13v", OBJPROP_COLOR, co13v); ObjectSetString (0, "H14v", OBJPROP_TEXT, H14v); ObjectSetInteger(0, "H14v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "H14v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "H14v", OBJPROP_COLOR, co14v); ObjectSetString (0, "H15v", OBJPROP_TEXT, H15v); ObjectSetInteger(0, "H15v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "H15v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "H15v", OBJPROP_COLOR, co15v); //--- ObjectSetString (0, "H41v", OBJPROP_TEXT, H41v); ObjectSetInteger(0, "H41v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "H41v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "H41v", OBJPROP_COLOR, co41v); ObjectSetString (0, "H42v", OBJPROP_TEXT, H42v); ObjectSetInteger(0, "H42v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "H42v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "H42v", OBJPROP_COLOR, co42v); ObjectSetString (0, "H43v", OBJPROP_TEXT, H43v); ObjectSetInteger(0, "H43v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "H43v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "H43v", OBJPROP_COLOR, co43v); ObjectSetString (0, "H44v", OBJPROP_TEXT, H44v); ObjectSetInteger(0, "H44v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "H44v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "H44v", OBJPROP_COLOR, co44v); ObjectSetString (0, "H45v", OBJPROP_TEXT, H45v); ObjectSetInteger(0, "H45v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "H45v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "H45v", OBJPROP_COLOR, co45v); //--- ObjectSetString (0, "D11v", OBJPROP_TEXT, D11v); ObjectSetInteger(0, "D11v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "D11v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "D11v", OBJPROP_COLOR, co61v); ObjectSetString (0, "D12v", OBJPROP_TEXT, D12v); ObjectSetInteger(0, "D12v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "D12v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "D12v", OBJPROP_COLOR, co62v); ObjectSetString (0, "D13v", OBJPROP_TEXT, D13v); ObjectSetInteger(0, "D13v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "D13v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "D13v", OBJPROP_COLOR, co63v); ObjectSetString (0, "D14v", OBJPROP_TEXT, D14v); ObjectSetInteger(0, "D14v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "D14v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "D14v", OBJPROP_COLOR, co64v); ObjectSetString (0, "D15v", OBJPROP_TEXT, D15v); ObjectSetInteger(0, "D15v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "D15v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "D15v", OBJPROP_COLOR, co65v); //================== //------- if(ObjectCreate(0, "ACv", OBJ_LABEL, ChartWindowFind(), 0, 0)) { ObjectSetString (0, "ACv", OBJPROP_TEXT, "AC"); ObjectSetInteger(0, "ACv", OBJPROP_FONTSIZE, 9); ObjectSetString (0, "ACv", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "ACv", OBJPROP_COLOR, Lime); ObjectSetInteger(0, "ACv", OBJPROP_XDISTANCE, 220); ObjectSetInteger(0, "ACv", OBJPROP_YDISTANCE, 20); } string ach11v; color acco11v; if ((acv_TF1[i+1] > acv_TF1[i+2] && acv_TF1[i+2] > acv_TF1[i+3] && acv_TF1[i] < 0 && acv_TF1[i] > acv_TF1[i+1]) || (acv_TF1[i] > acv_TF1[i+1] && acv_TF1[i+1] > acv_TF1[i+2] && acv_TF1[i] > 0)) { ach11v = "/\\ "; acco11v = Blue; u1acv = 3; d1acv = 0; } if ((acv_TF1[i+1] < acv_TF1[i+2] && acv_TF1[i+2] < acv_TF1[i+3] && acv_TF1[i] > 0 && acv_TF1[i] < acv_TF1[i+1]) || (acv_TF1[i] < acv_TF1[i+1] && acv_TF1[i+1] < acv_TF1[i+2] && acv_TF1[i] < 0)) { ach11v = "V "; acco11v = Red; u1acv = 0; d1acv = 3; } if ((((acv_TF1[i+1] < acv_TF1[i+2] || acv_TF1[i+2] < acv_TF1[i+3]) && acv_TF1[i] < 0 && acv_TF1[i] > acv_TF1[i+1]) || (acv_TF1[i] > acv_TF1[i+1] && acv_TF1[i+1] < acv_TF1[i+2] && acv_TF1[i] > 0)) || (((acv_TF1[i+1] > acv_TF1[i+2] || acv_TF1[i+2] > acv_TF1[i+3]) && acv_TF1[i] > 0 && acv_TF1[i] < acv_TF1[i+1]) || (acv_TF1[i] < acv_TF1[i+1] && acv_TF1[i+1] > acv_TF1[i+2] && acv_TF1[i] <0 ))) { ach11v = "0 "; acco11v = Green; u1acv = 0; d1acv = 0; } //================== //------- if(ObjectCreate(0, "AC11v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { ObjectSetString (0, "AC11v", OBJPROP_TEXT, ach11v); ObjectSetInteger(0, "AC11v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "AC11v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "AC11v", OBJPROP_COLOR, acco11v); ObjectSetInteger(0, "AC11v", OBJPROP_XDISTANCE, 220); ObjectSetInteger(0, "AC11v", OBJPROP_YDISTANCE, 35); } string ach13v; color acco13v; if ((acv_TF3[i+1] > acv_TF3[i+2] && acv_TF3[i+2] > acv_TF3[i+3] && acv_TF3[i] < 0 && acv_TF3[i] > acv_TF3[i+1]) || (acv_TF3[i] > acv_TF3[i+1] && acv_TF3[i+1] > acv_TF3[i+2] && acv_TF3[i] > 0)) { ach13v = "/\\ "; acco13v = Blue; u3acv = 3; d3acv = 0; } if ((acv_TF3[i+1] < acv_TF3[i+2] && acv_TF3[i+2] < acv_TF3[i+3] && acv_TF3[i] > 0 && acv_TF3[i] < acv_TF3[i+1]) || (acv_TF3[i] < acv_TF3[i+1] && acv_TF3[i+1] < acv_TF3[i+2] && acv_TF3[i] < 0)) { ach13v = "V "; acco13v = Red; u3acv = 0; d3acv = 3; } if ((((acv_TF3[i+1] < acv_TF3[i+2] || acv_TF3[i+2] < acv_TF3[i+3]) && acv_TF3[i] < 0 && acv_TF3[i] > acv_TF3[i+1]) || (acv_TF3[i] > acv_TF3[i+1] && acv_TF3[i+1] < acv_TF3[i+2] && acv_TF3[i] > 0)) || (((acv_TF3[i+1] > acv_TF3[i+2] || acv_TF3[i+2] > acv_TF3[i+3]) && acv_TF3[i] > 0 && acv_TF3[i] < acv_TF3[i+1]) || (acv_TF3[i] < acv_TF3[i+1] && acv_TF3[i+1] > acv_TF3[i+2] && acv_TF3[i] < 0))) { ach13v = "0 "; acco13v = Green; u3acv = 0; d3acv = 0; } //================== //------- if(ObjectCreate(0, "AC13v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { ObjectSetString (0, "AC13v", OBJPROP_TEXT, ach13v); ObjectSetInteger(0, "AC13v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "AC13v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "AC13v", OBJPROP_COLOR, acco13v); ObjectSetInteger(0, "AC13v", OBJPROP_XDISTANCE, 220); ObjectSetInteger(0, "AC13v", OBJPROP_YDISTANCE, 75); } string ach12v; color acco12v; if ((acv_TF2[i+1] > acv_TF2[i+2] && acv_TF2[i+2] > acv_TF2[i+3] && acv_TF2[i] < 0 && acv_TF2[i] > acv_TF2[i+1]) || (acv_TF2[i] > acv_TF2[i+1] && acv_TF2[i+1] > acv_TF2[i+2] && acv_TF2[i] > 0)) { ach12v = "/\\" ; acco12v = Blue; u2acv = 3; d2acv = 0; } if ((acv_TF2[i+1] < acv_TF2[i+2] && acv_TF2[i+2] < acv_TF2[i+3] && acv_TF2[i] > 0 && acv_TF2[i] < acv_TF2[i+1]) || (acv_TF2[i] < acv_TF2[i+1] && acv_TF2[i+1] < acv_TF2[i+2] && acv_TF2[i] < 0)) { ach12v = "V "; acco12v = Red; u2acv = 0; d2acv = 3; } if ((((acv_TF2[i+1] < acv_TF2[i+2] || acv_TF2[i+2] < acv_TF2[i+3]) && acv_TF2[i] < 0 && acv_TF2[i] > acv_TF2[i+1]) || (acv_TF2[i] > acv_TF2[i+1] && acv_TF2[i+1] < acv_TF2[i+2] && acv_TF2[i] > 0))|| (((acv_TF2[i+1] > acv_TF2[i+2] || acv_TF2[i+2] > acv_TF2[i+3]) && acv_TF2[i] > 0 && acv_TF2[i] < acv_TF2[i+1]) || (acv_TF2[i] < acv_TF2[i+1] && acv_TF2[i+1] > acv_TF2[i+2] && acv_TF2[i] < 0))) { ach12v = "0 "; acco12v = Green; u2acv = 0; d2acv = 0; } //================== //------- if(ObjectCreate(0, "AC12v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { ObjectSetString (0, "AC12v", OBJPROP_TEXT, ach12v); ObjectSetInteger(0, "AC12v", OBJPROP_FONTSIZE, 11); ObjectSetString (0, "AC12v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "AC12v", OBJPROP_COLOR, acco12v); ObjectSetInteger(0, "AC12v", OBJPROP_XDISTANCE, 220); ObjectSetInteger(0, "AC12v", OBJPROP_YDISTANCE, 55); } if(ObjectCreate(0, "rezv", OBJ_LABEL, ChartWindowFind(), 0, 0)) { ObjectSetString (0, "rezv", OBJPROP_TEXT, "RESULTS"); ObjectSetInteger(0, "rezv", OBJPROP_FONTSIZE, 9); ObjectSetString (0, "rezv", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "rezv", OBJPROP_COLOR, Lime); ObjectSetInteger(0, "rezv", OBJPROP_XDISTANCE, 260); ObjectSetInteger(0, "rezv", OBJPROP_YDISTANCE, 20); } //================== //------- double uitog1v = (u1x5v + u1x8v + u1x13v + u1x21v + u1x34v + u1acv) * 12.5, uitog2v = (u2x5v + u2x8v + u2x13v + u2x21v + u2x34v + u2acv) * 12.5, uitog3v = (u3x5v + u3x8v + u3x13v + u3x21v + u3x34v + u3acv) * 12.5, ditog1v = (d1x5v + d1x8v + d1x13v + d1x21v + d1x34v + d1acv) * 12.5, ditog2v = (d2x5v + d2x8v + d2x13v + d2x21v + d2x34v + d2acv) * 12.5, ditog3v = (d3x5v + d3x8v + d3x13v + d3x21v + d3x34v + d3acv) * 12.5; string hr1v, hr2v, hr3v, dhr1v, dhr2v, dhr3v; if (uitog1v > ditog1v) { hr1v = "Arial Black"; dhr1v = "Arial";} if (uitog1v < ditog1v) { hr1v = "Arial"; dhr1v = "Arial Black";} if (uitog1v == ditog1v) { hr1v = "Arial"; dhr1v = "Arial";} if (uitog2v > ditog2v) { hr2v = "Arial Black"; dhr2v = "Arial";} if (uitog2v < ditog2v) { hr2v = "Arial"; dhr2v = "Arial Black";} if (uitog2v == ditog2v) { hr2v = "Arial"; dhr2v = "Arial";} if (uitog3v > ditog3v) { hr3v = "Arial Black"; dhr3v = "Arial";} if (uitog3v < ditog3v) { hr3v = "Arial"; dhr3v = "Arial Black";} if (uitog3v == ditog3v) { hr3v = "Arial"; dhr3v = "Arial";} //================== //------- string conc; if(ObjectCreate(0, "uitog1v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { StringConcatenate(conc, "/\\ ", uitog1v, "%"); ObjectSetString (0, "uitog1v", OBJPROP_TEXT, conc); ObjectSetInteger(0, "uitog1v", OBJPROP_FONTSIZE, 12); ObjectSetString (0, "uitog1v", OBJPROP_FONT, hr1v); ObjectSetInteger(0, "uitog1v", OBJPROP_COLOR, DodgerBlue); ObjectSetInteger(0, "uitog1v", OBJPROP_XDISTANCE, 260); ObjectSetInteger(0, "uitog1v", OBJPROP_YDISTANCE, 35); } if(ObjectCreate(0, "uitog2v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { StringConcatenate(conc, "/\\ ",uitog2v, "%"); ObjectSetString (0, "uitog2v", OBJPROP_TEXT, conc); ObjectSetInteger(0, "uitog2v", OBJPROP_FONTSIZE, 12); ObjectSetString (0, "uitog2v", OBJPROP_FONT, hr2v); ObjectSetInteger(0, "uitog2v", OBJPROP_COLOR, DodgerBlue); ObjectSetInteger(0, "uitog2v", OBJPROP_XDISTANCE, 260); ObjectSetInteger(0, "uitog2v", OBJPROP_YDISTANCE, 55); } if(ObjectCreate(0, "uitog3v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { StringConcatenate(conc, "/\\ ",uitog3v, "%"); ObjectSetString (0, "uitog3v", OBJPROP_TEXT, conc); ObjectSetInteger(0, "uitog3v", OBJPROP_FONTSIZE, 12); ObjectSetString (0, "uitog3v", OBJPROP_FONT, hr3v); ObjectSetInteger(0, "uitog3v", OBJPROP_COLOR, DodgerBlue); ObjectSetInteger(0, "uitog3v", OBJPROP_XDISTANCE, 260); ObjectSetInteger(0, "uitog3v", OBJPROP_YDISTANCE, 75); } if(ObjectCreate(0, "ditog1v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { StringConcatenate(conc, "\\/ ",ditog1v, "%"); ObjectSetString (0, "ditog1v", OBJPROP_TEXT, conc); ObjectSetInteger(0, "ditog1v", OBJPROP_FONTSIZE, 12); ObjectSetString (0, "ditog1v", OBJPROP_FONT, dhr1v); ObjectSetInteger(0, "ditog1v", OBJPROP_COLOR, Red); ObjectSetInteger(0, "ditog1v", OBJPROP_XDISTANCE, 340); ObjectSetInteger(0, "ditog1v", OBJPROP_YDISTANCE, 35); } if(ObjectCreate(0, "ditog2v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { StringConcatenate(conc, "\\/ ",ditog2v, "%"); ObjectSetString (0, "ditog2v", OBJPROP_TEXT, conc); ObjectSetInteger(0, "ditog2v", OBJPROP_FONTSIZE, 12); ObjectSetString (0, "ditog2v", OBJPROP_FONT, dhr2v); ObjectSetInteger(0, "ditog2v", OBJPROP_COLOR, Red); ObjectSetInteger(0, "ditog2v", OBJPROP_XDISTANCE, 340); ObjectSetInteger(0, "ditog2v", OBJPROP_YDISTANCE, 55); } if(ObjectCreate(0, "ditog3v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { StringConcatenate(conc, "\\/ ",ditog3v, "%"); ObjectSetString (0, "ditog3v", OBJPROP_TEXT, conc); ObjectSetInteger(0, "ditog3v", OBJPROP_FONTSIZE, 12); ObjectSetString (0, "ditog3v", OBJPROP_FONT, dhr3v); ObjectSetInteger(0, "ditog3v", OBJPROP_COLOR, Red); ObjectSetInteger(0, "ditog3v", OBJPROP_XDISTANCE, 340); ObjectSetInteger(0, "ditog3v", OBJPROP_YDISTANCE, 75); } //================== //------- string txtv; if (uitog1v > 50 && uitog2v > 50 && uitog3v > 50) txtv = "Not bad moment to open position BUY"; else txtv = "Not recommended to open position. WAIT."; if (ditog1v > 50 && ditog2v > 50 && ditog3v > 50) txtv = "Not bad moment to open position SELL"; if (uitog1v >= 75 && uitog2v >= 75 && uitog3v >= 75) txtv = "GOOD moment to open position BUY"; if (ditog1v >= 75 && ditog2v >= 75 && ditog3v >= 75) txtv = "GOOD moment to open position SELL"; if(ObjectCreate(0, "txtv", OBJ_LABEL, ChartWindowFind(), 0, 0)) { ObjectSetString (0, "txtv", OBJPROP_TEXT, txtv); ObjectSetInteger(0, "txtv", OBJPROP_FONTSIZE, 14); ObjectSetString (0, "txtv", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "txtv", OBJPROP_COLOR, Lime); ObjectSetInteger(0, "txtv", OBJPROP_XDISTANCE, 450); ObjectSetInteger(0, "txtv", OBJPROP_YDISTANCE, 55); } if(ObjectCreate(0, "txt2v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { ObjectSetString (0, "txt2v", OBJPROP_TEXT, "multitimeframe indicator \Transl_TREND_alexcud"); ObjectSetInteger(0, "txt2v", OBJPROP_FONTSIZE, 7); ObjectSetString (0, "txt2v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "txt2v", OBJPROP_COLOR, DarkSlateGray); ObjectSetInteger(0, "txt2v", OBJPROP_XDISTANCE, 11); ObjectSetInteger(0, "txt2v", OBJPROP_YDISTANCE, 100); } if(ObjectCreate(0, "txt3v", OBJ_LABEL, ChartWindowFind(), 0, 0)) { ObjectSetString (0, "txt3v", OBJPROP_TEXT, "Copyright © 2012 Transl_TREND_alexcud"); ObjectSetInteger(0, "txt3v", OBJPROP_FONTSIZE, 7); ObjectSetString (0, "txt3v", OBJPROP_FONT, "Verdana"); ObjectSetInteger(0, "txt3v", OBJPROP_COLOR, DarkSlateGray); ObjectSetInteger(0, "txt3v", OBJPROP_XDISTANCE, 450); ObjectSetInteger(0, "txt3v", OBJPROP_YDISTANCE, 100); } uitot[0]=(uitog1v+uitog2v+uitog3v)/3; ditot[0]=(ditog1v+ditog2v+ditog3v)/3; } manageAlerts(rates_total,time); return(rates_total); } //------------------------------------------------------------------- // //------------------------------------------------------------------- // // // // // void manageAlerts(int bars,const datetime& atime[]) { if (AlertsOn) { int whichBar = 0; if (!AlertsOnCurrent) whichBar = 1; whichBar = bars-whichBar-1; datetime time = atime[whichBar]; // // // // // if (uitot[whichBar] != uitot[whichBar-1] && AlertsOnBody) { static datetime time1 = 0; static string mess1 = ""; if (uitot[whichBar] >= 75) doAlert(time1,mess1,time," Alexcud changed to up"); } if (ditot[whichBar] != ditot[whichBar-1] && AlertsOnBody) { static datetime time2 = 0; static string mess2 = ""; if (ditot[whichBar] >= 75) doAlert(time2,mess2,time," Alexcud changed to down"); } } } // // // // // void doAlert(datetime& previousTime, string& previousAlert,datetime time, string doWhat) { string message; if (previousAlert != doWhat || previousTime != time) { previousAlert = doWhat; previousTime = time; // // // // // message = Symbol()+" at "+TimeToString(TimeLocal(),TIME_SECONDS)+doWhat; if (AlertsMessage) Alert(message); if (AlertsEmail) SendMail(Symbol()+" Trend Alexcud",message); if (AlertsSound) PlaySound("alert2.wav"); } } //=================================================================// // Find_tf || //=================================================================// int Find_tf(ENUM_TIMEFRAMES tf) { switch(tf) { case PERIOD_M1: return(1); case PERIOD_M2: return(2); case PERIOD_M3: return(3); case PERIOD_M4: return(4); case PERIOD_M5: return(5); case PERIOD_M6: return(6); case PERIOD_M10: return(10); case PERIOD_M12: return(12); case PERIOD_M15: return(15); case PERIOD_M30: return(30); case PERIOD_H1: return(60); case PERIOD_H2: return(120); case PERIOD_H3: return(180); case PERIOD_H4: return(240); case PERIOD_H6: return(360); case PERIOD_H8: return(480); case PERIOD_H12: return(720); case PERIOD_D1: return(1440); case PERIOD_W1: return(10080); case PERIOD_MN1: return(43200); default: return(0); } }