I need help with translate code from tradingview Pine script to AFL

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #85043 quote
    Doan Thi My LinhDoan Thi My Linh
    Participant
    New

    Can somebody translate code from Pine to Amibroker AFL, it is difficult for me to finish. 🙁 It’s a strategy code not that long.

    Many thanks.

    strategy("Heikin Ashi Strategy V2",shorttitle="HAS V2",overlay=true,default_qty_value=1000,initial_capital=100000,currency=currency.EUR)
    res = input(title="Heikin Ashi Candle Time Frame", type=resolution, defval="60")
    hshift = input(1,title="Heikin Ashi Candle Time Frame Shift")
    res1 = input(title="Heikin Ashi EMA Time Frame", type=resolution, defval="180")
    mhshift = input(0,title="Heikin Ashi EMA Time Frame Shift")
    fama = input(1,"Heikin Ashi EMA Period")
    test = input(1,"Heikin Ashi EMA Shift")
    sloma = input(30,"Slow EMA Period")
    slomas = input(1,"Slow EMA Shift")
    macdf = input(false,title="With MACD filter")
    res2 = input(title="MACD Time Frame", type=resolution, defval="15")
    macds = input(1,title="MACD Shift")
    
    //Heikin Ashi Open/Close Price
    ha_t = heikinashi(tickerid)
    ha_open = security(ha_t, res, open[hshift])
    ha_close = security(ha_t, res, close[hshift])
    mha_close = security(ha_t, res1, close[mhshift])
    
    //macd
    [macdLine, signalLine, histLine] = macd(close, 12, 26, 9)
    macdl = security(ha_t,res2,macdLine[macds])
    macdsl= security(ha_t,res2,signalLine[macds])
    
    //Moving Average
    fma = ema(mha_close[test],fama)
    sma = ema(ha_close[slomas],sloma)
    plot(fma,title="MA",color=lime,linewidth=2,style=line)
    plot(sma,title="SMA",color=red,linewidth=2,style=line)
    
    //Strategy
    golong = crossover(fma,sma) and (macdl > macdsl or macdf == false )
    goshort = crossunder(fma,sma) and (macdl < macdsl or macdf == false )
    
    strategy.entry("Buy",strategy.long,when = golong)
    strategy.entry("Sell",strategy.short,when = goshort)
    Screen-Shot-2018-11-16-at-21.24.25.png Screen-Shot-2018-11-16-at-21.24.25.png
    #85052 quote
    NicolasNicolas
    Keymaster
    Legend

    Sorry but we do not provide support for Amibroker here. Still, you can ask for private coding on this page: Programming services

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

I need help with translate code from tradingview Pine script to AFL


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/16/2018
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...