STOP SOPRA IL MASSIMO E SOTTO IL MINIMO

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #36949 quote
    Riccardo BenedettiRiccardo Benedetti
    Participant
    Junior

    Salve,

    vorrei mettere lo stop sotto il minimo della candela precedente e sopra il massimo della candela precedente in proorder.

    come ho letto nel forum, ho provato con il seguente codice ma non mi inserisce nessuno stop:

     

    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    stoploss= low
    ENDIF
    
    IF c2 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    stoploss= high
    ENDIF
    SET STOP LOSS stoploss
    SET TARGET pPROFIT 5

    grazie

    #36969 quote
    NicolasNicolas
    Keymaster
    Legend

    Poiché la perdita di arresto deve essere in punti, non un livello di prezzo, il codice dovrebbe essere simile al seguente:

    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    stoploss= close-low
    ENDIF
    
    IF c2 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    stoploss= high-close
    ENDIF
    SET STOP LOSS stoploss
    SET TARGET pPROFIT 5
    #36972 quote
    Riccardo BenedettiRiccardo Benedetti
    Participant
    Junior

    Grazie Nicolas ma purtroppo non funziona correttamente.

    #45416 quote
    Leonida1984Leonida1984
    Participant
    Average

    Lo stop loss sotto il minimo o sopra il massimo della candela precedente a quella di ingresso?

    #46706 quote
    barbagiobarbagio
    Participant
    Average

    Ciao, io ho risolto in questo modo. Questa gestione si attiva però solo nella barra successiva a quella in cui sei entrato in posizione.

    Per gestire le “tragedie” io imposto anche uno stop loss in punti (che dipende dalla strategia) e mi ripara dai cambi sconvolgenti che potrebbero avvenire nella stessa barra di apertura.

    Un’altra cosa che ho fatto è inserire altre condizioni che attivano le condizioni qui sotto solo, ad. es., se la posizione è in profitto (ma questo dipende dalla strategia che stai usando, va verificata).

     

    ONCE varlow=1 //number of candle for trailing stop long
    ONCE varhigh=1 //number of candle for trailing stop short

     

    //*********************************************************
    // POSITION MANAGEMENT
    //*********************************************************

     

    if longonmarket then
    exitlow=lowest[varlow](low) //exit level for long position
    sell at exitlow stop
    endif

    if shortonmarket then
    exithigh=highest[varhigh](high) //exit level for short position
    exitshort at exithigh stop
    endif

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

STOP SOPRA IL MASSIMO E SOTTO IL MINIMO


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by barbagiobarbagio
9 years ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 05/29/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...