Heikin ashi + trailing stop

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #168318 quote
    GaelGael
    Participant
    Average

    Salve,

    avrei un favore da chiedervi, ovvero quello di tradurre questa idea in un codice.

    Il trading system si basa sulle candele heikin ashi e il trailing stop.

    Si compra quando compare una candela heikin ashi senza un ombra inferiore e si inserisce il trailing stop alla base del corpo della candela, e non alla base di un eventuale ombra inferiore. successivamente si sposterà il trailing stop sulla candela successiva (sempre sul corpo inferiore e non sulla ombra inferiore)

    Per quanto riguarda la vendita, il principio rimane lo stesso, quindi si venderà alla comparsa di una candela heikin ashi senza ombra superiore e si posizionerà il trailing stop sul corpo superiore.

    In allegato lascio degli esempi con delle immagini.

    Un ultimo favore sarebbe quello di mettere il codice in .itf

    Rimango a disposizione per eventuali domande.

    Grazie in anticipo

    Gael

    Scenario.pdf
    #168321 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Eccolo:

    DEFPARAM CumulateOrders = FALSE
    ONCE xOpen = Open
    xClose = (open + high + low + close) / 4
    IF BarIndex > 0 THEN
       xOpen = (xOpen[1] + xClose[1]) / 2
    ENDIF
    xHigh = max(high,max(xClose,xOpen))
    xLow  = min(low, min(xClose,xOpen))
    xBody = abs(xOpen - xClose)
    xUp   = xHigh - max(xClose,xOpen)
    xDN   = min(xClose,xOpen) - xLow
    IF xDN = 0 AND Not OnMarket THEN
       BUY 1 Contract at Market
       SL = min(xClose,xOpen)
       SELL at SL STOP
    ELSIF xUP = 0 AND Not OnMarket THEN
       SELLSHORT 1 Contract at Market
       SL = max(xClose,xOpen)
       EXITSHORT at SL STOP
    ENDIF
    IF LongOnMarket THEN
       SL = max(SL,min(xClose,xOpen))
       SELL at SL STOP
    ELSIF ShortOnMarket THEN
       SL = min(SL,max(xClose,xOpen))
       EXITSHORT at SL STOP
    ENDIF
    //graphonprice SL coloured(0,128,0,200)
    IlMioSistema.itf
    #168341 quote
    GaelGael
    Participant
    Average

    Grazie mille Roberto, sempre molto disponibile.

    #169519 quote
    GaelGael
    Participant
    Average

    Buonasera,

    avrei un altra idea che si base su quella precedente, solo che cambiano alcuni parametri.

    Mi sareste veramente d’aiuto se riusciste a tradurle in un codice.

    lascio il PDF in allegato

    Buona serata a tutti

    SCENARIO2.0.pdf
    #169563 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go:

    DEFPARAM CumulateOrders = FALSE
    ONCE xOpen = Open
    xClose = (open + high + low + close) / 4
    IF BarIndex > 0 THEN
    xOpen = (xOpen[1] + xClose[1]) / 2
    ENDIF
    xHigh = max(high,max(xClose,xOpen))
    xLow  = min(low, min(xClose,xOpen))
    xBody = abs(xOpen - xClose)
    xUp   = xHigh - max(xClose,xOpen)
    xDN   = min(xClose,xOpen) - xLow
    Half  = (xClose + xOpen) / 2
    IF xDN = 0 AND Not OnMarket THEN
    BUY 1 Contract at Market
    SL = min(xClose,xOpen)
    SELL at SL STOP
    ELSIF xUP = 0 AND Not OnMarket THEN
    SELLSHORT 1 Contract at Market
    SL = max(xClose,xOpen)
    EXITSHORT at SL STOP
    ENDIF
    IF LongOnMarket THEN
    SL = max(SL,Half)
    SELL at SL STOP
    ELSIF ShortOnMarket THEN
    SL = min(SL,Half)
    EXITSHORT at SL STOP
    ENDIF
    //graphonprice SL
    DEFPARAM CumulateOrders = FALSE
    ONCE xOpen = Open
    xClose = (open + high + low + close) / 4
    IF BarIndex > 0 THEN
    xOpen = (xOpen[1] + xClose[1]) / 2
    ENDIF
    xHigh = max(high,max(xClose,xOpen))
    xLow  = min(low, min(xClose,xOpen))
    xBody = abs(xOpen - xClose)
    Bulls = xClose > xOpen
    Bears = xClose < xOpen
    IF Bulls AND Not OnMarket THEN
    BUY 1 Contract at Market
    SL = min(xClose,xOpen)
    SELL at SL STOP
    ELSIF Bears AND Not OnMarket THEN
    SELLSHORT 1 Contract at Market
    SL = max(xClose,xOpen)
    EXITSHORT at SL STOP
    ENDIF
    IF LongOnMarket THEN
    SL = max(SL,xLow)
    SELL at SL STOP
    ELSIF ShortOnMarket THEN
    SL = min(SL,xHigh)
    EXITSHORT at SL STOP
    ENDIF
    //graphonprice SL
    #169564 quote
    GaelGael
    Participant
    Average

    Grazie mille Roberto.

    Ho sempre lo stesso problema dei file in .itf, che non riesco a trasportarli sulla piattaforma, potresti inviarmeli per favore

    Scusami per il disturbo

    #169565 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    #169580 quote
    GaelGael
    Participant
    Average

    Grazie mille Roberto, buona giornata

Viewing 8 posts - 1 through 8 (of 8 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

Heikin ashi + trailing stop


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Gael @gael Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by GaelGael
5 years, 4 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 04/28/2021
Status: Active
Attachments: 5 files
ProRealCode ProRealCode
Loading...