Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetTrailStop()

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

    SetTrailStop()


    Ok, when I enter a trade TraceOrders tells me...

    Entered internal PlaceOrder() method at 4/4/2007 11:30:00 AM: Action=SellShort OrderType=Limit Quantity=2 LimitPrice=1.3414 StopPrice=0 SignalName=EXTREME short 3 4/4/2007 11:30:00 AM' FromEntrySignal=''

    The TrailStop get's set to it's initial value, which is 12 ticks...

    Entered internal SetStopTarget() method at 4/4/2007 11:30:00 AM: Type=TrailStop FromEntrySignal='EXTREME short 3 4/4/2007 11:30:00 AM' Mode=Ticks Value=12 Currency=0 Simulated=False

    Then I run my TrackTrade() in OnBarUpdate()...

    if
    (Position.MarketPosition != MarketPosition.Flat) {

    if (Position.GetProfitLoss(Close[0], PerformanceUnit.Points) >= 4){

    int stopLoss = 2;

    Print(
    "Setting stop to "+stopLoss+" in "+instrumentName+" at "+Time[0]);

    SetTrailStop(orderName, CalculationMode.Ticks, stopLoss,
    false);

    }

    The Print() outputs properly, indicating that this indeed get's called, however,TraceOrders does not display that the TrailStop() get's changed from 12 to 2.

    Steer me in the right direction please.

    #2
    imported post

    This would suggest thatthis the SetTrailStop() is not getting called if there was no trace output. I checked our code and there is nothing once a call to this method is made that would prevent a trace ouput.

    The only thing left to do is start stripping down the strategy and debug.

    What I would do is create a base strategy that sets the initial trail stop in the Initialize() method, then in OnBarUpdate() call it again with a different offset value and run the strategy. This should show the trace output with the change.

    Then start adding components until you get to a point where it does not behave as expected.

    Ray
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X