Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dynamic Trailing Stop does not work!

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

    Dynamic Trailing Stop does not work!

    I am implementing a strategy to test my indicator and the Long/Short Entry is okay but the dynamic trailing stop is not working......

    I am printing out the Trailing Stop and the variable 'TrStop[0]' is getting updated properly but the Long/SHort positions are not being stopped out properly - seems to be getting stopped out next bar after entry at market??????!

    Here is the snippet of code in question

    if (Position.MarketPosition == MarketPosition.Long)
    {
    SetTrailStop("", CalculationMode.Ticks, TrStop[0], false);
    Print("LX_Stop == 0: Date and Time "+Time[0]+" TrStop[0] is "+TrStop[0]+" Trendflo is "+Trend_flo);


    Here is the printout (based on AAPL EOD Data from Yahoo)

    Long Entry 100 @92.77
    LX_Stop == 0: Date and Time 05/02/2009 00:00:00 TrStop[0] is 86.5045461142569 Trendflo is 1
    Trend_flo == 0: Date and Time 06/02/2009 00:00:00 TrStop[0] is 89.8318350394715 Trendflo is 1 << Get Stopped out at 97.02 yet stop is 89.8318350394715 ???????

    Using Yahoo EOD data feed for backtesting

    Under Format > Strategies whats the difference between "ByStrategyPosition " and "PerEntryExecution" for "Stop & target submission ??

    Where canI find a complete manual on Format > Strategies ?


    }

    #2
    Got confused as to what I was doing....

    Trailing Stop is a function of the current price

    whereas I have calculated the actual Stop Price Value and I should be using

    if (Position.MarketPosition == MarketPosition.Long)
    {
    ExitLongStop(TrStop[0]);
    }

    if (Position.MarketPosition == MarketPosition.Short)
    {
    ExitShortStop(TrStop[0]);
    }

    Comment


      #3
      mefTrader, correct this would mean it's placed for the next bar and can execute 'intrabar'.

      Please see this link on the helpguide reference question you had -

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X