CA daily close strat

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #234052 quote
    ARLEQUIN49ARLEQUIN49
    Participant
    Veteran

    Bonjour a tous,

    J’aurais besoin d’une conversion de code d’un indicateur de Tradingview.

    Merci beaucoup d’avance

    Voici le code:

    // https://www.tradingview.com/u/ChartArt/
    //
    // __ __ ___ __ ___
    // / ` |__| /\ |__) | /\ |__) |
    // \__, | | /~~\ | \ | /~~\ | \ |
    //
    //

    threshold = input(title=”Price Difference Threshold”, type=float, defval=0, step=0.001)

    getDiff() =>
    yesterday=security(tickerid, ‘D’, close[1])
    today=security(tickerid, ‘D’, close)
    delta=today-yesterday
    percentage=delta/yesterday

    closeDiff = getDiff()

    buying = closeDiff > threshold ? true : closeDiff < -threshold ? false : buying[1]

    hline(0, title=”zero line”)

    bgcolor(buying ? green : red, transp=25)
    plot(closeDiff, color=silver, style=area, transp=75)
    plot(closeDiff, color=aqua, title=”prediction”)

    longCondition = buying
    if (longCondition)
    strategy.entry(“Long”, strategy.long)

    shortCondition = buying != true
    if (shortCondition)
    strategy.entry(“Short”, strategy.short)

    Sans-titre.png Sans-titre.png
    #234088 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Holà. Ici vous avez le code :

    //-----------------------------------------//
    //PRC_Percentage Change
    //version = 0
    //19.06.2024
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //-----------------------------------------//
    //-----Inputs------------------------------//
    threshold=1
    //-----------------------------------------//
    //-----Inputs------------------------------//
    delta=close-close[1]
    pctChange=delta/close[1]*100
    //-----------------------------------------//
    //-----Inputs------------------------------//
    if pctChange > threshold then
    trend=1
    r=0
    g=255
    elsif pctChange < -threshold then
    trend=-1
    r=255
    g=0
    else
    trend=trend[1]
    r=r[1]
    g=g[1]
    endif
    //-----------------------------------------//
    backgroundcolor(r,g,0,50)
    //-----------------------------------------//
    return pctChange as "% change"style(line,2)coloured("blue"),threshold as "Threshold+"style(dottedline2)coloured("green"),-threshold as "Threshold-"style(dottedline2)coloured("red"), 0 as "Zero"
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

CA daily close strat


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
ARLEQUIN49 @arlequin49 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Iván GonzálezIván González
2 years, 3 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 06/18/2024
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...