Frattali di Williams

Viewing 16 post (of 16 total)
  • Author
    Posts
  • #207776 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Per favore NON inserire nessun tipo di file o immagine all’interno del post, in quanto rallentano il caricamento delle pagine. Allegali usando solo il pulante select file. Grazie 🙂

    Prova questa versione che ho quasi completamente ricodificato:

    //-------------------------------------------------------------------------
    // Codice principale : frattali Williams
    //-------------------------------------------------------------------------
    DEFPARAM CumulateOrders = true
    once cp      = 2
    // trend di "fondo"
    TIMEFRAME (4 hour, updateonclose)
    st=Supertrend[3,10]
    em=ExponentialAverage[21](close)
    if close > st and close > em then
    longok  = 1
    shortok = 0
    endif
    if close < st and close < em then
    shortok = 1
    longok  = 0
    endif
     
    TIMEFRAME (default)
    //
    ONCE HIL1 = 0
    ONCE HIL2 = 0
    ONCE LOL1 = 0
    ONCE LOL2 = 0
    if high[cp] >= highest[2*cp+1](high) then
    //uscita da LONG
    IF LongOnMarket THEN
    IF high[cp] < HIL2 THEN
    SELL AT Market
    cumul = 0
    ENDIF
    ENDIF
    //
    HIL2 = HIL1
    HIL1 = high[cp]
    endif
    if low[cp] <= lowest[2*cp+1](low)  then
    //uscita da SHORT
    IF ShortOnMarket THEN
    IF low[cp] > LOL2 THEN
    EXITSHORT AT Market
    cumul = 0
    ENDIF
    ENDIF
    //
    LOL2 = LOL1
    LOL1 = low[cp]
    endif
    //
    IF Not OnMarket THEN
    cumul = 0
    ENDIF
    // condizioni entrata long
    if longok AND (not onmarket or cumul) AND (HIL1 > HIL2) AND (LOL1 > LOL2) then
    buy at market
    set stop price LOL1 - 15*pointsize
    endif
    // condizioni entrata short
    if shortok AND (not onmarket or cumul) AND (HIL1 < HIL2) AND (LOL1 < LOL2) then
    sellshort at market
    set stop price HIL1 - 15*pointsize
    endif
    
    // posizione a breakeven dopo zz di guadagno; se a breakeven consentire apertura altre posizioni (cumul=1)
    if longonmarket then
    if close - TRADEPRICE >= 40 then
    set stop BreakEven
    cumul = 1
    endif
    endif
    if shortonmarket then
    if TRADEPRICE - close>= 40 then
    set stop BreakEven
    cumul = 1
    endif
    endif
    albespo thanked this post
    Frattali.itf
Viewing 16 post (of 16 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

Frattali di Williams


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
albespo @albespo Participant
Summary

This topic contains 15 replies,
has 3 voices, and was last updated by robertogozzirobertogozzi
3 years, 8 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 11/28/2022
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...