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 is triggered incorrectly!

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

    SetStopLoss is triggered incorrectly!

    Hi,

    I am using a stop loss method:
    SetStopLoss("EnterShortLimit_Mid-BB0", CalculationMode.Ticks, stopTarget, true);

    It works perfectly unless I enter, for example, a short trade at 1.1477 and the open of that bar(time frame) is greater then 80 pips.

    Attached is an image showing a 30 min time frame with an 80 pips SetStopLoss. I go in at 1.1477 and the opening of that bar is 1.1561, which is 1.1477 - 1.1561 = -84pips. But you can see the other bet in the same bar goes in at 1.1500 and the stop loss is not triggered...

    What am I missing? I know that the trade did not go out properly because that would mean the price would have had to dropped to 1.1477 and then go back up to 1.1561 and then all the way down to close all in 30min. And this would have happened twice in a row because the bar before the above trade has the same issue.

    I am using two timeframes, a 30 min which is what you see in the cart and a 1 min timeframe that I use for my entryOrders. So where does that leave my SetStopLoss orders in regards to time, ticks I believe...? I have placed my SetStopLoss' inside of the Initialize() method and inside of both 30 and 1 min time frame but I always get the same result.

    Thanks for thoughts!!
    4D
    Attached Files

    #2
    Hello,

    thank you for the question.

    I am unsure based on the image and description with what is happening. Have you started any type of debugging on this item?

    Being that it seems there is a specific value you can use to cause this, you may be able to narrow down what is happening in the code by using Print statements.

    If you are unable to locate the problem in the logic you could also post a very simplified example of the logic being used for the entry and stop so we could see if anything else sticks out that may be the cause.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by alifarahani, Today, 09:40 AM
    2 responses
    12 views
    0 likes
    Last Post alifarahani  
    Started by junkone, Today, 11:37 AM
    3 responses
    15 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by pickmyonlineclass, Today, 12:23 PM
    0 responses
    1 view
    0 likes
    Last Post pickmyonlineclass  
    Started by frankthearm, Yesterday, 09:08 AM
    12 responses
    44 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by quantismo, 04-17-2024, 05:13 PM
    5 responses
    35 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X