Heikin ashi

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #124166 quote
    P@oLo
    Participant
    Junior

    Tralasciando il target e trailing stop che possiamo aggiungere in seguito, non entra ed esce correttamente….non capisco.

    Time H1

    EUR/USD

    #124179 quote
    robertogozzi
    Moderator
    Master

    Dimmi:

    1. hai usato la riga 23 o la 24 ?
    2. i valori delle variabili sono esattamente gli stessi che ho postato sopra (anche se ne hai cambiato solo uno falserebbe i miei risultati e perderei solo tempo) ?
    3. data ed ora della candela dove ha fatto un entrata errata.
    #124259 quote
    P@oLo
    Participant
    Junior

    Ciao Roberto,

    ho usato la riga 24.

    Tolto tutta la parte sotto del target e trailing.

    Test sul giorno 30/03/2020 (dalle ore 06:00 alle ore 22:00)  , EUR/USD, H1 , Spread 1

    Dovrebbe entrare alla fine candela delle ore 12 che termina alle 13 e chiudere alla fine della candela ore 16:00

    NON ENTRA

    #124271 quote
    robertogozzi
    Moderator
    Master

    Avevo fatto un paio d’errori nella definizione della candela Piatta (senza un’ombra), poi io avevo messo zero come shift, non so se te avevi messo 3 oppure no.

    Adesso va, anche se ho provato ed entra alle 13, ed esce alle 17. Ovviamente se provi solo quel giorno, provando con uno storico di 100K a quell’ora è già a mercato Short e quindi non entra.

    Fammi sapere, questo è il codice aggiornato:

    Defparam CumulateOrders = false
    // HA - definizione Heikin-Ashi
    //
    once xOpen = open
    xClose     = (open+close+high+low)/4
    if barindex > 0 then
    xOpen   = (xOpen+xClose[1])/2
    endif
    xLow       = min(low,min(xClose,xOpen))
    xHigh      = max(high,max(xClose,xOpen))
    xRange     = xHigh - xLow
    //
    Rialzo     = xClose > xopen
    Ribasso    = xClose < xOpen
    Piatta     = (Rialzo  AND xLow  = xOpen) OR (Ribasso AND xHigh = xOpen)
    Corpo      = abs(xOpen - xClose)
    OmbraSU    = xHigh - max(xOpen,xClose)
    OmbraGIU   = min(xOpen,Xclose) - xLow
    Doji       = Corpo <= xRange * 0.10         //Doji = corpo <= 10% del range
    //
    Shift      = 3                              //da 0 a N  (non negativo)
    //Sma3       = Average[3,0](xClose[Shift])    //calcolo sulle candele HA
    Sma3     = Average[3,0](close[Shift])     //calcolo sulla normali candele giapponesi
    // entrata LONG
    LongCond   = Rialzo  AND Piatta AND xOpen > Sma3
    If LongCond  and not OnMarket then
    Buy 1 contract at Market
    Endif
    // uscita  LONG
    L1         = Rialzo  AND OmbraGIU > Corpo
    L2         = xHigh < xHigh[1]
    L3         = Doji
    L4         = xClose < Sma3
    L5         = Ribasso AND Rialzo[1]
    ExitL      = L1 or L2 or L3 or L4 or L5
    IF ExitL AND LongOnMarket  THEN
    SELL AT MARKET
    ENDIF
    //entrata SHORT
    ShortCond  = Ribasso  AND Piatta AND xOpen < Sma3
    If ShortCond and not OnMarket then
    Sellshort 1 contract at Market
    Endif
    // uscita  SHORT
    S1         = Ribasso AND OmbraSU  > Corpo
    S2         = xLow  > xLow[1]
    S3         = Doji
    S4         = xClose > Sma3
    S5         = Rialzo AND Ribasso[1]
    ExitS      = S1 or S2 or S3 or S4 or S5
    IF ExitS AND ShortOnMarket  THEN
    EXITSHORT AT MARKET
    ENDIF
    //
    //Set Target pProfit 100
    //Set Stop   pLoss   50
    ////************************************************************************
    ////trailing stop function
    //trailingstart = 10   //trailing will start @trailinstart points profit
    //trailingstep  = 5    //trailing step to move the "stoploss"
    // 
    ////reset the stoploss value
    //IF NOT ONMARKET THEN
    //newSL=0
    //ENDIF
    // 
    ////manage long positions
    //IF LONGONMARKET THEN
    ////first move (breakeven)
    //IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    //newSL = tradeprice(1)+trailingstep*pipsize
    //ENDIF
    ////next moves
    //IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    //newSL = newSL+trailingstep*pipsize
    //ENDIF
    //ENDIF
    // 
    ////manage short positions
    //IF SHORTONMARKET THEN
    ////first move (breakeven)
    //IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    //newSL = tradeprice(1)-trailingstep*pipsize
    //ENDIF
    ////next moves
    //IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    //newSL = newSL-trailingstep*pipsize
    //ENDIF
    //ENDIF
    // 
    ////stop order to exit the positions
    //IF newSL>0 THEN
    //SELL AT newSL STOP
    //EXITSHORT AT newSL STOP
    //ENDIF
    ////************************************************************************
    #124285 quote
    P@oLo
    Participant
    Junior

    Entra solo Long!

    #124292 quote
    robertogozzi
    Moderator
    Master

    Avrai sbagliato a fare il copia e incolla, a me funziona sia Long che Short, su Dax, Eur/Usd,SP, Ftse MIN, ecc.. con TF 1 ora.

Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.

Heikin ashi


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
criscolci @criscolci Participant
Summary

This topic contains 20 replies,
has 3 voices, and was last updated by robertogozzi
5 years, 10 months ago.

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