question on using Close vs iClose in indicator

 

 Hi,

 

i am trying to get an indicator to plot arrows on the chart  when :

1. I get an engulfing bar 

2. But only plot the arrow if the engulfing bar is in the same direction of the previous day bar (only plot up arrows if the previous day closed bullish, and only plot down arrows if the previous day closed bearish).

 

I got my indicator working on the first condition, but when I try to add the second condition in my if statement, it seems to ignore it.

Is it not possible to use Close and iClose in the same for loop? 

I also tried to declare the Daily Close and Open in a variable above the for loop, and use those variables in the loop, but that does not seem to work either. 


 

I have attached my indicator 

 

Anybody can tell me why this is?

(and maybe have a solution) 

 

Tanks in advance!

Files:
 
rudyvaneekelen:

 Hi,

 

...

 

I think this thing is a little bit meaningless. On the one hand you run a cycle from 1 to limit and on the other hand examine always the "current yesterday".

iClose("EURUSDecn",PERIOD_D1,1)>iOpen("EURUSDecn",PERIOD_D1,1)

Does that make sense?

 
ggekko:

I think this thing is a little bit meaningless. On the one hand you run a cycle from 1 to limit and on the other hand examine always the "current yesterday".

Does that make sense?




Hi Ggekko,

 

Thanks for the fast reply!

That makes sense. I am not sure how to solve it though.

I think I need to save the current time of the lower time-frame candle  in a variable and then check the previous daily open/close  from that variable.

Reason: