2 STOPLOSS

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

    Ciao, stavo valutando di mettere due strategie in un solo codice, una strategia di tipo trend following e una mean reversing, è possibile mettere 2 stop loss e due target profit? uno per strategia e se possibile come devo fare? oppure devo far funzionare due strategie separate?

    Potrei sapere anche se è possibile modificare  lo stop loss in trailing stop oppure modificarne il valore se la posizione va in profitto in modo da proteggere i profitti?

    Grazie Mille

    Matteo

    DEFPARAM CUMULATEORDERS = FALSE
    
    
    // MEAN REVERSING
    c01 = close < average [200]
    c1 = close crosses under average [41]
    c2 = close crosses over average[49]
    
    //ATRREV = AVERAGETRUERANGE[M]>AVERAGETRUERANGE[N][O]
    
    //TREND FOLLOWING
    c0 = close > average [200]
    c3 = close crosses over average [20]
    c4 = close crosses under average[50]
    
    //ATRFOL = AVERAGETRUERANGE[20]>AVERAGETRUERANGE[2][8]
    
    
    //c4 = averagetruerange[1]>averagetruerange[1][5]
    
    //____________________MEAN REVERSING______________________________
    if c1 and c01 and not onmarket then
    buy 1000 CASH at market
    endif
    
    if c2  then
    sell at market
    endif
    
    set stop %loss (200)
    set target %profit (100)
    //___________________TREND FOLLOWING_____________________________
    if c3 and c0 and not onmarket then
    buy 1000 cash at market
    endif
    
    if c4 then
    sell at market
    endif
    
    set stop $loss (100)
    set target %profit (100)
    
    #132237 quote
    NicolasNicolas
    Keymaster
    Legend

    In questo caso, inserisci le istruzioni stoploss e takeprofit subito dopo aver inviato un ordine per ciascuna strategia specifica:

    //____________________MEAN REVERSING______________________________
    if c1 and c01 and not onmarket then
    buy 1000 CASH at market
    set stop %loss (200)
    set target %profit (100)
    endif
    
    if c2  then
    sell at market
    endif
    
    
    //___________________TREND FOLLOWING_____________________________
    if c3 and c0 and not onmarket then
    buy 1000 cash at market
    set stop $loss (100)
    set target %profit (100)
    endif
    
    if c4 then
    sell at market
    endif
    
    

    In questo caso, lo stoploss è impostato una volta per tutti e per ciascuna strategia.

    #132984 quote
    mat024mat024
    Participant
    Junior

    Ottimo !

    grazie ancora

Viewing 3 posts - 1 through 3 (of 3 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

2 STOPLOSS


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
mat024 @mat024 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by mat024mat024
6 years, 4 months ago.

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