Traducción de indicador:"CDC ATR Trailing Stop"

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

    Hola Nicolas,he encontrado este interesante Trailing-Stop basado en el ATR.¿Sería usted tan amable de traducirlo?.Gracias

    //@version=2
    study("CDC ATR Trailing Stop V2.1 (2013)", overlay=true)
    
    /////////notes////////////////////////////////////////
    // This is based on the ATR trailing stop indicator //
    // width addition of two levels of stops and //
    // different interpretation. //
    // This is a fast-reacting system and is better //
    // suited for higher volatility markets //
    //////////////////////////////////////////////////////
    
    SC = input(close,"data array",source) // data array
    //typee = input(defval="EMA", title="MEDIA TYPE: ")//, options=["SMA", "EMA", "WMA", "VWMA", "SMMA", "DEMA", "TEMA", "HullMA", "ZEMA", "TMA", "SSMA"], type=string)
    pm = input(defval=9, title="MEDIA-PERIODO")
    //pm = input(defval=9, title="MEDIA-PERIODO:", minval=1)
    // Fast Trail //
    AP1 = input(5,"fast ATR period",integer) // ATR Period
    AF1 = input(0.5,"fast ATR multiplier",float) // ATR Factor
    SL1 = AF1*atr(AP1) // Stop Loss
    Trail1 = iff(SC>nz(Trail1[1],0) and SC[1]>nz(Trail1[1],0),max(nz(Trail1[1],0),SC-SL1),iff(SC<nz(Trail1[1],0) and SC[1]<nz(Trail1[1],0),min(nz(Trail1[1],0),SC+SL1),iff(SC>nz(Trail1[1],0),SC-SL1,SC+SL1)))
    
    // Slow Trail //
    AP2 = input(10,"slow ATR perod",integer) // ATR Period
    AF2 = input(2.15,"slow ATR multiplier",float) // ATR Factor
    SL2 = AF2*atr(AP2) // Stop Loss
    Trail2 = iff(SC>nz(Trail2[1],0) and SC[1]>nz(Trail2[1],0),max(nz(Trail2[1],0),SC-SL2),iff(SC<nz(Trail2[1],0) and SC[1]<nz(Trail2[1],0),min(nz(Trail2[1],0),SC+SL2),iff(SC>nz(Trail2[1],0),SC-SL2,SC+SL2)))
    
    // ATRCD Histogram //
    // to plot these, uncomment the code in the plot section below and change indicator overlay to false, also comment out the other plots //
    Hst = Trail1-Trail2
    Sig = ema(Hst,pm)
    
    // Bar color for trade signal //
    Blue = Hst<0 and Hst>Sig
    Green = Hst>0 and Hst>Sig
    Gray = Hst>0 and Hst<Sig
    Red = Hst<0 and Hst<Sig
    
    // Signals //
    Bull = barssince(Green)<barssince(Red)
    Bear = barssince(Red)<barssince(Green)
    
    Buy = Green and Bear[1]
    Sell = Red and Bull[1]
    
    TS1 = plot(Trail1, style = circles)
    TS2 = plot(Trail2, style = line, color=SC>Trail2? green : red, linewidth=2)
    fill(TS1,TS2,Bull ? green : red,transp = 90)
    
    plotcolor = input(0,"Paint color on chart",bool)
    plotbuysell = input(0,"Plot Buy/Sell arrows",bool)
    
    bcl = iff(plotcolor == 1,Blue ? blue : Green ? lime : Gray ? gray : Red ? red : white,na)
    barcolor(bcl)
    plotshape(Buy[1] and plotbuysell==1,"Buy",shape.arrowup,location.belowbar,green,text="STOP")
    plotshape(Sell[1] and plotbuysell==1,"Sell",shape.arrowdown,location.abovebar,red,text="STOP")
    cdc-atr-trailing-stop-v2.1.png cdc-atr-trailing-stop-v2.1.png
    #67917 quote
    NicolasNicolas
    Keymaster
    Legend

    Convertí el código, puedes descargarlo de la biblioteca: CDC ATR Trailing Stop v2.1

    Fr7 thanked this post
    CDC-ATR-TRAILING-STOP-CODE.png CDC-ATR-TRAILING-STOP-CODE.png
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

Traducción de indicador:"CDC ATR Trailing Stop"


ProBuilder: Indicadores y Herramientas

New Reply
Author
author-avatar
Fr7 @fr7 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by NicolasNicolas
8 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 04/09/2018
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...