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 trilliantrader, 04-18-2024, 08:16 AM
    5 responses
    22 views
    0 likes
    Last Post trilliantrader  
    Started by Davidtowleii, Today, 12:15 AM
    0 responses
    3 views
    0 likes
    Last Post Davidtowleii  
    Started by guillembm, Yesterday, 11:25 AM
    2 responses
    9 views
    0 likes
    Last Post guillembm  
    Started by junkone, 04-21-2024, 07:17 AM
    9 responses
    68 views
    0 likes
    Last Post jeronymite  
    Started by mgco4you, Yesterday, 09:46 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X