codice stop / profit di giornata

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #230258 quote
    Francesco Rossi
    Participant
    New

    Buongiorno,

    avrei bisogno di capire come inserire il comando di stop profit daily e stop loss daily .

    es : al raggiungimento di 50 punti in target profit ,non verranno eseguite ulteriori operazioni fino al giorno dopo

    analogamente per lo stop loss daily di 50 punti ,il sistema si ferma e riprende il giorno successivo.

    grazie

    #230270 quote
    Gabriele Battista
    Participant
    Senior

    vuoi una sola operazione al giorno o puoi avere più ingressi, se la condizione di ingresso si verifica più volte, e chiusura allo SL/TP?

    #230271 quote
    Francesco Rossi
    Participant
    New

    una sola operazione al giorno, a prescindere che sia in stop loss o stop profit .

    #230272 quote
    Gabriele Battista
    Participant
    Senior
    #230273 quote
    Francesco Rossi
    Participant
    New

    non è molto chiaro quanto di quello riportato qui sotto, devo inserire nel mio codice.

    cos’è tally?

    once maxTrades = 3           //maxNumberDailyTrades

    once tally = 0

    if intradayBarIndex = 0 then

    tally = 0

    endif

    newTrades = (onMarket and not onMarket[1]) or ((not onMarket and not onMarket[1]) and (strategyProfit <> strategyProfit[1])) or (longOnMarket and ShortOnMarket[1]) or (longOnMarket[1] and shortOnMarket) or ((tradeIndex(1) = tradeIndex(2)) and (barIndex = tradeIndex(1)) and (barIndex > 0) and (strategyProfit = strategyProfit[1]))

    if newTrades then

    tally = tally +1

    endif
    #230276 quote
    robertogozzi
    Moderator
    Master
    Aggiungi queste righe prime delle entrate:
    IF IntraDayBarIndex = 0 THEN
       Profitto = StrategyProfit
    ENDIF
    GuadagnoOdierno = (StrategyProfit - Profitto) / PipValue
    OTD = ((Barindex - TradeIndex(2)) > IntradayBarIndex)
    IF GuadagnoOdierno < 50*PipSize THEN
       OTD = 0
    ENDIF
    aggiungi poi questa ulteriore condizione alle tue condizioni:
    AND Not OTD
    #230630 quote
    Francesco Rossi
    Participant
    New
    in base a questo sistema ,puo’ dirmi cortesemente dove devo inserire esattemente le stringhe di codice che mi ha indicato . grazie DEFPARAM FLATBEFORE = 090000 // Cancellare tutti gli ordini in attesa e chiudere tutte le posizioni all’orario “Flat After” DEFPARAM FLATAFTER = 123000 daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0 ONCE trend = 1 // 1=UP, -1=DOWN ONCE StartLevel = 18495 ONCE Box = 5*pipsize if not onmarket then IF Trend = 1 THEN //UP IF close <= (StartLevel – Box) THEN SELLSHORT 0.5 CONTRACT AT MARKET ENDIF ELSIF Trend = -1 THEN //DOWN IF close >= (StartLevel + Box) THEN BUY 0.5 CONTRACT AT MARKET ENDIF ENDIF ENDIF // trailing start IF Trend = -1 THEN IF close <= (StartLevel – 5*PipSize) THEN StartLevel = StartLevel – 5*PipSize ENDIF ELSIF Trend = 1 THEN IF close >= (StartLevel + 5*PipSize) THEN StartLevel = StartLevel + 5*PipSize ENDIF ENDIF // Stop e target SET STOP pLOSS 5 SET TARGET pPROFIT 5 //
    #230631 quote
    Francesco Rossi
    Participant
    New
    2
    3
    4
    5
    6
    7
    8
    IF IntraDayBarIndex = 0 THEN
       Profitto = StrategyProfit
    ENDIF
    GuadagnoOdierno = (StrategyProfit Profitto) / PipValue
    OTD = ((Barindex TradeIndex(2)) > IntradayBarIndex)
    IF GuadagnoOdierno < 50*PipSize THEN
       OTD = 0
    ENDIF
    credo sia stata mal interpretata la mia richiesta. La mia necessità era quella di interrompere la strategia DOPO LA PRIMA OPERAZIONE effettuata, qualunque ne sia l’esito positivo o negativo . Quindi mi fermo dopo la 1° operazione, sempre.
    #230660 quote
    robertogozzi
    Moderator
    Master
    Quindi non deve fare più di un’operazione giornaliera, comunque vada:
    DEFPARAM CumulateOrders = False
    DEFPARAM FLATBEFORE = 090000
    // Cancellare tutti gli ordini in attesa e chiudere tutte le posizioni all’orario "Flat After"
    DEFPARAM FLATAFTER = 123000
    OTD = ((Barindex - TradeIndex(2)) > IntradayBarIndex)
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    ONCE trend = 1 // 1=UP, -1=DOWN
    ONCE StartLevel = 18495
    ONCE Box = 5*pipsize
    if not onmarket AND OTD then
    IF Trend = 1 THEN //UP
    IF close <= (StartLevel - Box) THEN
    SELLSHORT 0.5 CONTRACT AT MARKET
    ENDIF
    ELSIF Trend = -1 THEN //DOWN
    IF close >= (StartLevel + Box) THEN
    BUY 0.5 CONTRACT AT MARKET
    ENDIF
    ENDIF
    ENDIF
    // trailing start
    IF Trend = -1 THEN
    IF close <= (StartLevel - 5*PipSize) THEN
    StartLevel = StartLevel - 5*PipSize
    ENDIF
    ELSIF Trend = 1 THEN
    IF close >= (StartLevel + 5*PipSize) THEN
    StartLevel = StartLevel + 5*PipSize
    ENDIF
    ENDIF
    // Stop e target
    SET STOP pLOSS 5
    SET TARGET pPROFIT 5
    //
    #230907 quote
    Francesco Rossi
    Participant
    New
    Buongiorno, ho provato il funzionamento della strategia con il codice riportato sopre , ma purtroppo il sistema non parte e non esegue neanche un’operazione. sa cortesemente dirmi il perchè?
    #230908 quote
    Francesco Rossi
    Participant
    New
    al contrario questo codice esegue perfettamente ingresso e trailing start, ma non si ferma ad una solo trade al giorno (1 ingresso e 1 uscita, a prescindere che sia positiva o negativa) può aiutarmi cortesemente?
    #230909 quote
    Francesco Rossi
    Participant
    New
    EFPARAM FLATBEFORE = 090000 // Cancellare tutti gli ordini in attesa e chiudere tutte le posizioni all’orario “Flat After” DEFPARAM FLATAFTER = 123000 // MaxTrades yearly, daily, weekly, monthly // //daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0 ONCE trend = 1 // 1=UP, -1=DOWN ONCE StartLevel = 18485 ONCE Box = 5*pipsize Once MaxTrades = 1 //max 1 trade allowed Once TradeOn = 1 Once TradeCount = 0 If TradeCount = MaxTrades then TradeOn = 0 endif if not onmarket then IF Trend = 1 THEN //UP IF close <= (StartLevel – Box) THEN SELLSHORT 0.5 CONTRACT AT MARKET ENDIF ELSIF Trend = -1 THEN //DOWN IF close >= (StartLevel + Box) THEN BUY 0.5 CONTRACT AT MARKET ENDIF ENDIF ENDIF // trailing start IF Trend = -1 THEN IF close <= (StartLevel – 5*PipSize) THEN StartLevel = StartLevel – 5*PipSize ENDIF ELSIF Trend = 1 THEN IF close >= (StartLevel + 5*PipSize) THEN StartLevel = StartLevel + 5*PipSize ENDIF ENDIF // Stop e target SET STOP pLOSS 5 SET TARGET pPROFIT 5 //
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.

codice stop / profit di giornata


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

This topic contains 11 replies,
has 3 voices, and was last updated by Francesco Rossi
1 year, 11 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 03/22/2024
Status: Active
Attachments: No files
Logo Logo
Loading...