como ajustar el horario en un indicador por cambio de Horario de Verano Europeo

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #247253 quote
    RAM24
    Participant
    New

    Hola a todos!

    alguien me podria ayudar con la estrategia anexada abajo, estoy tratando de convertirla a un indicador donde se pueda ajustar al horario de verano +- 1H que se producen dos veces cada año.

    saludos!

    Lili

    <span class=”crayon-c”>//PRC_Out of the range TS | strategy</span>
    <span class=”crayon-c”>//10.03.2017</span>
    <span class=”crayon-c”>//Nicolas @ http://www.prorealcode.com</span&gt;
    <span class=”crayon-c”>//Sharing ProRealTime knowledge</span>
    <span class=”crayon-st”>defparam</span> <span class=”crayon-st”>cumulateorders</span> <span class=”crayon-o”>=</span> <span class=”crayon-t”>false</span>
    <span class=”crayon-c”>// — parameters</span>
    StartHour <span class=”crayon-o”>=</span> <span class=”crayon-cn”>080000</span>
    EndHour <span class=”crayon-o”>=</span> <span class=”crayon-cn”>180000</span>
    Size <span class=”crayon-o”>=</span> <span class=”crayon-cn”>1</span> <span class=”crayon-c”>//position size</span>
    StopLoss <span class=”crayon-o”>=</span> <span class=”crayon-cn”>60</span> <span class=”crayon-c”>//stoploss in points</span>
    TakeProfit <span class=”crayon-o”>=</span> <span class=”crayon-cn”>10</span> <span class=”crayon-c”>//takeprofit in points</span>
    LookbackPeriod <span class=”crayon-o”>=</span> <span class=”crayon-cn”>10</span> <span class=”crayon-c”>//lookback period to find highest high and lowest low (price range)</span>
    PointsDistance <span class=”crayon-o”>=</span> <span class=”crayon-cn”>5</span> <span class=”crayon-c”>//distance in points to add/substract from highest high or lowest low to put the pending stop orders</span>
    <span class=”crayon-c”>// ————</span>
    tcondition <span class=”crayon-o”>=</span> <span class=”crayon-st”>time</span><span class=”crayon-o”>></span>StartHour <span class=”crayon-st”>and</span> EndHour <span class=”crayon-st”>and</span> <span class=”crayon-st”>intradaybarindex</span><span class=”crayon-o”>>=</span>LookbackPeriod<span class=”crayon-o”>*</span><span class=”crayon-cn”>2</span>
    <span class=”crayon-st”>if</span> <span class=”crayon-st”>not</span> <span class=”crayon-st”>onmarket</span> <span class=”crayon-st”>and</span> tcondition <span class=”crayon-st”>and</span> <span class=”crayon-st”>barindex</span><span class=”crayon-o”>-</span><span class=”crayon-st”>tradeindex</span>(<span class=”crayon-cn”>1</span>)<span class=”crayon-o”>>=</span>LookbackPeriod <span class=”crayon-st”>then</span>
    <span class=”crayon-st”>BUY</span> Size <span class=”crayon-st”>CONTRACTS</span> <span class=”crayon-st”>AT</span> <span class=”crayon-r”>highest</span><span class=”crayon-o”>[</span>LookbackPeriod<span class=”crayon-o”>]</span>(<span class=”crayon-st”>high</span>)<span class=”crayon-o”>+</span>PointsDistance<span class=”crayon-o”>*</span><span class=”crayon-st”>pointsize</span> <span class=”crayon-st”>STOP</span>
    <span class=”crayon-st”>SELLSHORT</span> Size <span class=”crayon-st”>CONTRACTS</span> <span class=”crayon-st”>AT</span> <span class=”crayon-r”>lowest</span><span class=”crayon-o”>[</span>LookbackPeriod<span class=”crayon-o”>]</span>(<span class=”crayon-st”>low</span>)<span class=”crayon-o”>-</span>PointsDistance<span class=”crayon-o”>*</span><span class=”crayon-st”>pointsize</span> <span class=”crayon-st”>STOP</span>
    <span class=”crayon-st”>endif</span>
    <span class=”crayon-st”>SET STOP</span> <span class=”crayon-st”>PLOSS</span> StopLoss
    <span class=”crayon-st”>SET TARGET</span> <span class=”crayon-st”>PPROFIT</span> TakeProfit
    #247263 quote
    robertogozzi
    Moderator
    Master

    Intente publicar nuevamente o adjunte el archivo ITF.

    #247288 quote
    RAM24
    Participant
    New
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    //PRC_Out of the range TS | strategy
    //10.03.2017
    //Sharing ProRealTime knowledge
    defparam cumulateorders = false
    // — parameters
    StartHour = 080000
    EndHour = 180000
    Size = 1 //position size
    StopLoss = 60 //stoploss in points
    TakeProfit = 10 //takeprofit in points
    LookbackPeriod = 10 //lookback period to find highest high and lowest low (price range)
    PointsDistance = 5 //distance in points to add/substract from highest high or lowest low to put the pending stop orders
    // ————
    tcondition = time>StartHour and EndHour and intradaybarindex>=LookbackPeriod*2
    if not onmarket and tcondition and barindextradeindex(1)>=LookbackPeriod then
    BUY Size CONTRACTS AT highest[LookbackPeriod](high)+PointsDistance*pointsize STOP
    SELLSHORT Size CONTRACTS AT lowest[LookbackPeriod](low)PointsDistance*pointsize STOP
    endif
    SET STOP PLOSS StopLoss
    SET TARGET PPROFIT TakeProfit
    #247290 quote
    RAM24
    Participant
    New
    //PRC_Out of the range TS | strategy
    //10.03.2017
    //Sharing ProRealTime knowledge
    defparam cumulateorders = false
    // — parameters
    StartHour = 080000
    EndHour = 180000
    Size = 1 //position size
    StopLoss = 60 //stoploss in points
    TakeProfit = 10 //takeprofit in points
    LookbackPeriod = 10 //lookback period to find highest high and lowest low (price range)
    PointsDistance = 5 //distance in points to add/substract from highest high or lowest low to put the pending stop orders
    // ————
    tcondition = time>StartHour and EndHour and intradaybarindex>=LookbackPeriod*2
    if not onmarket and tcondition and barindextradeindex(1)>=LookbackPeriod then
    BUY Size CONTRACTS AT highest[LookbackPeriod](high)+PointsDistance*pointsize STOP
    SELLSHORT Size CONTRACTS AT lowest[LookbackPeriod](low)PointsDistance*pointsize STOP
    endif
    SET STOP PLOSS StopLoss
    SET TARGET PPROFIT TakeProfit
    #247314 quote
    Iván González
    Moderator
    Master

    Hola. Aquí tienes un ejemplo:

    // === PARÁMETROS DE USUARIO ===
    StartHour = 80000
    EndHour = 180000
    ajustarHorarioVerano = 0 // poner en 1 si quieres añadir +1h
    LookbackPeriod = 10
    PointsDistance = 5
    cooldownVelas = LookbackPeriod // espera tras ruptura simulada
    
    // === AJUSTES HORARIOS ===
    ajuste = 0
    IF ajustarHorarioVerano THEN
    ajuste = 10000
    ENDIF
    horaInicio = StartHour + ajuste
    horaFin = EndHour + ajuste
    
    // === VARIABLES DE CONTROL ===
    ONCE enEspera = 0
    ONCE contadorEspera = 0
    ONCE nivelSuperior = 0
    ONCE nivelInferior = 0
    ONCE ultimaRuptura = 0
    
    // === CÁLCULO DEL RANGO ===
    enHorario = Time >= horaInicio AND Time <= horaFin
    suficientesVelas = intradaybarindex >= LookbackPeriod * 2
    
    IF enHorario AND suficientesVelas AND enEspera = 0 THEN
    maxRango = HIGHEST[LookbackPeriod](high)
    minRango = LOWEST[LookbackPeriod](low)
        
    nivelSuperior = maxRango + PointsDistance * PointSize
    nivelInferior = minRango - PointsDistance * PointSize
        
    // Simulación de ruptura
    IF high > nivelSuperior[1] THEN
    enEspera = 1
    contadorEspera = cooldownVelas
    ultimaRuptura = 1
    precioEntradaLargo=max(open,nivelSuperior[1])
    drawarrowup(barindex,low)coloured("green")
    drawpoint(barindex,precioEntradaLargo,2)coloured("blue")
    ELSIF low < nivelInferior[1] THEN
    enEspera = 1
    contadorEspera = cooldownVelas
    ultimaRuptura = -1
    precioEntradaCorto=min(open,nivelInferior[1])
    drawarrowdown(barindex,high)coloured("red")
    drawpoint(barindex,precioEntradaCorto,2)coloured("blue")
    ENDIF
    ENDIF
    
    // === CONTROL DE TIEMPO DE ESPERA ===
    IF enEspera = 1 THEN
    contadorEspera = contadorEspera - 1
    IF contadorEspera <= 0 THEN
    enEspera = 0
    ultimaRuptura = 0
    ENDIF
    ENDIF
    
    // === VISUALIZACIÓN ===
    if enHorario=0 then
    backgroundcolor("grey",45)
    endif
    //-------------------------------------//
    return nivelSuperior as "SUP"coloured("green"),nivelInferior as "INF"coloured("Red")
    robertogozzi thanked this post
    #247500 quote
    RAM24
    Participant
    New

    mil gracias Roberto, voy a testearlo

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

como ajustar el horario en un indicador por cambio de Horario de Verano Europeo


ProBuilder: Indicadores y Herramientas

New Reply
Author
author-avatar
RAM24 @ram24 Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by RAM24
8 months, 2 weeks ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 05/18/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...