Engulfing

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #127731 quote
    Flo66
    Participant
    Junior

    Buongiorno , ho creato questo sistema di trading però non funziona come vorrei io. Vorrei che le entrate fossero quando si crea un Engulfing sia long che short sul 10 minuti, e il profit fosse la misura del corpo della  candela che chiude. allego codice se qualcuno mi può aiutare. Grazie

    DEFPARAM CumulateOrders = False
    Bullish = close > open
    Bearish = close < open
    Body = abs(close – open)
    //UpperShadow = high – max(open,close)
    //owerShadow = min(open,close) – low
    //TotalShadows = range – Body
    // Engulfing come dfinito a https://www.ig.com/it/gli-engulfing (solo il corpo è interessato, non le ombre)
    ONCE BodySize = 0.75 //il corpo deve essere almeno il 70% del range della candela
    BullishEngulfing = Bullish AND Bearish[1] AND Body > Body[1] AND close >= open[1] AND open <= close[1] AND Body >= (range * BodySize)
    BearishEngulfing = Bullish[1] AND Bearish AND Body > Body[1] AND close <= open[1] AND open >= close[1] AND Body >= (range * BodySize)
    // filtro per verificare che il pattern si verifichi in posizione di possibile inversione (swing)
    ONCE Periodi = 15
    HH = highest[Periodi](high)
    LL = lowest[Periodi](low)
    InversioneLong = 0
    InversioneShort = 0
    IF BearishEngulfing THEN
    IF max(high,high[1]) = HH THEN
    InversioneShort = 1
    ENDIF
    ELSIF BullishEngulfing THEN
    IF min(low,low[1]) = LL THEN
    InversioneLong = 1
    ENDIF
    ENDIF
    // entrata LONG
    IF BullishEngulfing AND InversioneLong AND Not OnMarket THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    // entrata SHORT
    IF BearishEngulfing AND InversioneShort AND Not OnMarket THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    //
    SET TARGET pPROFIT 260
    SET STOP pLOSS 96
    #127737 quote
    Nicolas
    Keymaster
    Master

    Solo un promemoria per aiutarci prima che possiamo aiutarti!

    • Dai un titolo significativo al tuo argomento. Descrivi la tua domanda o l’oggetto nel titolo. Non utilizzare titoli privi di significato come “Aiuto per la codifica”.
    • usa sempre il pulsante “Inser PRT code” quando inserisci il codice nei tuoi post per facilitare la lettura degli altri.
    #127761 quote
    robertogozzi
    Moderator
    Master

    Il TP devi metterlo sia tra la riga 29 e 30 che tra la riga 33 e 34, con questa istruzione:

    SET TARGET PROFIT Body
    #127775 quote
    bertrandpinoy
    Participant
    Veteran

    per quale strumento e quale unità di tempo avete creato questo codice s prego

    #127801 quote
    robertogozzi
    Moderator
    Master

    Flo66 ce lo dirà, però mi sembra sia molto generico e possa andare bene per ogni strumento e per ogni TF, tranne TP e SL.

    #128074 quote
    Flo66
    Participant
    Junior

    Per il Petrolio su time frame 10 minuti però devo testarlo sempre

    #128117 quote
    robertogozzi
    Moderator
    Master

    Ok, verificherò.

    #128133 quote
    robertogozzi
    Moderator
    Master

    Questo funziona perfettamente, usando GRAPH si può notare che la differenza tra prezzo d’entrata ed uscita è esattamente di pip 20,1:

    DEFPARAM CumulateOrders = False
    Bullish = close > open
    Bearish = close < open
    Body = abs(close - open)
    //UpperShadow = high - max(open,close)
    //owerShadow = min(open,close) - low
    //TotalShadows = range - Body
    // Engulfing come dfinito a https://www.ig.com/it/gli-engulfing (solo il corpo è interessato, non le ombre)
    ONCE BodySize = 0.75 //il corpo deve essere almeno il 70% del range della candela
    BullishEngulfing = Bullish AND Bearish[1] AND Body > Body[1] AND close >= open[1] AND open <= close[1] AND Body >= (range * BodySize)
    BearishEngulfing = Bullish[1] AND Bearish AND Body > Body[1] AND close <= open[1] AND open >= close[1] AND Body >= (range * BodySize)
    // filtro per verificare che il pattern si verifichi in posizione di possibile inversione (swing)
    ONCE Periodi = 15
    HH = highest[Periodi](high)
    LL = lowest[Periodi](low)
    InversioneLong = 0
    InversioneShort = 0
    IF BearishEngulfing THEN
    IF max(high,high[1]) = HH THEN
    InversioneShort = 1
    ENDIF
    ELSIF BullishEngulfing THEN
    IF min(low,low[1]) = LL THEN
    InversioneLong = 1
    ENDIF
    ENDIF
    // entrata LONG
    IF BullishEngulfing AND InversioneLong AND Not OnMarket THEN
    BUY 1 CONTRACT AT MARKET
    Tp = Body
    SET TARGET PROFIT Tp
    ENDIF
    // entrata SHORT
    IF BearishEngulfing AND InversioneShort AND Not OnMarket THEN
    SELLSHORT 1 CONTRACT AT MARKET
    Tp = Body
    SET TARGET PROFIT Tp
    ENDIF
    //
    SET STOP   pLOSS 96
    //graph TP
    x-26.jpg x-26.jpg
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Engulfing


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Flo66 @flo66 Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 04/24/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...