Anyone know why my indicator keeps reprinting 1000s of times per bar?
I know its really basic but i just cant work it out.
How do i get my indicator to only run on a new bar?
And only run once?
regards
EXPORT void __stdcall Calculate(int index)
{
NewSlow = GetMA(0, 1, 8, TMAType(ma_SMA), TPriceType(pt_Close), 0);
NewFast = GetMA(0, 1, 5, TMAType(ma_EMA), TPriceType(pt_Close), 0);
Fast = GetMA((0 + 1), 1, 5, TMAType(ma_EMA), TPriceType(pt_Close), 0);
Slow = GetMA((0 + 1), 1, 8, TMAType(ma_SMA), TPriceType(pt_Close), 0);
Print(NewSlow);
}
repaint
-
- Posts: 1479
- Joined: Mon Apr 01, 2013 3:55 am
Re: repaint
Hello,
You need to add a verification that this is a new bar before your calculations
You need to add a verification that this is a new bar before your calculations
-
- Posts: 9
- Joined: Sat Apr 05, 2014 12:46 am
Re: repaint
Thanks for your reply. Sorry i thought i read somewhere that calculate() only runs on new bar.
Ive spent lots of time on this and my brain is fried. Would you be able to write me the code in c++ to only run on new bar? In mt4 i would use indcator counted but this function is not available? Your help would be hugely appreciated.
Regards
Ive spent lots of time on this and my brain is fried. Would you be able to write me the code in c++ to only run on new bar? In mt4 i would use indcator counted but this function is not available? Your help would be hugely appreciated.
Regards
Who is online
Users browsing this forum: No registered users and 18 guests