StopLoss e Take Profit su IG

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #254271 quote
    Alessandro Furlani
    Participant
    Junior

    Ho notato una differenza di comportamento per gli stop loss e take profit tra IB ed IG.

    Su IB l’esecuzione di ordini successivi porta ad un solo blocco con prezzo che è la media dei prezzi dei singoli ordini e gli Stop Loss e Take Profit sono anch’essi un solo ordine pendente che include tutto. Su IG invece ogni ordine ha il suo SL e TP quindi se ho cinque ordini avrò 5 SL e 5TP separati. Come posso unificare lo SL e TP , mano a mano che aggiungo ordini ?

    Grazie

    #254296 quote
    robertogozzi
    Moderator
    Master

    Prova questo, che ad ogni nuova entrata calcola il nuovo Stop Loss e Target:

    DEFPARAM CumulateOrders = true
    ONCE SL = 200
    ONCE TP = SL * 2
    Sma = average[20,0](close)
    IF close CROSSES OVER Sma THEN
       BUY AT MARKET
       SET STOP   pLOSS close - SL*PipSize
       SET TARGET PRICE close + TP*PipSize
    ENDIF
    graphonprice TradePrice                 coloured("Blue")
    graphonprice PositionPrice              coloured("Red")
    graphonprice close - SL*PipSize coloured("Black)")  AS "Stop Loss"
    graphonprice close + TP*PipSize coloured("Fuchsia") AS "Target"
    graph (StrategyProfit - StrategyProfit[1]) / PipValue / abs(CountOfPosition) coloured("Red")
    graph (StrategyProfit - StrategyProfit[1]) / PipValue                        coloured("Blue")
    Iván González thanked this post
    #254298 quote
    Alessandro Furlani
    Participant
    Junior

    Grazie ma non mi risolve il problema, questo codice emette comunque un SL e un TP per ogni ordine, quello che vorrei è un comportamento simile a quello su IB, cioè un solo SL e un solo TP con SL e TP calcolati sul prezzo medio degli ordini emessi………

    #254305 quote
    robertogozzi
    Moderator
    Master

    Non è possibile, a quanto mi risulta.

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

StopLoss e Take Profit su IG


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzi
2 months ago.

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