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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X