Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Alert when price hits line | Forex Indicators Download - MT4/MT5 Resources | MT4/MT5 Downloads - MetaTrader 5 Resources

author EAcpu | 5 reads | 0 comments |
  1. SignalLINES indicator description translation The SignalLINES indicator sends an alert when the price touches a line drawn by the trader himself. The name of the line must be entered in the "NaneLine" parameter of the indicator. If you need to signal several lines at the same time, you can set up multiple indicator instances and assign different lines to each instance. Lines can be of any type, including trend lines or horizontal lines. When the price crosses the line, the indicator emits a signal and displays the name of the line. Your task is to make a decision based on this signal and enter the market. There is a similar Expert Advisor (EA) that places orders directly from the market when the price crosses the corresponding line. Functional analysis input parameters: A parameter NaneLine is required to specify the name of the line. Signal trigger: When the price touches or crosses the specified line, an alert (Alert) is issued. Multi-line support: Support for multiple lines via multiple indicator instances. 2. cm SignalLines L indicator description translation cm SignalLines L indicator immediately constructs two trend lines above and below the current price. You can adjust these lines to where you want them. When the price crosses the line, the indicator redraws the entire tool window to the color specified in the parameters. This way, you can view the status of multiple tools at the same time. If there are open trades in the account, the window color will change to green. All colors can be selected in parameters. Functional analysis automatically draws: two trend lines are generated above and below the current price. Manual adjustment: The trader can drag the line to the desired position. Cross signal: Changes the window color when the price crosses the line. Transaction status: Check whether there are open orders, and the window color turns green. Custom color: supports parameter setting color. Output: Displays the names of the crossing lines. cpp //+------------------------------------------------------------------+ //| AlertLine.mq4 | //| Copyright © 2024,eawalk.com | //| http://eawalk.com | //| Send a signal if the price touches the line | //+------------------------------------------------------------------+ #property copyright "Copyright © 2024 eawalk.com" #property link "http://eawalk.com" #property indicator_chart_window //+------------------------------------------------------------------+ extern string line name = "Line"; // Line name //+----------------------------------------------------------------------------------+ int start() { double price; string prompt text; // Check whether there is a line with the specified name if (ObjectFind(line name) == -1) { prompt text = StringConcatenate("Line not found", line name, "nPlease use MT's tools to draw a trend line and name it ", line name); } else { // Get the price of the current line price = NormalizeDouble(ObjectGetValueByShift(line name, 0), Digits); // Determine whether the current price touches the line if (NormalizeDouble(Bid, Digits) == price) { Prompt text = StringConcatenate("Price touches the line", line name, "in", TimeToStr(TimeCurrent(), TIME_DATE | TIME_SECONDS)); Alert(prompt text); //Send an alert} else {Alert text = StringConcatenate(prompt text, "distance line'", line name, "' and", DoubleToStr(MathAbs((Bid - price) / Point), 0), "point n"); } } // Display prompt information on the chart Comment(prompt text); return(0); } //+--------------------------------------------------------------------------------+ Second //+--------------------------------------------------------------------------------+ //| signallength.mq4 | //| Support and resistance line signal indicator | //+------------------------------------------------------------------+ #property copyright "Copyright © 2024, eawalk.com" #property link "eawalk.com" extern color background color = clrNONE; // chart background color extern color resistance line color = clrOrange; // resistance line color extern color resistance background color = clrBisque; // Background color when the resistance line touches extern color Support line color = clrAqua; // Support line color extern color Support background color = clrLightCyan; // Background color when the support line touches extern color Order color = clrLime; // Background color when there is an order extern int Offset setting = 10; // Offset setting of line and price (unit: multiple) int Current period; // Current chart period #property indicator_chart_window int unused count = 0; // Unused count variable //+------------------------------------------------------------------+ //| Indicator initialization function | //+------------------------------------------------------------------+ int OnInit(void) { // If background color is specified, it is applied to the chart if (background color!= clrNONE) ChartSetInteger(0, CHART_COLOR_BACKGROUND, background color); background color = ChartGetInteger(0, CHART_COLOR_BACKGROUND); // Get the current background color current period = Period(); // Get the current chart period return(INIT_SUCCEEDED); } //+--------------------------------------------------------------------------------+ //| Indicator deinitialization function | //+--------------------------------------------------------------------------------+ void OnDeinit(const int reason) { // Delete the drawn line when the reason is not parameter adjustment, chart switching or recompiling if (reason != REASON_PARAMETERS && reason != REASON_CHARTCHANGE && reason != REASON_RECOMPILE) { ObjectDelete("Resistance Boundary"); ObjectDelete("Support Boundary"); } } //+--------------------------------------------------------------------------------+ //| Indicator calculation 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[]) { int i, order quantity = 0; // Check the number of open orders for the current currency pair for (i = 0; i < OrdersTotal(); i++) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) if (OrderSymbol() == Symbol()) Order quantity++; // If there is an order, the background color is set to the order color; otherwise, the default background color is restored if (Order quantity > 0) ChartSetInteger(0, CHART_COLOR_BACKGROUND, order color); else ChartSetInteger(0, CHART_COLOR_BACKGROUND, background color); // If the resistance line does not exist, draw if (ObjectFind("Resistance Border Line") == -1) { Draw border line ("Resistance Border Line", Resistance Line Color, Time[0], Ask + Offset Setting * 20 * Point, Time[0] + Current Period * 600, Ask + Offset Setting * 20 * Point); } // If the support line does not exist, draw if (ObjectFind("Support Boundary Line") == -1) { Draw Boundary Line ("Support Boundary Line", Support Line Color, Time[0], Bid - Offset Setting * 20 * Point, Time[0] + Current Period * 600, Bid - Offset Setting * 20 * Point); } // Check the contact of all objects int X_1, X_2, X3d; // Time coordinates double Y_1, Y_2, Y3d; // Price coordinate color current color; // Current line color for (int n = ObjectsTotal() - 1; n >= 0; n--) { string object name = ObjectName(n); // Only process objects whose names contain "border" and are trend lines if (StringFind(object name, "border", 0) != -1 && ObjectType(object name) == OBJ_TREND) { X_1 =ObjectGet(object name, OBJPROP_TIME1); X_2 = ObjectGet(object name, OBJPROP_TIME2); if (X_1 == OBJPROP_PRICE2); Current color = ObjectGet(Object name, OBJPROP_COLOR); // If the current time is within the range of the line if (X_1 <= Time[0] && X_2 >= Time[0]) { (MathAbs(Y3d - Bid) / Point < offset setting) { if (current color == resistance line color) { if (order quantity == 0) ChartSetInteger(0, CHART_COLOR_BACKGROUND, resistance background color); break; } else { if (order quantity == 0) ChartSetInteger(0, CHART_COLOR_BACKGROUND, support background color); break; } } } } } return(rates_total); } //+------------------------------------------------------------------+ //| Draw boundary line function | //+------------------------------------------------------------------+ void Draw boundary line (string name, color color, int X1, double Y1, int X2, double Y2) { ObjectCreate(name, OBJ_TREND, 0, X1, Y1, X2, Y2); // Create a trend line object ObjectSet(name, OBJPROP_COLOR, color); // Set the color ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID); // Set the solid line style ObjectSet(name, OBJPROP_WIDTH, 4); // Set the line width ObjectSet(name, OBJPROP_BACK, false); // Do not draw in the background ObjectSet(name, OBJPROP_RAY, false); // Do not enable ray mode} //+------------------------------------------------------------------+ cm-SignalLines-L.gifSigna
Verification code Refresh