I am trying to convert TradeStation code to AFl.  I am a beginner in 
essay language.  If someone familiar with trade station code can 
explain how the code below works I think I can figure out how to do 
the conversion.  The code below is a function called by another 
indicator.  I am confused by what appears to be variables and 
constants and how they are handled. Any explanation would be hugely 
helpful and appreciated. 

[LegacyColorValue = true]; 

{ TSMStDevConfidence : Standard deviation confidence level (in 
percent)


  Returns confidence level, e.g., if stdev = 2.0 then confidence = 
95.44,
  including both ends of the curve. To find confidence of one end of 
the
  distribution, divide result by 2. }

        inputs: price(numericseries), length(numericsimple);
        vars:   n(0), pi(3.1415926), e(2.7182818), exp(0), sd(0), diff
(0), diff2(0),
                        const(0);

        n = length;
        if currentbar < length then n = currentbar;
        diff = price - average(price,n);
        diff2 = power(diff,2);
        sd = squareroot(average(diff2,n));

        exp = sd*sd / 2;
        const =  1.00 / squareroot(2*pi);
        TSMStDevConfidence =100 -  100 * const  * power(e,-exp);


Reply via email to