Results 1 to 20 of 244

Thread: Bet Angel and Excel

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,709
    Location
    On your attachment, are the Rows in sheet Bet Angel, from 45 to 88 one 10 ms dump from the Bet Angel Program? Is this typical? Does this data need to be "spread over" 22, (or more) worksheets for processing? Does BA do the data "Spreading" over all the other Bet Angel(n) sheets for you?



    so if you could just direct me in how to adapt simple formulas into vba language,
    Not so simple a formula. Recursive. Also formatted (Coded) for multiple uses. Ypu could, for innstance, use different smoothing factors for each curve's values

    From the Link above:
    The EMA for a series Y may be calculated recursively:

    Where:

    • The coefficient α represents the degree of weighting decrease, a constant smoothing factor between 0 and 1. A higher α discounts older observations faster.
    • Yt is the value at a time period t.
    • St is the value of the EMA at any time period t.


    By repeated application of this formula for different times, we can eventually write St as a weighted sum of the datum points Yt, as:
    for any suitable k ∈ {0, 1, 2, …}

    The weight of the general datum point
    is .
    Standard Module, named "Globals,"
    'Placed here for easy Code maintainencs and modification of formula parameters
    'EMA Series Constants
    Const macd_A As Integer = 12 'Number of Items in series
    Const macd_B As Integer = 26
    Const macd_C As Integer = 9
    Const Smoothing As Double = 0.9
    Worksheet Module Code:
    Dim MACDShort(1 To macd_A), MACDLong(1 To macd_B), MACDSignal(1 To macd_C) 'FIFO Arrays
    'Assume all three FIFO arrays are filled. Can't start until Long Series array is filled
    
    Function GetMACD(Values As Variant, Smoother As Double) As Double
        Dim X As Double
        Dim i As Integer
        X = 1 - Smoother 'Used for speed
        GetMACD = Values(LBound(Values))
        For i = LBound(Values) + 1 To UBound(Values)
            GetMACD = Smoother * (Values(i) - X) * GetMACD
        Next i
    End Function
    
    Sub test_GetMACD()
        MACDShortAverage = GetMACD(MACDShort, Smoothing)
        MACDLongAverage = GetMACD(MACDLong, Smoothing)
        MACDSignalAverage = GetMACD(MACDShort, Smoothing)
        Trigger = (MACDShortAverage - MACDLongAverage) > MACDSignalAverage
    End Sub
    Last edited by Aussiebear; 12-31-2024 at 02:16 PM.
    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •