Download MetaTrader 5
To add comments, please log in or register
Do you have Mac OS? Find out how to install MetaTrader on it!
younghadiz
126
younghadiz 2015.11.02 21:51 

please how can i display buy and sell arrow on the below codes .someone should please help me.

for (int i = 5; i > 1; i--)

{

if(Close[i] > Open[i]) { COUNT = COUNT + 1; }

else{ COUNT = COUNT - 1; } }

if (EnableBB==True)

{

if (COUNT == 4 && Close[1] < Open[1])

{ BUYARROW } }

if (EnableBB==True)

{

if (COUNT == -4 && Close[1] > Open[1])

{ SELLARROW}

}

younghadiz
126
younghadiz 2015.11.03 17:09  

please response to my post.

i need ur help.

Vladimir Karputov
Moderator
38060
Vladimir Karputov 2015.11.03 19:15  
younghadiz:

please response to my post.

i need ur help.

See example from help: OBJ_ARROW
younghadiz
126
younghadiz 2015.11.05 15:06  
Karputov Vladimir:
See example from help: OBJ_ARROW

have tried to print the arrows but all to no avail .

please help out .

these are codes belo.

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red

extern bool Alerts=TRUE;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

   return (0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   return (0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   if(Alerts==TRUE)
     {
      if(Close[4]>Open[4] && Close[3]>Open[3] && Close[2]>Open[2] && Close[1]<Open[2])
        {
         string SELLSIGNAL="SELLSIGNAL"+(string)Time[1];
         if(ObjectFind(0,SELLSIGNAL)!=0)
           {
            ObjectCreate(SELLSIGNAL,OBJ_ARROW_DOWN,0,Time[1],Low[1]-(Period()*Point*2));
            ObjectSet(SELLSIGNAL,OBJPROP_WIDTH,5);
            ObjectSet(SELLSIGNAL,OBJPROP_ARROWCODE,242);
            ObjectSet(SELLSIGNAL,OBJPROP_COLOR,Red);
            ObjectSetInteger(0,SELLSIGNAL,OBJPROP_ANCHOR,ANCHOR_TOP);
           }
         else if(Close[4]<Open[4] && Close[3]<Open[3] && Close[2]<Open[2] && Close[1]>Open[2])
           {
            string BUYSIGNAL="BUYSIGNAL"+(string)Time[1];
            if(ObjectFind(0,BUYSIGNAL)!=0)
              {
               ObjectCreate(BUYSIGNAL,OBJ_ARROW_UP,0,Time[1],High[1]+(Period()*Point*2));
               ObjectSet(BUYSIGNAL,OBJPROP_COLOR,clrBlue);
               ObjectSet(SELLSIGNAL,OBJPROP_ARROWCODE,241);
               ObjectSet(BUYSIGNAL,OBJPROP_WIDTH,10);
               ObjectSetInteger(0,BUYSIGNAL,OBJPROP_ANCHOR,ANCHOR_BOTTOM);
              }
           }
        }
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+
Vladimir Karputov
Moderator
38060
Vladimir Karputov 2015.11.05 15:32  

Use:

//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_color1 Green
#property indicator_color2 Red

extern bool Alerts=TRUE;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

   return (0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   return (0);
  }
//+------------------------------------------------------------------+
//| expert start 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[])
  {
//----
   if(Alerts==TRUE)
     {
      if(Close[4]>Open[4] && Close[3]>Open[3] && Close[2]>Open[2] && Close[1]<Open[2])
        {
         string SELLSIGNAL="SELLSIGNAL"+(string)Time[1];
         if(ObjectFind(0,SELLSIGNAL)!=0)
           {
            ObjectCreate(SELLSIGNAL,OBJ_ARROW_DOWN,0,Time[1],Low[1]);
            ObjectSet(SELLSIGNAL,OBJPROP_WIDTH,5);
            ObjectSet(SELLSIGNAL,OBJPROP_ARROWCODE,242);
            ObjectSet(SELLSIGNAL,OBJPROP_COLOR,Red);
            ObjectSetInteger(0,SELLSIGNAL,OBJPROP_ANCHOR,ANCHOR_TOP);
           }
         else if(Close[4]<Open[4] && Close[3]<Open[3] && Close[2]<Open[2] && Close[1]>Open[2])
           {
            string BUYSIGNAL="BUYSIGNAL"+(string)Time[1];
            if(ObjectFind(0,BUYSIGNAL)!=0)
              {
               ObjectCreate(BUYSIGNAL,OBJ_ARROW_UP,0,Time[1],High[1]);
               ObjectSet(BUYSIGNAL,OBJPROP_COLOR,clrBlue);
               ObjectSet(SELLSIGNAL,OBJPROP_ARROWCODE,241);
               ObjectSet(BUYSIGNAL,OBJPROP_WIDTH,10);
               ObjectSetInteger(0,BUYSIGNAL,OBJPROP_ANCHOR,ANCHOR_BOTTOM);
              }
           }
        }
     }
//----
   return(prev_calculated);
  }
//+------------------------------------------------------------------+

Picture:

younghadiz
126
younghadiz 2015.11.06 15:14  

Thanks very much sir , but the sell arrow is not on top of the signal candle and also the buy arrow is not function , please what can i use to  do that.

thanks alot.

younghadiz
126
younghadiz 2015.11.06 15:26  
AND ALSO , ONCE IT DREW ARROW ON A TIME FRAME AND U MOVE TO ANOTHER TIME FRAME IT WILL STILL SHOW THE ARROW AND IT WILL ALSO DUPLICATE IT ,WHICH IS NOT SUPPOST TO BE .
Files:
SIGNAL.JPG 173 kb
Vladimir Karputov
Moderator
38060
Vladimir Karputov 2015.11.06 17:28  
younghadiz:

Thanks very much sir , but the sell arrow is not on top of the signal candle and also the buy arrow is not function , please what can i use to  do that.

thanks alot.

Let's order: where should draw an arrow "DOWN"? Let's order: where should be drawn arrow "UP"?

Please draw a picture.

 

younghadiz:
AND ALSO , ONCE IT DREW ARROW ON A TIME FRAME AND U MOVE TO ANOTHER TIME FRAME IT WILL STILL SHOW THE ARROW AND IT WILL ALSO DUPLICATE IT ,WHICH IS NOT SUPPOST TO BE .

How many arrows "DOWN"?

How many arrows "UP"?

younghadiz
126
younghadiz 2015.11.06 22:30  

my condition is to check for at least 3 consecutive bullish /bearish candle and wait for the bullish /bearish candle to engulf it . and once the engulfing candle closed below /above the last 1 of the consecutive candle , it should pop up alert and print/draw arrow.

Thanks for your reply sir, once the condition is is met like the attached picture below , it should be print / draw arrow below/above the signal bar which is engulfing candle.

Files:
Vladimir Karputov
Moderator
38060
Vladimir Karputov 2015.11.07 09:31  

The indicator with the changes. Draws arrows only online (I believe that to draw on the history of the arrows is not necessary).

arrows 

Files:
Test.mq4 10 kb
younghadiz
126
younghadiz 2015.11.07 14:37  

IT very impressed sir , infact am realy grateful .

but there one thing that it does .  i attached 2 images below , the first one is 1munite time frame . so the indicator print correct signal in 1 munite Time Frame and i switched to 15 munite Time Frame those arrows that were printed on 1 munite time frame appeared on 15 munite Time Frame which is not suppost to be sir.

i will be glad if this problem can be solved.

Files:
1MSIGNAL.JPG 147 kb
15MSIGNAL.JPG 143 kb
/ /1234
To add comments, please log in or register