Results 1 to 2 of 2
 1 Attachment(s)    

Thread: Add arrow signals

  1. #1
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default Add arrow signals

    Here is an explanation about how to add arrow signals to your indicator. As you will see, it's more complicated than adding a sound alert. You have to know the base of coding, although you don't need to be an expert.

    In the header of your indicator, add this :

    Code:
    #property  indicator_chart_window
    #property indicator_buffers 2
    #property indicator_color1 Blue
    #property indicator_color2 Red
    Then after the main extern parameters, add this :

    Code:
    extern bool  ArrowsSignal = true;
    
    int limit=1;int counter;
    double CrossUp[];
    double CrossDown[];
    double prevtime;
    double Range, AvgRange;
    Your init iteration should look like this :

    Code:
    int init()
    {
       SetIndexStyle(0, DRAW_ARROW, EMPTY, 2);
       SetIndexArrow(0, 233);
       SetIndexBuffer(0, CrossUp);
       SetIndexStyle(1, DRAW_ARROW, EMPTY, 2);
       SetIndexArrow(1, 234);
       SetIndexBuffer(1, CrossDown);
       
       return(0);
    }
    
    int deinit()
    {
       return(0);
    }
    In your code you have to create the conditions or to identify them if they already exist. Like : if(EMA5>EM15){ alert(...

    After that you will be able to build the code that will say where the arrows have to be drawn :

    Here is an example :

    Code:
    for(int i=1;i<=limit;i++){
       
    counter=i;
    Range=0;
    AvgRange=0;
       
    for (counter=i ;counter<=i+9;counter++)
         {
          AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
    }
       
    Range=AvgRange/10;
    
    if(EMA5>EMA15){if(ArrowsSignal == true)CrossUp[i] = Low[i] - Range*0.5;}
    
    if(EMA5<EMA15){if(ArrowsSignal == true)CrossDown[i] = High[i] + Range*0.5;}
    
    if ((CrossUp[0] > 2000) && (CrossDown[0] > 2000)) { prevtime = 0; }
    if ((CrossUp[0] == Low[0] - Range*0.5) && (prevtime != Time[0]))
        {
         prevtime = Time[0];
    }
    if ((CrossDown[0] == High[0] + Range*0.5) && (prevtime != Time[0]))
        {
         prevtime = Time[0];
    }
    }

  2. #2

    Default

    Hi funyoo,

    Could anyone add an arrow alert when the candle closes over/under the cloud, red for down and lime for up...thanks champs

    Cheers.


    Quote Originally Posted by funyoo View Post
    Here is an explanation about how to add arrow signals to your indicator. As you will see, it's more complicated than adding a sound alert. You have to know the base of coding, although you don't need to be an expert.

    In the header of your indicator, add this :

    Code:
    #property  indicator_chart_window
    #property indicator_buffers 2
    #property indicator_color1 Blue
    #property indicator_color2 Red
    Then after the main extern parameters, add this :

    Code:
    extern bool  ArrowsSignal = true;
    
    int limit=1;int counter;
    double CrossUp[];
    double CrossDown[];
    double prevtime;
    double Range, AvgRange;
    Your init iteration should look like this :

    Code:
    int init()
    {
       SetIndexStyle(0, DRAW_ARROW, EMPTY, 2);
       SetIndexArrow(0, 233);
       SetIndexBuffer(0, CrossUp);
       SetIndexStyle(1, DRAW_ARROW, EMPTY, 2);
       SetIndexArrow(1, 234);
       SetIndexBuffer(1, CrossDown);
       
       return(0);
    }
    
    int deinit()
    {
       return(0);
    }
    In your code you have to create the conditions or to identify them if they already exist. Like : if(EMA5>EM15){ alert(...

    After that you will be able to build the code that will say where the arrows have to be drawn :

    Here is an example :

    Code:
    for(int i=1;i<=limit;i++){
       
    counter=i;
    Range=0;
    AvgRange=0;
       
    for (counter=i ;counter<=i+9;counter++)
         {
          AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
    }
       
    Range=AvgRange/10;
    
    if(EMA5>EMA15){if(ArrowsSignal == true)CrossUp[i] = Low[i] - Range*0.5;}
    
    if(EMA5<EMA15){if(ArrowsSignal == true)CrossDown[i] = High[i] + Range*0.5;}
    
    if ((CrossUp[0] > 2000) && (CrossDown[0] > 2000)) { prevtime = 0; }
    if ((CrossUp[0] == Low[0] - Range*0.5) && (prevtime != Time[0]))
        {
         prevtime = Time[0];
    }
    if ((CrossDown[0] == High[0] + Range*0.5) && (prevtime != Time[0]))
        {
         prevtime = Time[0];
    }
    }
    Attached Files Attached Files

Similar Threads

  1. Help to add popup alert and arrow to this indi
    By MrHumble in forum Indicators
    Replies: 0
    Last Post: 04-30-2013, 03:41
  2. Ea Arrow rsi-8 cross 55-45
    By cococho in forum Ideas for expert advisors
    Replies: 1
    Last Post: 11-19-2010, 22:33
  3. Arrow Stoch Indicator
    By BusinessGuy09 in forum Ideas for expert advisors
    Replies: 1
    Last Post: 10-29-2010, 17:08
  4. Open trade on arrow
    By altoronto in forum MQL programming
    Replies: 3
    Last Post: 08-11-2009, 15:22
  5. Code to remove standard arrow in EA
    By darkkiller in forum MQL programming
    Replies: 11
    Last Post: 03-25-2009, 11:49

Tags for this Thread

add, candle, coding, color, expert, high, how to, indicator, limit, low, main, signal, signals

Posting Permissions

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