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 SalmaTrader, 07-07-2026, 10:26 PM
      0 responses
      47 views
      0 likes
      Last Post SalmaTrader  
      Started by CarlTrading, 07-05-2026, 01:16 PM
      0 responses
      22 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 06-17-2026, 10:32 AM
      0 responses
      15 views
      0 likes
      Last Post CaptainJack  
      Started by kinfxhk, 06-17-2026, 04:15 AM
      0 responses
      21 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 06-17-2026, 04:06 AM
      0 responses
      23 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X