Arrows are not being drawn on scrren MQL5

 

Below is  aportion of my code that once the condition is met it has to draw an arrow above the next opening candle.
Teh arrows do not get drawn waht am i doing wrong

  if (open[0] > rsiLevel && close[0] < rsiLevel) // If candle opens above 50 and closes below 50
    {
        // Position the signal below the current candle
        SellBuffer[0] = low[0] - 10 * _Point; // Use low[] array
        datetime alertTime = TimeCurrent();

        if (alertTime != lastAlertTime) // Avoid duplicate alerts
        {
            lastAlertTime = alertTime;
            Print("Sell signal generated! Current RSI: ", currentRsiValue, " | Previous RSI: ", prevRsiValue); // Debug message
            SendNotification(CreateAlertMessage("Put", assetName, timeframe, alertTime));
        }
        // Draw the arrow on the chart
        DrawArrow("SellArrow_" + IntegerToString(time[0]), time[0], low[0] - 15 * _Point, sellArrowColor, 233); // Down arrow code
    } 
Documentation on MQL5: Network Functions / SendNotification
Documentation on MQL5: Network Functions / SendNotification
  • www.mql5.com
Sends push notifications to the mobile terminals, whose MetaQuotes IDs are specified in the "Notifications" tab. Parameters text [in]...
 

As DrawArrow() is a custom function I/we don't know the code, and you don't check and print the error, this function call might cause... I can't tell you the reason.

Learn to use the debugger, it's made to find errors after the code compiles.

Code-Debugging - Programme entwickeln - MetaEditor Hilfe
  • www.metatrader5.com
MetaEditor hat einen eingebauten Debugger, mit dem Sie die Programmausführung Schritt für Schritt (durch einzelne Funktionen) ü...
 
Carl Schreiber #:

As DrawArrow() is a custom function I/we don't know the code, and you don't check and print the error, this function call might cause... I can't tell you the reason.

Learn to use the debugger, it's made to find errors after the code compiles.

There are no errors while compiling 
here is the code

void DrawArrow(string name, datetime time, double price, color arrowColor, int arrowCode)

{

    if (ObjectFind(0, name) < 0) // If the object does not exist

    {

        ObjectCreate(0, name, OBJ_ARROW, 0, time, price);

        ObjectSetInteger(0, name, OBJPROP_COLOR, arrowColor);

        ObjectSetInteger(0, name, OBJPROP_ARROWCODE, arrowCode);

        ObjectSetInteger(0, name, OBJPROP_WIDTH, 2); // Set the arrow width

    }

}

 
John Progton #:

There are no errors while compiling 
here is the code

Still how is anyone supposed to help you?

You say they don't get drawn... but there is nothing in the code that you have presented that allows you to confirm if they should have been drawn.

Use some print statements to confirm when an arrow should be drawn, then see if they have or not, including checking the object list on the chart in case you have created them in a time/price not visible.

use ResetLastError and GetLastError() to understand if things are failing...

use the debugger to step through the code and check values are creating the right conditions etc.. 

 
John Progton: Teh arrows do not get drawn waht am i doing wrong
  if (open[0] > rsiLevel && close[0] < rsiLevel) // If candle opens above 50 and closes below 50
  1. Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
              Code debugging - Developing programs - MetaEditor Help
              Error Handling and Logging in MQL5 - MQL5 Articles (2015)
              Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
              Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)

  2. Open and close are prices (1.12345). They have nothing to do with RSI (50). You need to read and remember, the RSI at the start of the candle and after it closes.