Strategia Pinbar

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #121502 quote
    Sirobi
    Participant
    Junior

    Buonasera a tutti,

    avrei bisogno di un aiuto. Mi piacerebbe realizzare una strategia di questo tipo :

    Entry Long : in caso di pinbar long, entro entro le 5 candele successiva solo se il prezzo arriva a metà candela pinbar. SL = minimo della Pinbar TP = 2xSL

    Entry Short : in caso di pinbar short, entro entro le 5 candele successiva solo se il prezzo arriva a metà candela pinbar. SL = minimo della Pinbar TP = 2xSL

    Allego immagini per comprendere meglio le entrare e le uscite.

    Grazie in anticipo.

    Simone

    Pinbar-Long.jpg Pinbar-Long.jpg Pinbar-Short.jpg Pinbar-Short.jpg
    #121518 quote
    Nicolas
    Keymaster
    Master

    Ecco il codice per quella strategia. Aprirà gli ordini solo durante 5 barre dopo un rilevamento pinbar.

    defparam cumulateorders=false
    
    body = ABS(open-close)
    bearishwick = ABS(high-close)
    bearishnose = ABS(close-low)
    bullishwick = ABS(close-low)
    bullishnose = ABS(high-close)
    
    
    //bearish pinbar
    bearish= (body/bearishwick)<20/100 AND (body/bearishnose)>100/100
    //bullish pinbar
    bullish= (body/bullishwick)<20/100 and (body/bullishnose)>100/100
    
    if not longonmarket and bullish then
    buylevel = medianprice
    buysl = low
    buytp = close+(close-low)*2
    buystart = barindex
    buy at buylevel stop
    sell at buysl stop
    sell at buytp limit
    endif
    
    if longonmarket  then
    if close<buylevel and barindex-buystart<=5 then
    buy at buylevel stop
    endif
    sell at buysl stop
    sell at buytp limit
    endif
    
    if not shortonmarket and bearish then
    selllevel = medianprice
    sellsl = high
    selltp = close-(high-close)*2
    sellstart = barindex
    sellshort at selllevel stop
    exitshort at sellsl stop
    exitshort at selltp limit
    endif
    
    if shortonmarket  then
    if close>selllevel and barindex-sellstart<=5 then
    sellshort at selllevel stop
    endif
    exitshort at sellsl stop
    exitshort at selltp limit
    endif
     
    //graphonprice buytp
    
    #121619 quote
    Sirobi
    Participant
    Junior

    Nicolas, grazie molte !!!

    Sei stato gentilissimo.

    Lo provo subito.

    Grazie ancora

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

Strategia Pinbar


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Sirobi @sirobi Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Sirobi
5 years, 11 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 03/08/2020
Status: Active
Attachments: 2 files
Logo Logo
Loading...