Keltner system from TradingView to ProRealTime?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #139185 quote
    snaxks1snaxks1
    Participant
    New

    I have this Keltner-channel system code that I would like to translate to ProRealTime and backtest, would it be possible for anyone to assist me with this?

    //@version=4
    strategy(“Keltner Channel Strategy”, overlay=true)
    source = close

    useTrueRange = input(true)
    length = input(20, minval=1)
    mult = input(1.0)

    ma = sma(source, length)
    range = useTrueRange ? tr : high – low
    rangema = sma(range, length)
    upper = ma + rangema * mult
    lower = ma – rangema * mult

    crossUpper = crossover(source, upper)
    crossLower = crossunder(source, lower)

    bprice = 0.0
    bprice := crossUpper ? high+syminfo.mintick : nz(bprice[1])

    sprice = 0.0
    sprice := crossLower ? low -syminfo.mintick : nz(sprice[1])

    crossBcond = false
    crossBcond := crossUpper ? true
    : na(crossBcond[1]) ? false : crossBcond[1]

    crossScond = false
    crossScond := crossLower ? true
    : na(crossScond[1]) ? false : crossScond[1]

    cancelBcond = crossBcond and (source < ma or high >= bprice )
    cancelScond = crossScond and (source > ma or low <= sprice )

    if (cancelBcond)
    strategy.cancel(“KltChLE”)

    if (crossUpper)
    strategy.entry(“KltChLE”, strategy.long, stop=bprice, comment=”KltChLE”)

    if (cancelScond)
    strategy.cancel(“KltChSE”)

    if (crossLower)
    strategy.entry(“KltChSE”, strategy.short, stop=sprice, comment=”KltChSE”)

    //plot(strategy.equity, title=”equity”, color=color.red, linewidth=2, style=plot.style_areabr)

Viewing 1 post (of 1 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

Keltner system from TradingView to ProRealTime?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
snaxks1 @snaxks1 Participant
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/13/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...