Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PriceModification

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    PriceModification

    Hello,

    I´m still working with one problem I can not make clear: I want to move stoplosses referring to certain profits. I can modify ONE TIME the price to breakeven (or to a certain new stop) once the price is greater (lower) certain ticks. BUT I can not move it SEVERAL times eg when the price is eg 9 ticks in profit to breakeven (this first step of course is OK) BUT then when price is eg 20 ticks in profit setstoploss to Entry price +9 (or current price - 11) and when price is eg 40 ticks in profit setstoploss to Entry price +35( or current price -5). I´ve changed several times the IF and ELSEIF conditions but I can´t find the problem. When there are 2 condtions it is always filled the one with the smaller profit - even when I change the position and code the higher price before - but this should only be important with using ELSEIF and not with IF as with IF all condtions are examined even one is filled. (Of course I have read the "SamplePriceModification", but in this sample there is only one time moving the stoploss - and this works here too if I cancel the second condition).

    Thanks for your help.

    Hereby is the code the stoploss:

    if (Position.MarketPosition == MarketPosition.Flat)
    {SetStopLoss(CalculationMode.Ticks,
    9);}


    if ((Position.MarketPosition == MarketPosition.Long)
    &&(GetCurrentAsk(
    0) > Position.AvgPrice + 20 * TickSize))
    {SetStopLoss(CalculationMode.Price, Position.AvgPrice + 9 * TickSize);}

    if ((Position.MarketPosition == MarketPosition.Long)
    &&(GetCurrentAsk(
    0) > Position.AvgPrice + 40 * TickSize))
    {SetStopLoss(CalculationMode.Price, Position.AvgPrice + 35 * TickSize);}


    Best regards
    Tony


    Last edited by tonynt; 06-28-2010, 02:01 AM.

    #2
    Hi Tony, is this all happening intrabar so that both conditions would be only evaluated at the close of the bar?

    Have you checked which exact stop loss is working with the TraceOrders output?

    Are you sure you're this deep into profit to trigger the second adjustment at all?

    Comment


      #3
      Hi Bertrand,

      thank you for your reply. I have no idea what you mean, sorry.

      No matter what size I fill for profit or stop - only one works. No matter if first step is 10 and next 40, so both are not within one intrabar (as I work with 5 RangeBars).

      Thanks.

      Best
      Tony

      Comment


        #4
        Hi Tony, the trace orders output is very helpful in debugging your order behavior -



        For my second question, I would suggest you add visual confirmations (dots, arrows) to your stop adjustment conditions, as this will help checking if you're 40 ticks into profit for your positions to trigger the adjustment to + 35 ticks as you've outlined.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        56 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X