Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss Question

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

    SetStopLoss Question

    Chris, if I am following you correctly as per your reply here, "Hello RonnieB, thanks for your post.

    You can call SetStopLoss within OnBarUpdate to dynamically change your stop. Set Calculation mode to CalculationMode.Price and then pass in the EMA value for the current bar, so that would be something like:

    SetStopLoss(CalculationMode.Price, EMA3[0]);

    One thing to note will be if you are long or short. If you are long you would want to make sure you are placing the sell stop below the market price and opposite that for short positions.

    Please let me know if I can assist any further with this.". Now if I am following correctly, the setting could be anywhere in OnBarUpdate, and even have two one in the execution block of code for long entry, and also short entry. It would have to first line in the execution code. Thanks in advance for your reply.

    Thanks John

    #2
    Hi John, thanks for posting.

    This question is in reference to this post:
    I'd like my strategy to have a trailing stop based on a user defined amount from a particular EMA indicator line. I've got 3 indicator lines in the strategy defined


    You can call SetStopLoss anywhere. You can target specific entries by using the "FromEntrySignal" parameter e.g.

    //SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool isSimulatedStop)

    Long Entry Condition:
    SetStopLoss("Long1", ...) //rest of the parameters.
    EnterLong("Long1");
    Short Entry Condition:
    SetStopLoss("Short1", ...); //rest of the parameters
    EnterShort("Short1");

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    72 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    39 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X