Alma Background

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #86545 quote
    atxeel
    Participant
    Senior

    Hallo, ich versuche den Filter und StepAlma zusammenzufügen um die Latenz zu verringern. Wie man sehen kann sind die Ergebnisse nicht dieselben und ich weiß nicht warum.

    Liegt es an

    hh = CALL “PRC_ALMA VHF filter”[window, sigma, VHFp](high)
    ll = CALL “PRC_ALMA VHF filter”[window, sigma, VHFp](low)?

    Würde mich sehr über Hilfe freuen!

    DOW-2-Minuten.png DOW-2-Minuten.png Alma-Background.itf
    #86650 quote
    Nicolas
    Keymaster
    Master

    Es muss etwas in Ihrem Code falsch sein, bitte posten Sie den Code im Klartext im Forum, viel einfacher für mich als das Importieren der Datei! Vielen Dank.

    #86686 quote
    atxeel
    Participant
    Senior

    Hallo,

    Hier ist der Code, im Prinzip ist er nur zusammengefügt:

    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    // --- settings
    // Window = 7
    // Sigma = 3
    // VHFp = 21
    // --- end of settings
    
    Price = customClose
    
    //VHF
    Length=VHFp
    
    CloseDiff = 0
    SumDiff = 0
    
    Serie = Price
    
    For Counter = 0 to Length - 1 do
    CloseDiff = Abs(serie[Counter] - serie[Counter + 1])
    SumDiff = SumDiff + CloseDiff
    next
    
    If SumDiff = 0 Then
    SumDiff = 1
    endif
    
    VHF = (Highest[Length](serie) - Lowest[Length](serie)) / SumDiff
    //
    
    Offset = max(0.01,1- VHF)
    
    m = (Offset * (Window - 1))
    s = Window/Sigma
    
    WtdSum = 0
    CumWt  = 0
    
    for k = 0 to Window - 1 do
    Wtd = Exp(-((k-m)*(k-m))/(2*s*s))
    WtdSum = WtdSum + Wtd * Price[Window - 1 - k]
    CumWt = CumWt + Wtd
    next
    
    ALAverage = WtdSum / CumWt
    
    
    //PRC_StepALMA-VHF Hi/Lo band | indicator
    //15.11.2018
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    // --- settings
    // Window = 7
    // Sigma = 3
    // VHFp = 21
    // Sensitivity  = 2     // Sensivity Factor
    // StepSize     = 14      // Step Size period
    // --- end of settings
    
    hh = ALAverage
    ll = ALAverage
    
    if hh<hh[1] and low<ll then
    trend=-1
    elsif ll>ll[1] and high>hh then
    trend=1
    endif
    
    if trend=1 then
    iline=ll
    
    else
    iline=hh
    
    endif
    
    //step function
    Sensitivity = max(Sensitivity,1*pointsize)
    ATRStepSize=averagetruerange[StepSize]
    Step = max(ATRStepSize,1*pointsize)
    size = sensitivity*Step
    phigh = highest[7](iline)
    plow = lowest[7](iline)
    stepMulti = 1.0
    workStepsmax  = phigh+2.0*size*stepMulti
    workStepsmin  = plow-2.0*size*stepMulti
    workSteptrend = workSteptrend[1]
    pprice = customclose
    if (pprice>workStepsmax[1]) then
    workSteptrend =  1
    endif
    if (pprice<workStepsmin[1]) then
    workSteptrend = -1
    endif
    if (workSteptrend =  1) then
    if (workStepsmin < workStepsmin[1]) then
    workStepsmin=workStepsmin[1]
    endif
    result = workStepsmin+size*stepMulti
    ralma=0
    galma=255
    balma=0
    BACKGROUNDCOLOR (ralma,galma,balma,70)
    endif
     
    if (workSteptrend = -1) then
    if (workStepsmax > workStepsmax[1]) then
    workStepsmax=workStepsmax[1]
    endif
    result = workStepsmax-size*stepMulti
    ralma=255
    galma=0
    balma=0
    BACKGROUNDCOLOR (ralma,galma,balma,70)
    endif
     
    return result coloured(ralma,galma,balma) style(line,3) as "Step ALMA VHF Filter Hi/Lo band"
    
    #86697 quote
    Nicolas
    Keymaster
    Master

    Ich denke, dass Sie den Originalcode völlig durcheinander gebracht haben. Um das Hi / Lo-Band zu erstellen, benötigt der Indikator den ALMA-Durchschnitt, der einmal mit Highs und einmal mit Lows berechnet wurde. Deshalb rufe ich den Indikator zweimal im Bandcode auf.
    Ich gehe also davon aus, dass Sie den Hintergrund abhängig von der Farbe des Hi / Lo-Bandes einfärben möchten. In diesem Fall sollte der genaue Code lauten:

    //PRC_StepALMA-VHF Hi/Lo band | indicator
    //15.11.2018
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    // --- settings
    Window = 7
    Sigma = 3
    VHFp = 21
    Sensitivity  = 2     // Sensivity Factor
    StepSize     = 14      // Step Size period
    // --- end of settings
    
    hh = CALL "PRC_ALMA VHF filter"[window, sigma, VHFp](high)
    ll = CALL "PRC_ALMA VHF filter"[window, sigma, VHFp](low)
    
    if hh<hh[1] and low<ll then
    trend=-1
    elsif ll>ll[1] and high>hh then
    trend=1
    endif
    
    if trend=1 then
    iline=ll
    
    else
    iline=hh
    
    endif
    
    //step function
    Sensitivity = max(Sensitivity,1*pointsize)
    ATRStepSize=averagetruerange[StepSize]
    Step = max(ATRStepSize,1*pointsize)
    size = sensitivity*Step
    phigh = highest[7](iline)
    plow = lowest[7](iline)
    stepMulti = 1.0
    workStepsmax  = phigh+2.0*size*stepMulti
    workStepsmin  = plow-2.0*size*stepMulti
    workSteptrend = workSteptrend[1]
    pprice = customclose
    if (pprice>workStepsmax[1]) then
    workSteptrend =  1
    endif
    if (pprice<workStepsmin[1]) then
    workSteptrend = -1
    endif
    if (workSteptrend =  1) then
    if (workStepsmin < workStepsmin[1]) then
    workStepsmin=workStepsmin[1]
    endif
    result = workStepsmin+size*stepMulti
    r=0
    g=255
    b=0
    endif
     
    if (workSteptrend = -1) then
    if (workStepsmax > workStepsmax[1]) then
    workStepsmax=workStepsmax[1]
    endif
    result = workStepsmax-size*stepMulti
    r=255
    g=0
    b=0
    endif
    
    backgroundcolor(r,g,b,70)
     
    return result coloured(r,g,b) style(line,3) as "Step ALMA VHF Filter Hi/Lo band"
    
    atxeel thanked this post
    background-color-alma-bands.png background-color-alma-bands.png
    #87095 quote
    atxeel
    Participant
    Senior

    Leider ist das nicht ganz das was mir vorschwebt. Ziel war eine visuelle Überprüfung für ein Handelssystem zu haben sowie evtl. für diskretionäres Trading.

    2 Probleme treten nun auf, der Indikator hat noch höhere Latenzen und lädt ständig neu, das belastet den PC und man kann fast nicht mehr arbeiten.

    Trotzdem Danke, vielleicht findet sich doch noch eine Möglichkeit auf die “Call” Anweisung zu verzichten.

    #87279 quote
    Nicolas
    Keymaster
    Master

    Der beste Weg, die Berechnungszeit zu reduzieren, besteht immer noch darin, den CALL zu vermeiden und alle Codes in denselben Code zu implementieren. Sie können beispielsweise versuchen, die angezeigten Einheiten zu reduzieren oder am Anfang des Codes ein defparam calculateonlastbars=1000 hinzuzufügen (1000 ist ein Beispiel, das Sie reduzieren können).

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Alma Background


ProBuilder: Indikatoren & Custom Tools

New Reply
Author
author-avatar
atxeel @atxeel Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by Nicolas
7 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indikatoren & Custom Tools
Language: German
Started: 12/08/2018
Status: Active
Attachments: 3 files
Logo Logo
Loading...