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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    90 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X