Aiuto trade Pari su strategia MTF

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #106047 quote
    Littefrido
    Participant
    Master

    Buonasera a tutti, volevo sottoporvi la mia prima strategia, ho preso spunto da un video su Youtube e c’ho un po giocato.

    Il fatto è che lavora anche bene, se non fosse che apre delle posizione e le richiude istantaneamente come potete vedere nell’immagine allegata.

    Vi allego il codice e immagine

    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    DEFPARAM PRELOADBARS    = 2000
    once positionsize=1
    
    timeframe (1 hour, updateonclose)
    // Condizioni per entrare su posizioni long
    indicator1 = SuperTrend[3,14]          //3,10
    c1 = (close[1] CROSSES OVER indicator1[1])
    
    // Condizioni per entrare su posizioni short
    indicator3 = SuperTrend[3,13]
    c3 = (close[1] CROSSES UNDER indicator3[1])
    
    timeframe(default, updateonclose) //1minuto
    add = adx[10]>=24.4
    period = 7
    Num   = abs(close-close[Period])
    Den   = summation[Period](abs(close-close[1]))
    ER    = Num / Den
    Ratio = Er>= 0.9
    
    IF c1 and ratio and add THEN
    BUY positionsize CONTRACT AT MARKET
    ENDIF
    
    
    IF c3 and ratio and add THEN
    SELLSHORT positionsize CONTRACT AT MARKET
    ENDIF
    //trailing stop
    trailingstop = 60
     
    //resetting variables when no trades are on market
    if not onmarket then
    MAXPRICE = 0
    MINPRICE = close
    priceexit = 0
    endif
     
    //case SHORT order
    if shortonmarket then
    MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade
    if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
    endif
    endif
     
    //case LONG order
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
    if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level
    endif
    endif
     
    //exit on trailing stop price levels
    if onmarket and priceexit>0 then
    EXITSHORT AT priceexit STOP
    SELL AT priceexit STOP
    priceexit = 0
    endif
    
    // Stop e target
    SET STOP pLOSS 28
    
    Schermata-2019-08-31-alle-23.17.19.png Schermata-2019-08-31-alle-23.17.19.png
    #106389 quote
    Littefrido
    Participant
    Master

    Ho risolto.

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

Aiuto trade Pari su strategia MTF


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Littefrido @littefrido Participant
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by Littefrido
6 years, 6 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 08/31/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...