How to save last minutes value and it won't change until the candle is change?

 
Hi all,
I want to make an EA using custom indicator, unfortunately it's paint the past.
Let's say I want it to open an order when the indicator cross 0 level up from minus level,

double indienow=iCustom(...,0);
double indiebefore=iCustom(...,1);
 
if ( indienow>0 && indiebefore<=0 ) ticket=OrderSend(...buy...);
if ( indienow<0 && indiebefore>=0 ) ticket=OrderSend(...sell...);

Unfortunately, this indicator repaint itself. When it's cross 0 level up, sometimes it's repaint the candle before, so it's seems it's already more than 0. And because the indicator's value on the candle before already over 0, it wont open any order. To anticipate it, I want a variable that could save the last minutes value and it won't change until the candle is change. For example in 15 minutes timeframe, I want the variable to save the 15th minutes indicators value, so I can compare 15th minutes indicator's value to current indicator value, so if the condition is meet, it will open an order.

Somebody help me plz, or maybe you have a better idea to deal with this kind of problem.

Thank you
 

Which indicator are you using? Very few (programmed correctly) need to change past bars.

 
Hi Phy,
It is Fisher_Yur4ik.mq4, I already have it's correct version but from visual backtester it's behavior is different. If the indicator does not have to be changed, how to code my idea above? or do you have any other idea?

Thank you
 

I had that indicator, didn't like the way it is coded.

Here is a source for Fisher Transform

http://media.wiley.com/product_data/excerpt/78/04714630/0471463078.pdf

After looking again at the Fisher_Yuri4ik.mq4 again, I think it doesn't work correctly
around the current bar, always heading towards the zero line, no matter what
price is doing. Try it on a lot of charts and timeframes.

 
Hello Phy,
One of my friend ask me to make an EA using this indicator, so I think it's unchangeable.
So I want to know whether my idea could be coded or not. I want the variable to record the value of indicator's last tick before next candle, but since the smallest timeframe in MT4 is 1 minute, I don't think it's possible.

Btw, thanks for the ebook
 

"I want the variable to record the value of indicator's last tick before next candle, but since the smallest timeframe in MT4 is 1 minute, I don't think it's possible"

That would be

variable = Close[1];

for any timeframe.

To catch it at the first tick of the new candle:

datetime oldTime;

if(oldTime != Time[0]){

variable = Close[1];

oldTime = Time[0];

... do stuff right now... new candle started

}

 
What I mean is a value of indicator's last tick before a new candle. Not last price tick before a new candle.

Btw, mind to share your fisher transform?

Thank you
 

"What I mean is a value of indicator's last tick before a new candle. Not last price tick before a new candle."

To catch it at the first tick of the new candle:datetime oldTime;

if(oldTime != Time[0]){

variable = Close[1];

indicator_value = indicator_index[1] ;

oldTime = Time[0];

... do stuff right now... new candle started

}

 
Oh I get it, your suggestion is to catch the fist tick's value of the indicator as it usually won't differ much from the last value of the candle before.
So it is impossible to get the last tick indicators value before the new candle begin? Mind to share your fisher transform?

Thank you
 

How will you know when the last tick is unless you find the first tick of the next?

Ticks come when they come... Last tick of a bar could be any time during the bar

There may not even be a tick for a bar. See one minute chart, some dealers leave holes. No tick. No bar.

 
I see, thanks Phy
Reason: