How to create arrow on a price chart by EA ?

 

in EA code.

Can anybody help me ?

How to create an arrow on a price chart when a particular condition is met ? without disappear old arrow.


thanks

 

Sure we can help. What condition should be met? The code for adding arrow can be as follow

ObjectCreate("OBJ"+Time[0], OBJ_ARROW, 0, Time[0], SomePrice)
 
cyberfx.org:

Sure we can help. What condition should be met? The code for adding arrow can be as follow

 

Unless of course you have the condition met twice or more within the same bar,  then you will get an error as you are trying to create an Object that already exists and it will overwrite the current Object with the same name.
 
RaptorUK:
Unless of course you have the condition met twice or more within the same bar,  then you will get an error as you are trying to create an Object that already exists and it will overwrite the current Object with the same name.


If I want new arrow without overwrite. How to do ?
 
sorasit46:

If I want new arrow without overwrite. How to do ?
Use a variable to hold an index count,  maybe int ArrowNumber;  use this variable as part of the arrow Object name, each time you draw an arrow increment this variable then all your arrows will have unique names.
 
cyberfx.org:

Sure we can help. What condition should be met? The code for adding arrow can be as follow

 


Thank you.


It's work.

 
RaptorUK:
Use a variable to hold an index count,  maybe int ArrowNumber;  use this variable as part of the arrow Object name, each time you draw an arrow increment this variable then all your arrows will have unique names.


Thank you.
Reason: