Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Help needed - Rotating object text

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    3

    Default Help needed - Rotating object text

    Hi there,

    i'm not a coder so would love some pointers to fix my issue,
    i found a rather nice candle pattern program, and i want to rotate the text, vertical and centered, as it clutters my screen when horizontal.

    This is the code of each entery.


    {
    if(Display_Bearish_Engulfing == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    High[shift1] + Range*1.5);
    ObjectSetText(PatternText[shift], "Bearish Engulfing (79%)", 8, "Times New Roman", Red);
    downArrow[shift1] = High[shift1] + Range*0.5;
    }
    if(setalert == 0 && Show_Alert == true)
    {
    pattern = "Bearish Engulfing";
    setalert = 1;
    }
    }

    i've been unable to find anything on the matter so any help would be great.
    Thank you in advance

  2. #2
    Senior Member fxtester's Avatar
    Join Date
    Nov 2008
    Posts
    3,165

    Default

    Please, post the entire code.

  3. #3
    Junior Member
    Join Date
    Jul 2014
    Posts
    3

    Default

    #property copyright "Copyright 2009."
    #property link "http://www.iforex-indicators.com"

    #property indicator_chart_window
    #property indicator_buffers 2
    #property indicator_color1 Black
    #property indicator_color2 Black
    //----
    extern bool Show_Alert = true;
    extern bool Display_Bearish_Engulfing = true;
    extern bool Display_Three_Outside_Down = true;
    extern bool Display_Three_Inside_Down = true;
    extern bool Display_Dark_Cloud_Cover = true;
    extern bool Display_Three_Black_Crows = true;
    extern bool Display_Bullish_Engulfing = true;
    extern bool Display_Three_Outside_Up = true;
    extern bool Display_Three_Inside_Up = true;
    extern bool Display_Piercing_Line = true;
    extern bool Display_Three_White_Soldiers = true;
    extern bool Display_Stars = true;
    extern bool Display_Harami = true;
    //---- buffers
    double upArrow[];
    double downArrow[];
    string PatternText[5000];
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function |
    //+------------------------------------------------------------------+
    int init()
    {
    SetIndexStyle(0, DRAW_ARROW, 0, 1);
    SetIndexArrow(0, 222);
    SetIndexBuffer(0, downArrow);
    //----
    SetIndexStyle(1, DRAW_ARROW, 0, 1);
    SetIndexArrow(1, 221);
    SetIndexBuffer(1, upArrow);

    return(0);
    }
    //+------------------------------------------------------------------+
    //| Custom indicator deinitialization function |
    //+------------------------------------------------------------------+
    int deinit()
    {
    ObjectsDeleteAll(0, OBJ_TEXT);
    return(0);
    }
    //+------------------------------------------------------------------+
    //| Custom indicator iteration function |
    //+------------------------------------------------------------------+
    int start()
    {
    double Range, AvgRange;
    int counter, setalert;
    static datetime prevtime = 0;
    int shift;
    int shift1;
    int shift2;
    int shift3;
    string pattern, period;
    int setPattern = 0;
    int alert = 0;
    int arrowShift;
    int textShift;
    double O, O1, O2, C, C1, C2, L, L1, L2, H, H1, H2;
    //----
    if(prevtime == Time[0])
    {
    return(0);
    }
    prevtime = Time[0];
    //----
    switch(Period())
    {
    case 1: period = "M1"; break;
    case 5: period = "M5"; break;
    case 15: period = "M15"; break;
    case 30: period = "M30"; break;
    case 60: period = "H1"; break;
    case 240: period = "H4"; break;
    case 1440: period = "D1"; break;
    case 10080: period = "W1"; break;
    case 43200: period = "MN"; break;
    }
    //----
    for(int j = 0; j < Bars; j++)
    {
    PatternText[j] = "pattern-" + j;
    }
    //----
    for(shift = 0; shift < Bars; shift++)
    {
    setalert = 0;
    counter = shift;
    Range = 0;
    AvgRange = 0;
    for(counter = shift; counter <= shift + 9; counter++)
    {
    AvgRange = AvgRange + MathAbs(High[counter] - Low[counter]);
    }
    Range = AvgRange / 10;
    shift1 = shift + 1;
    shift2 = shift + 2;
    shift3 = shift + 3;
    O = Open[shift1];
    O1 = Open[shift2];
    O2 = Open[shift3];
    H = High[shift1];
    H1 = High[shift2];
    H2 = High[shift3];
    L = Low[shift1];
    L1 = Low[shift2];
    L2 = Low[shift3];
    C = Close[shift1];
    C1 = Close[shift2];
    C2 = Close[shift3];
    // Bearish patterns
    // Bearish Engulfing pattern

    if((C1 > O1) && (O > C) && (O >= C1) && (O1 >= C) && ((O - C) > (C1 - O1)))
    {
    if(Display_Bearish_Engulfing == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    High[shift1] + Range*1.5);
    ObjectSetText(PatternText[shift], "Bearish Engulfing (79%)", 8, "Times New Roman", Red);
    downArrow[shift1] = High[shift1] + Range*0.5;
    }
    if(setalert == 0 && Show_Alert == true)
    {
    pattern = "Bearish Engulfing (79%)";
    setalert = 1;
    }
    }
    // Three Outside Down pattern
    if((C2 > O2) && (O1 > C1) && (O1 >= C2) && (O2 >= C1) && ((O1 - C1) > (C2 - O2)) &&
    (O > C) && (C < C1))
    {
    if(Display_Three_Outside_Down == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    Low[shift1] - Range*1.5);
    ObjectSetText(PatternText[shift], "3 Outside Down (69%)", 8, "Times New Roman", Black);
    upArrow[shift1] = Low[shift1] - Range*0.5;
    }
    if(setalert == 0 && Show_Alert == true)
    {
    pattern = "3 Outside Down (69%)";
    setalert = 0;
    }
    }
    // Dark Cloud Cover pattern
    if((C1 > O1) && (((C1 + O1) / 2) > C) && (O > C) && (O > C1) && (C > O1) &&
    ((O - C) / (0.001 + (H - L)) > 0.6))
    {
    if(Display_Dark_Cloud_Cover == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    High[shift1] + Range*1.5);
    ObjectSetText(PatternText[shift], "Dark Cloud Cover (60%)", 8, "Times New Roman", Red);
    downArrow[shift1] = High[shift1] + Range*0.5;
    }
    //----
    if(setalert == 0 && Show_Alert == true)
    {
    pattern = "Dark Cloud Cover (60%)";
    setalert = 1;
    }
    }
    // Evening Doji Star pattern
    if((C2 > O2) && ((C2 - O2) / (0.001 + H2 - L2) > 0.6) && (C2 < O1) && (C1 > O1) &&
    ((H1-L1) > (3*(C1 - O1))) && (O > C) && (O < O1))
    {
    if(Display_Stars == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    High[shift1] + Range*1.5);
    ObjectSetText(PatternText[shift], "Evening Doji (71%)", 8, "Times New Roman", Red);
    downArrow[shift1] = High[shift1] + Range*0.5;
    }
    //----
    if(setalert == 0 && Show_Alert == true)
    {
    pattern = "Evening Doji (71%)";
    setalert = 1;
    }
    }
    // Bearish Harami pattern
    if((C1 > O1) && (O > C) && (O <= C1) && (O1 <= C) && ((O - C) < (C1 - O1)))
    {
    if(Display_Harami == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    High[shift1] + Range*1.5);
    ObjectSetText(PatternText[shift], "Bearish Harami", 8, "Times New Roman", Black);
    downArrow[shift1] = High[shift1] + Range*0.5;
    }
    if(shift == 0 && Show_Alert == true)
    {
    pattern="Bearish Harami";
    setalert = 0;
    }
    }
    // Three Inside Down pattern
    if((C2 > O2) && (O1 > C1) && (O1 <= C2) && (O2 <= C1) && ((O1 - C1) < (C2 - O2)) &&
    (O > C) && (C < C1) && (O < O1))
    {
    if(Display_Three_Inside_Down == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    High[shift1] + Range*1.5);
    ObjectSetText(PatternText[shift], "3 Inside Down", 8, "Times New Roman", Black);
    downArrow[shift1] = High[shift1] + Range*0.5;
    }
    if(shift == 0 && Show_Alert == true)
    {
    pattern = "3 Inside Down";
    setalert = 0;
    }
    }
    // Three Black Crows pattern
    if((O > C*1.01) && (O1 > C1*1.01) && (O2 > C2*1.01) && (C < C1) && (C1 < C2) &&
    (O > C1) && (O < O1) && (O1 > C2) && (O1 < O2) && (((C - L) / (H - L)) < 0.2) &&
    (((C1 - L1) / (H1 - L1)) < 0.2) && (((C2 - L2) / (H2 - L2)) < 0.2))
    {
    if(Display_Three_Black_Crows == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    High[shift1] + Range*1.5);
    ObjectSetText(PatternText[shift], "3 Black Crows (78%)", 8, "Times New Roman", Red);
    downArrow[shift1] = High[shift1] + Range*0.5;
    }
    //----
    if(shift == 0 && Show_Alert == true)
    {
    pattern = "3 Black Crows (78%)";
    setalert = 1;
    }
    }
    //Evening Star Pattern
    if((C2 > O2) && ((C2 - O2) / (0.001 + H2 - L2) > 0.6) && (C2 < O1) && (C1 > O1) &&
    ((H1 - L1) > (3*(C1 - O1))) && (O > C) && (O < O1))
    {
    if(Display_Stars == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    High[shift1] + Range*1.5);
    ObjectSetText(PatternText[shift], "Evening Star (72)", 8, "Times New Roman", Red);
    downArrow[shift1] = High[shift1] + Range*0.5;
    }
    //----
    if(shift == 0 && Show_Alert == true)
    {
    pattern = "Evening Star (72%)";
    setalert = 1;
    }
    }

    // Bullish Patterns
    // Bullish Engulfing pattern
    if((O1 > C1) && (C > O) && (C >= O1) && (C1 >= O) && ((C - O) > (O1 - C1)))
    {
    if(Display_Bullish_Engulfing)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    Low[shift1] - Range*1.5);
    ObjectSetText(PatternText[shift], "Bullish Engulfing", 10,
    "Arial", Black);
    upArrow[shift1] = Low[shift1] - Range*0.5;
    }
    if(shift == 0 && Show_Alert == true)
    {
    pattern = "Bullish Engulfing";
    setalert = 1;
    }
    }
    // Three Outside Up pattern
    if((O2 > C2) && (C1 > O1) && (C1 >= O2) && (C2 >= O1) && ((C1 - O1) > (O2 - C2)) &&
    (C > O) && (C > C1))
    {
    if(Display_Three_Outside_Up == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    Low[shift1] - Range*1.5);
    ObjectSetText(PatternText[shift], "Three Outside Up", 10,
    "Arial", Black);
    upArrow[shift1] = Low[shift1] - Range*0.5;
    }
    if(shift == 0 && Show_Alert == true)
    {
    pattern = "Three Outside Up";
    setalert = 1;
    }
    }
    // Bullish Harami pattern
    if((O1 > C1) && (C > O) && (C <= O1) && (C1 <= O) && ((C - O) < (O1 - C1)))
    {
    if(Display_Harami == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    Low[shift1] - Range*1.5);
    ObjectSetText(PatternText[shift], "Bullish Harami", 10,
    "Arial", Black);
    upArrow[shift1] = Low[shift1] - Range*0.5;
    }
    if(shift == 0 && Show_Alert == true)
    {
    pattern = "Bullish Harami";
    setalert = 1;
    }
    }
    // Three Inside Up pattern
    if((O2 > C2) && (C1 > O1) && (C1 <= O2) && (C2 <= O1) && ((C1 - O1) < (O2 - C2)) &&
    (C > O) && (C > C1) && (O > O1))
    {
    if(Display_Three_Inside_Up == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    Low[shift1] - Range*1.5);
    ObjectSetText(PatternText[shift], "Three Inside Up", 10,
    "Arial", Black);
    upArrow[shift1] = Low[shift1] - Range*0.5;
    }
    if(shift == 0 && Show_Alert == true)
    {
    pattern = "Three Inside Up";
    setalert = 1;
    }
    }
    // Piercing Line pattern
    if((C1 < O1) && (((O1 + C1) / 2) < C) && (O < C) && (O < C1) && (C < O1) &&
    ((C - O) / (0.001 + (H - L)) > 0.6))
    {
    if(Display_Piercing_Line == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    Low[shift1] - Range*1.5);
    ObjectSetText(PatternText[shift], "Piercing Line", 10,
    "Arial", Black);
    upArrow[shift1] = Low[shift1] - Range*0.5;
    }
    if(shift == 0 && Show_Alert == true)
    {
    pattern = "Piercing Line";
    setalert = 1;
    }
    }
    // Three White Soldiers pattern
    if((C > O*1.01) && (C1 > O1*1.01) && (C2 > O2*1.01) && (C > C1) && (C1 > C2) &&
    (O < C1) && (O > O1) && (O1 < C2) && (O1 > O2) && (((H - C) / (H - L)) < 0.2) &&
    (((H1 - C1) / (H1 - L1)) < 0.2) && (((H2 - C2) / (H2 - L2)) < 0.2))
    {
    if(Display_Three_White_Soldiers == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    Low[shift1] - Range*1.5);
    ObjectSetText(PatternText[shift], "Three White Soldiers", 10,
    "Arial", Black);
    upArrow[shift1] = Low[shift1] - Range*0.5;
    }
    if(shift == 0 && Show_Alert == true)
    {
    pattern = "Three White Soldiers";
    setalert = 1;
    }
    }
    // Morning Doji Star
    if((O2 > C2) && ((O2 - C2) / (0.001 + H2 - L2) > 0.6) && (C2 > O1) && (O1 > C1) &&
    ((H1 - L1) > (3*(C1 - O1))) && (C > O) && (O > O1))
    {
    if(Display_Stars == true)
    {
    ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift1],
    Low[shift1] - Range*1.5);
    ObjectSetText(PatternText[shift], "Morning Doji Star", 10,
    "Arial", Black);
    upArrow[shift1] = Low[shift1] - Range*0.5;
    }
    if(shift == 0 && Show_Alert == true)
    {
    pattern = "Morning Doji Star";
    setalert = 1;
    }
    }
    if(setalert == 1 && shift == 0)
    {
    Alert(Symbol(), " ", period, " ", pattern);
    setalert = 0;
    }
    } // End of for loop
    return(0);
    }
    //+------------------------------------------------------------------+

Similar Threads

  1. Hello help is needed
    By nirim123 in forum MQL programming
    Replies: 1
    Last Post: 09-28-2012, 20:34
  2. Coding needed please
    By 100pipsv3.1[1]ea in forum Expert advisors live statements
    Replies: 0
    Last Post: 03-24-2012, 15:49
  3. Help needed
    By Leverage1 in forum MQL programming
    Replies: 0
    Last Post: 05-15-2011, 05:04
  4. Help needed for programming EA
    By vassil88 in forum MQL programming
    Replies: 0
    Last Post: 10-11-2010, 16:45

Tags for this Thread

100, candle, color, custom indicator, high, indicators, low, pattern, time

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •