Programmazione con candele Heikin Hashi consecutive

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #128821 quote
    trader0101
    Participant
    New

    Buongiorno

    vorrei configurare un codice di trading system automatico con le candele heikin hashi. Ad esempio: time frame giornaliero, apertura long alla terza candela verde heikin hashi ed apertura short alla terza candela rossa heikin hashi. come posso fare? grazie

    #128837 quote
    Nicolas
    Keymaster
    Master

    Questo è il tuo primo post e pubblichi nel forum sbagliato nonostante tu abbia letto e accettato le regole. Comunque, c'è una strategia di trading automatizzata nella biblioteca che corrisponde sempre più a quello che vuoi fare: strategia multipla di candelieri consecutivi ho dovuto cambiarla in candelabri di Heikin Ashi riconosciuti:

    //PRC_TS multiple candlesticks | indicator
    //01.03.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    // --- parameters
    Size = 1 //position size
    StopLoss = 20 //stoploss in points
    TakeProfit = 10 //takeprofit in points
    Xcandlesticks = 3 //consecutive bullish or bearish candlesticks to open a new position
    InverseTrading = 0 //(0=false ; 1=true) trade in the same direction of the candlesticks pattern or not
    CumulateOrder = 0 //(0=false ; 1=true) cumulate or not a new trade if the current candlestick is in the same trend as the pattern
    // ------------
    
    //HA candles
    // Heikin Ashi setup
    once xOpen = open
    xClose     = (open + close + high + low) / 4
    if barindex > 0 then
    xOpen  = (xOpen + xClose[1]) / 2
    endif
    
    //detecting patterns
    bearpattern = summation[Xcandlesticks](xclose<xopen)=Xcandlesticks
    bullishpattern = summation[Xcandlesticks](xclose>xopen)=Xcandlesticks
    
    //first order
    if not onmarket then
    if bearpattern then
    if InverseTrading then
    BUY Size CONTRACTS AT MARKET
    else
    SELLSHORT Size CONTRACT AT MARKET
    endif
    lastbar = barindex
    lastpattern = -1
    endif
    if bullishpattern then
    if InverseTrading then
    SELLSHORT Size CONTRACT AT MARKET
    else
    BUY Size CONTRACTS AT MARKET
    endif
    lastbar = barindex
    lastpattern = 1
    endif
    endif
    
    //cumulate order when a new pattern occurred
    if onmarket and not CumulateOrder and barindex-lastbar>=Xcandlesticks then
    if bearpattern then
    if InverseTrading then
    BUY Size CONTRACTS AT MARKET
    else
    SELLSHORT Size CONTRACT AT MARKET
    endif
    lastbar = barindex
    endif
    if bullishpattern then
    if InverseTrading then
    SELLSHORT Size CONTRACT AT MARKET
    else
    BUY Size CONTRACTS AT MARKET
    endif
    lastbar = barindex
    endif
    endif
    
    //cumulate order when a new consecutive candletick happen right after the pattern occurred
    if onmarket and CumulateOrder and barindex-lastbar=1 then
    if longonmarket then
    if (close>open and lastpattern=1) or (close<open and lastpattern=-1) then
    BUY Size CONTRACTS AT MARKET
    lastbar = barindex
    endif
    endif
    if shortonmarket then
    if (close>open and lastpattern=1) or (close<open and lastpattern=-1) then
    SELLSHORT Size CONTRACT AT MARKET
    lastbar = barindex
    endif
    endif
    endif
    
    SET STOP PLOSS StopLoss
    SET TARGET PPROFIT TakeProfit

    Devi cambiare i valori di takeprofit e stoploss con tutte le impostazioni che desideri.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Programmazione con candele Heikin Hashi consecutive


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
trader0101 @trader0101 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
5 years, 9 months ago.

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