repaint

How to create strategies and indicators
Message
Author
krumpet
Posts: 9
Joined: Sat Apr 05, 2014 12:46 am

repaint

#1 Postby krumpet » Mon Oct 27, 2014 12:00 am

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);


}

FX Helper
Posts: 1479
Joined: Mon Apr 01, 2013 3:55 am

Re: repaint

#2 Postby FX Helper » Mon Oct 27, 2014 11:10 am

Hello,

You need to add a verification that this is a new bar before your calculations

krumpet
Posts: 9
Joined: Sat Apr 05, 2014 12:46 am

Re: repaint

#3 Postby krumpet » Mon Oct 27, 2014 8:32 pm

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


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 18 guests