Spostare lo stop in pari dopo che l’operazione è in guadagno di 100 punti.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #157606 quote
    domenicoprorealcode
    Participant
    Junior

    Buona sera, qualcuno mi può aiutare a creare 1 condizione che dica al sistema di spostare lo stop in pari dopo che l’operazione è in guadagno di 100 punti e chiudere l’operazione al raggiungimento del  take profit oppure stop in pari.

    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    // Il sistema cancellerà tutti gli ordini in attesa e chiuderà tutte le posizioni a 0:00. Dopo l'orario "Flat Before" non saranno piazzati nuovi ordini o posizioni.
    DEFPARAM FLATBEFORE = 010000
    // Cancellare tutti gli ordini in attesa e chiudere tutte le posizioni all'orario "Flat After"
    DEFPARAM FLATAFTER = 235500
    Otd = (Barindex - TradeIndex(1) > IntradayBarIndex)
    // giorni tradabili specifici della settimana DAL LUNEDI AL VENERDI
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    indicator1 = SuperTrend[4,10]
    c1 = (close[1] CROSSES OVER indicator1)
    indicator2 = ExponentialAverage[21](close)
    c2 = (close[1] > indicator2)
    c3 = (high[1] > open [2])
    
    IF c1 AND c2 AND c3 AND not daysForbiddenEntry AND Otd THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    // Stop e target
    SET STOP pLOSS 350
    SET TARGET pPROFIT 500

    Grazie per chi mi vorra’ aiutare

    #157608 quote
    robertogozzi
    Moderator
    Master

    Eccolo:

    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    // Il sistema cancellerà tutti gli ordini in attesa e chiuderà tutte le posizioni a 0:00. Dopo l'orario "Flat Before" non saranno piazzati nuovi ordini o posizioni.
    DEFPARAM FLATBEFORE = 010000
    // Cancellare tutti gli ordini in attesa e chiudere tutte le posizioni all'orario "Flat After"
    DEFPARAM FLATAFTER = 235500
    Otd = (Barindex - TradeIndex(1) > IntradayBarIndex)
    // giorni tradabili specifici della settimana DAL LUNEDI AL VENERDI
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
     
    indicator1 = SuperTrend[4,10]
    c1 = (close[1] CROSSES OVER indicator1)
    indicator2 = ExponentialAverage[21](close)
    c2 = (close[1] > indicator2)
    c3 = (high[1] > open [2])
     
    IF c1 AND c2 AND c3 AND not daysForbiddenEntry AND Otd THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    // Stop e target
    SET STOP pLOSS 350
    SET TARGET pPROFIT 500
    //
    If Not OnMarket then
       StopLoss = 0
    Else
       If (close- TradePrice) >= 100 * PipSize then
          StopLoss = TradePrice
       Endif
       Sell at StopLoss STOP
    endif
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Spostare lo stop in pari dopo che l’operazione è in guadagno di 100 punti.


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
5 years, 1 month ago.

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