Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question regarding putting a dynamic trailing stop

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

    Question regarding putting a dynamic trailing stop

    Hi,
    I am using a Tick chart.
    I am using setTrailStop in my OnBarUpdate method. I want to make sure that the trailing stop moves along with the price if in favor. What i find with my code is that the trailing stop does move but it sets it based on the closing value. I need to set it within the same bar if price is moving in my direction.

    For example, if i am long at 10231 on the YM and it goes to 10240 on the same bar and the bar has not ended, i want the trailing stop to up by 23 -9 ticks, not wait for the closing bar and then decide.
    (23 is just a number i use for initial trail stop)

    Instead of using Close[0] can i use something else which gives me the current price value at that moment, so i can use that in my setTrailStop method?

    I have a code snippet like:


    SetTrailStop(CalculationMode.Ticks,23 - (Close[0] - Position.AvgPrice));
    ...
    Last edited by tradernith; 11-13-2009, 06:07 PM.

    #2
    never mind, i think the current setTrailStop works for me, i wasn't looking at it the right way

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    88 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    48 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    30 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    34 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    68 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X