Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

What code do you insert to check to see if current bar is less than required number of bars for calc Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Power9999
Posted : Saturday, July 25, 2009 11:39:04 AM
Registered User
Joined: 10/7/2004
Posts: 12
The Reference Manual indicates:

Advanced Tip: If there is not enough data to calculate your
rule (because you are calling for data x bars ago) RealCode will not output a value until there is enough data foryour rule to
calculate.   You can help speed this process up and increase
performance by doing a check at the top ofyour code that will
exit if the current bar is less than the largest number of bars
back you need to evaluate. 

What is the code that is required to do the above?


jas0501
Posted : Saturday, July 25, 2009 12:03:49 PM
Registered User
Joined: 12/31/2005
Posts: 2,499

'
' Note the period depends on the combination of periods used in a calculation.
'    For example a indicator X, a 50 day moving average of indicators Y, a 10 day moving average 
'    would require 10 days for indicator Y to start to plot and 
'    then 50 days from there for indicator X to start to plot. 
'    So 10 + 50 or sixty days
'
'# Period = unerinput.integer = 60


If currentindex >= Period then
'...
'... whatever logic you want to execute
'...
end  if
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.