[SOLVED] How to check if an object was created 3 bars ago?

 
Hi,

I'm new at programing, and i'm trying to develop my own indicator.

I have created a signal that shows an arrow above or below the candle that match my conditions, and now i'm trying to create another arrow signal to be showed 3 bars after the last signal.

I need to create a condition like this:


if ((contition1) && (contition2) && (3 bars ago an object was create)) {...}

I already checked the documentation but i can't find anything.

I'll be thankful if anyone could help me with this.
 
You could use Time[3] to find the time of 3 bars ago, then compare this to the time co-ordinate of an object.
 
GumRai:
You could use Time[3] to find the time of 3 bars ago, then compare this to the time co-ordinate of an object.

Hi GumRai,

That makes sense to me, i'll try to figure out the syntax to do that because i don't have any idea, and i'll check if the end result is what i really need.
Thanks.
 
 ObjectGet( string name, OBJPROP_TIME1) 
But you will have to know the name of the object, or loop through all objects of the type to see if one has the same time value.
 
FX_Hustler: if ((contition1) && (contition2) && (3 bars ago an object was create)) {...}
  1. There is no object creation time, they just exist. For arrow you can use the time of the bar they're at. For trendlines the start and end times.
  2. You know when the object was created, that was when condition1 and condition2 were both true. Either remember the time (in a static) or loop through the bars and find the conditions again.
 
Thanks for the support guys!

Finally i figured out!

if (condition1) && (condition2) && (buffer_var[shift4]==High[shift4]+spacer) {....}
if (condition1) && (condition2) && (buffer_var[shift4]==Low[shift4]-spacer) {....}

My 3rd condition is exactly the same code that i used to plot the arrows on the chart, with the diference on the variable "shift". The code to plot the arrows instead use shift4, uses shift1.

I also tried:

ObjectGet( string name, OBJPROP_TIME1)

But doesn't worked for me, maybe i did something wrong.

Thanks again! Nice trades for both!