Not really.
Your indicators and EAs should be independently-coded to work on a new bar (if that is what you want).
Yes, the indicator works independently to the EA. I want the EA to control the indicators calculation period to new bar calculation only
Why don't you use iCustom calls to your indicators from within your EA... which your EA only makes once per bar?
honest_knave:
Why don't you use iCustom calls to your indicators from within your EA... which your EA only does once per bar?
Good suggestion, I will need to get help from a programmer with that :) Thanks for the input
Why don't you use iCustom calls to your indicators from within your EA... which your EA only does once per bar?
the issue would be the EA uses ontick, but I see your point
priceactiontrader:
the issue would be the EA uses ontick, but I see your point
the issue would be the EA uses ontick, but I see your point
That is very easy to "fix"
void OnTick()
{
static datetime last_bar = 0;
datetime this_bar = Time[0];
if(last_bar != this_bar)
{
// do stuff here only once per bar
last_bar = this_bar;
}
}
{
static datetime last_bar = 0;
datetime this_bar = Time[0];
if(last_bar != this_bar)
{
// do stuff here only once per bar
last_bar = this_bar;
}
}
honest_knave:
Thank you, it looks quite straight forward. I will give it a go after reviewing the code :))
That is very easy to "fix"
void OnTick()
{
static datetime last_bar = 0;
datetime this_bar = Time[0];
if(last_bar != this_bar)
{
// do stuff here only once per bar
last_bar = this_bar;
}
}
{
static datetime last_bar = 0;
datetime this_bar = Time[0];
if(last_bar != this_bar)
{
// do stuff here only once per bar
last_bar = this_bar;
}
}
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
For example: EMA and MACD on D1, EA recalculates indicators on new D1 candle. H4, freeze all indicators on candle open, recalculate on new candle H4, H1 Freeze chart indicators on candle open price, recalculate indicators on new H1 candle...
Does this make sense? I would like to include a code in my EA to freeze all indicators on all time frames on the candle open price. Recalculate on new candle only.