Display arrow on chart when signal detected.

 

hi,

I coded an ea which detects me patterns of candles and sends me a comment and a signal sounds.

what i want to do now is to display on the graph a trace of the signal with an arrow after the playsound.
I am really stuck at this step, I have watched several tutorials but I do not fully understand this code of "objectcreate" and what it should contain ..
after several tests here is what I have already done but nothing is displayed, can you help me find the solution?

#property copyright "1.1"

#include <Self\matthieu\Signal.mqh>

input bool SEARCH_UNIQUE = true;
input int NB_SCAN_CANDLE = 10;

void OnTick(){

   if(setupOne(_Symbol, _Period, NB_SCAN_CANDLE, SEARCH_UNIQUE))      {
      
      Comment(1);
      PlaySound("alert.wav");
      PlaySound("alert.wav");
      ObjectCreate(_Symbol,"MyObject",OBJ_ARROW_BUY,0,TimeCurrent(),"setupOne" ) ;
      Sleep(250000);
        
   
   
   }
   else if(setupTwoOneCandle(_Symbol, _Period, NB_SCAN_CANDLE, SEARCH_UNIQUE)){
      
      Comment(2);
      PlaySound("alert.wav");
      PlaySound("alert.wav");
      ObjectCreate(_Symbol,"MyObject",OBJ_ARROW,0,TimeCurrent(),"setup") ;
      Sleep(300000);
      
   }
   else if(setupTwoTwoCandle(_Symbol, _Period, NB_SCAN_CANDLE, SEARCH_UNIQUE)){
      
      Comment(2);
      PlaySound("alert.wav");
      PlaySound("alert.wav");
     ObjectCreate(_Symbol,"MyObject",OBJ_ARROW,0,TimeCurrent(),"setup") ;
      Sleep(300000);
   
   }
   else if(setupThree(_Symbol, _Period, NB_SCAN_CANDLE, SEARCH_UNIQUE)){
      
      Comment(3);
      PlaySound("alert.wav");
      PlaySound("alert.wav");
      ObjectCreate(_Symbol,"MyObject",OBJ_ARROW,0,TimeCurrent(),"setup") ;
      Sleep(300000);
   
   }
   
   
}
 

please i need help if someone has the solution i have tried several solutions but each time the same errors ... anyone a solution?

objectCreate(_Symbol, OBJ_ARROW, 0, TimeCurrent(), true); //draw an up arrow
            ObjectSet(_Symbol, OBJPROP_STYLE, STYLE_SOLID);
            ObjectSet(_Symbol, OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
            ObjectSet(_Symbol, OBJPROP_COLOR,Blue); 

My errors: evry time

implicit conversion from 'string' to 'number'   c
'ObjectCreate' - wrong parameters count
'ObjectSet' - undeclared identifier    
',' - unexpected token 
'_Symbol' - some operator expected     
',' - unexpected token 
')' - unexpected token  
expression has no effect      
'ObjectSet' - undeclared identifier  
',' - unexpected token  
'_Symbol' - some operator expected    
',' - unexpected token
'SYMBOL_ARROWUP' - undeclared identifier  
')' - unexpected token 
'ObjectSet' - undeclared identifier   
',' - unexpected token  
'_Symbol' - some operator expected    
',' - unexpected token 
')' - unexpected token
 

Read the documentation for ObjectCreate and ObjectSet.

NOwhere will you see _Symbol used as one of the parameters.

When you create a new object, it must have a unique name.

This looks like you are trying to code in MQL4.

Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

 

I have seen sevrals videos who use _SYMBOL as one of the parameters. like this one: <Deleted>

when I pu _Symbol I have no error ..


I have reed all documentation on Mql5 but when i try to apply the settings in example it doesn't work ..



I'm on mql5 so I was in the right section, thank you even...

 

I will move this back out of the MQL4 section but your code looks more like MQL4 than 5.

mathieustg:
I have read all documentation on Mql5 but when i try to apply the settings in example it doesn't work ..

You obviously haven't!

ObjectSet()

Does not exist in MQL5.

I suggest that you totally scrap what you have done so far and start new. This time using documentation/examples from MQL5 instead of MQL4.

Check the parameters for  ObjectCreate().

 

Hi,

The documentations are here:

https://docs.mql4.com/constants/objectconstants/enum_object

objectCreate(_Symbol, OBJ_ARROW, 0, TimeCurrent(), true); //draw an up arrow
            ObjectSet(_Symbol, OBJPROP_STYLE, STYLE_SOLID);
            ObjectSet(_Symbol, OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
            ObjectSet(_Symbol, OBJPROP_COLOR,Blue); 

Regarding your code not working/nothing is displayed, it is most likely due to you did not insert the Price information.

I believe if you followed the steps correctly in the video, you will able to get what you want.

ObjectCreate( 
   _Symbol,  			//The Currency (not sure why it is not a chart ID, maybe mql5 have a different structure
   NumberofCandlesText, 	//The unique name, you cannot have the same name like "MyObject" for all the arrows, it must 
				//be unique, etc "MyObject1", "MyObject2", "MyObject3"
   OBJ_ARROW_BUY, 		//The Object types, documentation: https://docs.mql4.com/constants/objectconstants/enum_object
   0, 				//This is explained in the video, the subwindow id, 0 refers to the main chart
   TimeCurrent(), 		//The x-axis where you wanted to add the arrow, the time level
   (PriceInformation[0].low)	//The y-axis where you wanted to add the arrow, the price level 
				//(This is missing from all your code, that is why the arrow is not displayed)
		);
 
TeeZai:

Hi,

The documentations are here:

https://docs.mql4.com/constants/objectconstants/enum_object

objectCreate(_Symbol, OBJ_ARROW, 0, TimeCurrent(), true); //draw an up arrow
            ObjectSet(_Symbol, OBJPROP_STYLE, STYLE_SOLID);
            ObjectSet(_Symbol, OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
            ObjectSet(_Symbol, OBJPROP_COLOR,Blue); 

Please note, as has been determined in earlier posts, this is about MQL5 so a link to MQL4 code is not useful.

Also as I have already pointed out ObjectSet() does not exist in MQL5, _Symbol is not a valid parameter.

 
Keith Watford:

Please note, as has been determined in earlier posts, this is about MQL5 so a link to MQL4 code is not useful.

Also as I have already pointed out ObjectSet() does not exist in MQL5, _Symbol is not a valid parameter.

My bad. 
Reason: