Code problem in Easy Language - "Cumulative start"?

Perigon

Junior member
Messages
17
Likes
0
Hi!

I trying to "get a quick start" in my indicators. What I mean is that lets say I have an moving average, of 50 days. That means that the indicator will be blank för the first 50 bars, and then show the value..

I want to make the period cumulative, like if it bar #1 theperiod is 1, bar #2 period is 2 etc up to 50 where it will be 50 for the rest...

I'm thinking somthing like this:


If Period > BarNumber Then Period = BarNumber Else Period = 50;

I thuink the logic is ok, but somehow it doesn't work..

Any thoughts or soutions anyone?

Thanks in advance!
/perigon
 
what is you maxbarsback setting??

more likely to get an answer if you post on the tradestation boards imo
 
The maxbar setting is set to automatic.. i tried shorter manual values, but then I get an error :-(
 
you could try something like a gradient scaled average, so if theres less than 50 bars on the chart you start with a 1bar average which becomes a 2 bar average to a 3 bar avg and so on.

It wont really help much because all it will do is draw a line from the 1st bar close to the point where the 50 bar average would start on the chart anyway.

if you need your average to start sooner, just add more historical bars to the chart, or use a shorter average.
 
variables: length(0);

if barnumber < 50 and barnumber > 1 then length = barnumber
else length = 50;

value1 = averagefc(close,length)
 
I have been coding EL since 1996/7 on TS4.0. But generally only out of necessity
 
Seems like I fooled my self, it doesn't work.. cant understand why...

My code looks like this:

If BarNumber < length AND BarNumber > 1 Then HullLength = BarNumber
Else HullLength = length;

'length' is my input, and 'HullLength' is used for the functions below.. but the "calculationperiod" still is equal to my length-input...
 
Yes, I know.. and it is his code i've used..but with my variables (and changed the fixed number 50 to an input-number)..
 
Top