Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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:
    https://ninjatrader.com/support/foru...ne#post1175972

    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");

    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by abctrader, Today, 06:03 PM
    1 response
    24 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Liquidfusion, Today, 06:16 PM
    0 responses
    19 views
    0 likes
    Last Post Liquidfusion  
    Started by fscabrera03, Today, 04:58 PM
    0 responses
    24 views
    0 likes
    Last Post fscabrera03  
    Started by patpat, Today, 03:56 PM
    2 responses
    34 views
    0 likes
    Last Post patpat
    by patpat
     
    Started by joselube001, Yesterday, 07:40 PM
    3 responses
    88 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X