How to create an arrow MQL4

To add comments, please log in or register
Samuel6495
14
Samuel6495  

Hi, I'm trying to create an expert advisor that creates and object (Arrow up or down) depending of an if. 

The signal works, they show me the alert but the program doesn't create the arrow.

If someone can help you I will appreciate.

This is part of the code I'm doing

if( 

                diff_2 <= 0.02 && diff_2>=0

                && open_1 > close_1

                && open_2 < close_2

                && Hour() >= 9

                && Hour() <= 18

              )

              {

                  Alert(diff_2);

                  Alert("Sell: ", Symbol(), " Price 1: ", high_1, "/ Price 2:", high_2);

                  //OrderSend(Symbol(),OP_SELL,risk,Bid,20,Bid+SL*Point,Bid-TP*Point,Red);

                  ObjectCreate(0,"Arrow_Down",OBJ_ARROW,0,0,0);

                  ObjectSetInteger(0, "Arrow_Down", OBJPROP_COLOR, Red);

              }                 
Keith Watford
Moderator
20380
Keith Watford  
Samuel6495:

Hi, I'm trying to create an expert advisor that creates and object (Arrow up or down) depending of an if. 

The signal works, they show me the alert but the program doesn't create the arrow.

Please edit your post and use the code button (Alt + S) to paste your code.

ObjectCreate(0,"Arrow_Down",OBJ_ARROW,0,0,0);

Your arrow is being created but is not placed in a visible position.

You need to set the time / price anchors

Samuel6495
14
Samuel6495  
Keith Watford:

Please edit your post and use the code button (Alt + S) to paste your code.

Your arrow is being created but is not placed in a visible position.

You need to set the time / price anchors


        
if( 
                   diff_2 <= 0.02 && diff_2>=0
                   && open_1 > close_1
                   && open_2 < close_2
                   && Hour() >= 9
                   && Hour() <= 18
                 )
                 {
                     Alert(diff_2);
                     Alert("Mechas Iguales en Venta ", Symbol(), " Precio 1: ", high_1, "/ Precio 2:", high_2);
                     //OrderSend(Symbol(),OP_SELL,risk,Bid,20,Bid+SL*Point,Bid-TP*Point,Red);
                     ObjectCreate(0,"Arrow_Down",OBJ_ARROW,0,0,0);
                     ObjectSetInteger(0, "Arrow_Down", OBJPROP_COLOR, Red);
                 }        


Thanks for the help.


Ok, my robot analyze last to candles and depending the result, I need to place the arrow in the candle who just close and the lowest price or highest price.


So I guess the time will be Time[1] and the price will depend, it can be Low[1] or High[1]

William Roeder
20208
William Roeder  
Samuel6495: So I guess the …

So do it. Your question has been answered.

To add comments, please log in or register