• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Does anyone have trouble with SetStopLoss()?

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

    Does anyone have trouble with SetStopLoss()?

    Hi,

    Before I proceed to say that I think something is wrong with the SetStopLoss(), does anyone else run into some difficulties if they try to change your SetStopLoss based on conditions that take place. My conditions are not that difficult and when I try to do anything dynamic with stop-losses, crazy things start to happen:

    Here is something very simple that I tried and things started acting up:

    I had my original stop-loss set to 15 pips. Once 3 bars have passed and I haven't hit my target, I then proceeded to move my stop-loss to breakeven if I'm already ahead, but didn't hit my profit target yet.



    One thing I discovered is that you must have a SetProfitTarget set if you would like to open an order. Sometimes, I don't need to use the profit target function because I just use my dynamic SetStopLoss function instead. I'm assuming that it is something else that is under-the-hood that I don't know about.

    When I said some strange is happening, I mean that the code can be acting just right and then I add another condition to it with a SetStopLoss, the strategy stops entering trades.

    NOTE: Okay I realized that I can combined two of those if-statements and I will fix that when I clean up my code.
    Last edited by BernWillChris; 08-15-2015, 05:48 PM.

    #2
    Hello BernWillChris,

    Thank you for writing in.

    Could you please clarify this statement:
    One thing I discovered is that you must have a SetProfitTarget set if you would like to open an order."
    You do not need to have a profit target set to open an order. I would need to see more of your code to determine what was causing the issue.

    Could you also please confirm that the code snippet you have sent is having issues without needing to be modified further?

    When I said some strange is happening, I mean that the code can be acting just right and then I add another condition to it with a SetStopLoss, the strategy stops entering trades.
    Are you receiving any errors in your log tab? Does this always happen when you add the additional condition or only sometimes? I would need to see more of your code as this issue may or may not be related to SetStopLoss.

    Thank you in advance.
    Michael M.NinjaTrader Quality Assurance

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SAILIKITY, 05-22-2019, 05:41 PM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by rmillar, 01-09-2019, 06:02 PM
    6 responses
    60 views
    1 like
    Last Post eDanny
    by eDanny
     
    Started by mlarocco, Today, 11:39 AM
    4 responses
    19 views
    0 likes
    Last Post mlarocco  
    Started by roblogic, Today, 11:19 AM
    2 responses
    15 views
    0 likes
    Last Post roblogic  
    Started by saeed, Today, 10:17 AM
    8 responses
    48 views
    0 likes
    Last Post NinjaTrader_Kate  
    Working...
    X