Gap Gain Test

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #46425 quote
    bolsatrilerabolsatrilera
    Participant
    Master

    He encontrado este curioso indicador : https://es.tradingview.com/script/gyqt5Q3p-Gap-Gain-Test-V1-0-by-overratedtrader/ 

    He hecho este intento de adaptación para la plataforma Prorealtime , ¿alguien puede corroborar que es correcto o hay que modificar algo?

    REM GAP GAIN TEST
    //created by @overratedtrader for the Tradingview platform
    //translated for platform Prorealtime by bolsatrilera
    // Look at the 20 MA to gauge likelihood of stock following its up or down gap.
    // - if above the 20 MA, follow the gap direction
    // - if below the 20 MA, take counter trend trade
    
    // If stock gaps up AND closes higher than it opens, that gain % (close/open) is colored green and if stock gaps down and closes lower than it opens, that gain % (close/open) is colored green
    
    // Conversely if the stock gaps up BUT closes lower than it opens, red and if a stop gaps down but closes higher than it opens, red.
    
    if open>close[1] then
    gapUP= close/open
    else
    gapUP=1
    endif
    
    if open<close[1] then
    gapDOWN= close/open
    else
    gapDOWN=1
    endif
    
    
    gapUPgain = (gapUP -1) * 100 //percent gain for the day
    gapDOWNgain = (gapDOWN -1) * 100  //percent lost for the day
    
    totalgain = gapUPgain  - gapDOWNgain
    
    if totalgain >0 then
    r=0
    g=128
    b=0
    elsif totalgain= 0 then
    r=0
    g=0
    b=0
    else
    r=255
    g=0
    b=0
    endif
    
    //Arnaud Legoux moving average
    // Window = 20
    // Sigma = 85
    // Offset = 0.6
     
    Price = totalgain
     
    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
     
    alma = WtdSum / CumWt
    
    return totalgain coloured(r,g,b)style(histogram)as "%Gain",alma style(line,2)as "alma"
    
    IIILOBOIII and Nicolas thanked this post
    ibex-1.png ibex-1.png
    #49481 quote
    IIILOBOIIIIIILOBOIII
    Participant
    New

    Funciona, aunque no lo entiendo bien. Buen trabajo.

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Gap Gain Test


ProBuilder: Indicadores y Herramientas

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by IIILOBOIIIIIILOBOIII
9 years ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 09/17/2017
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...