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 NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    127 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X