Announcement

Collapse
No announcement yet.

AverageFC function in eSignal - some questions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • AverageFC function in eSignal - some questions

    Hi,

    I got the AverageFC-indicator from Omega Research:

    PHP Code:
    {*******************************************************************
    DescriptionSimple Moving Average (fast calculation)
    Provided ByOmega ResearchInc. (cCopyright 1999
    ********************************************************************}

    InputsPrice(NumericSeries), Length(NumericSimple);
    VariablesSum(0), Counter(0);

    If 
    CurrentBar 1 Then Begin
        Sum 
    0;
        For 
    counter 0 To Length 1     Begin
            Sum 
    Sum Price[counter];
        
    End;
    End
    Else
        
    Sum Sum Price Price[Length];

    If 
    Length 0 Then 
        AverageFC 
    Sum Length
    Else
        
    AverageFC 0;

    {
    Force Series Function}
    If 
    False Then
        value1 
    AverageFC[1]; 
    Its a little bit differently to the standard Average and sometimes a little bit other values, but I need the accurately AverageFC function for 2 indicators.
    PHP Code:
    {*******************************************************************
    DescriptionSimple Moving Average
    Provided By
    Omega ResearchInc. (cCopyright 1999
    ********************************************************************}

    InputsPrice(NumericSeries), Length(NumericSimple);
    VariablesSum(0), Counter(0);

    Sum 0;

    For 
    counter 0 To Length 1 Begin
        Sum 
    Sum Price[counter];
    End;

    If 
    Length 0 Then 
        Average 
    Sum Length
    Else
        
    Average 0

    My question, how can I realize the AverageFC function in eSignal? I have problems with the Currentbar, if I use BARSTATE_CURRENTBAR, I get no values. Is this the initialization for the Average? But, why the line:

    PHP Code:
    Sum Sum Price Price[Length]; 
    I would be very lucky, if someone could help me.

  • #2
    Roman76
    As far as I can tell the AverageFC function returns the same exact values of a simple moving average.
    The image enclosed below shows a TradeStation chart with the Custom 2 Line study set up to plot both the Average and AverageFC functions and as you can see in the Data Window the values returned by the two functions are exactly the same. IMHO you can just use the sma() function to accomplish what you want
    Alex

    Comment


    • #3
      Roman76
      To answer your question BARSTATE_CURRENTBAR is one of the flags returned by getBarState() and does not replicate TradeStation's CurrentBar. For more information on getBarState() see this article in the EFS KnowledgeBase.
      In my understanding CurrentBar is a bar counter that starts its count once the number of bars referenced by the study have gone by. In esignal you could use getCurrentBarCount() to accomplish the same task. For example
      if(getCurrentBarCount() == Length+1){
      where Length is the length assigned to the study. This would equate to TradeStation's If CurrentBar = 1 Then Begin
      Alex

      Comment


      • #4
        Alex,

        good posting! You are right with getCurrentBarCount, I use now a fix number, like ie 20.


        There is nevertheless a difference between the Average and AvaerageFC, see picture below. Perhaps its because of the TradeStation "special round" computation.

        eSignal counts ie with values of 10680.625, but in Tradestation its 10680.63. It seems in such a way with higher sma-length the differences become larger...


        PHP Code:
        Vars:    myVar(0);

        myVar = (HIGH  +  LOW CLOSE) / 2;
        myVar myVar 10;

        PLOT1((AverageFC(myVar10)-Average(myVar10))*100); 
        Attached Files

        Comment

        Working...
        X