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

ExitLongStopLimit seems to work, but ExitShortStopLimit does not

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

    ExitLongStopLimit seems to work, but ExitShortStopLimit does not

    Hi NT8,

    the title says it all, I have code posted below, first two show the code for the ExitLongStopLimit - working correctly - the stop limit order appears the whole time I am in the trade. When I do the same code for shorts but reversed, I get an error message that the ExitShortStopLimit cant be a lower price than my target limit price.


    Here is the code block beginning with long entries
    Click image for larger version  Name:	Capture4.png Views:	0 Size:	18.3 KB ID:	1274240
    ^^The one just above this sentence is the stop, and the target is an ExitLongLimit order triggered by a target criteria, It works as intended, I have a stop limit stop, and it does not interfere with the target when the target is triggered
    Click image for larger version  Name:	Capture2.png Views:	0 Size:	15.1 KB ID:	1274243


    Here is the Shorts code block: it is the exact same as the longs code block but reversed logic for shorts
    ​​​​​
    Click image for larger version  Name:	Capture.png Views:	0 Size:	20.5 KB ID:	1274244
    Same as the longs - the two code lines just above this sentence are the stop limit - to act as a stop for this trade, the code lines below are the target = once the target is triggered, I want a limit order to appear to exit the trade, however, it does not work like the longs logic does

    Click image for larger version

Name:	Capture6.png
Views:	61
Size:	10.5 KB
ID:	1274245


    I always get the error message below when I enter the trade (even before the target is triggered). Now, if I simply add a // to the code line to ExitShortStopLimit, the trade works as intended - entry is good, and target exit is also good (works), but the trade has no stop, which is why I need the ExitShortStopLimit order.

    Click image for larger version  Name:	capture 3.png Views:	0 Size:	27.7 KB ID:	1274242
    Attached Files
    Last edited by Austiner87; 10-22-2023, 09:31 PM.

    #2
    Hello Austiner87,

    Thank you for your post.

    In order to better understand how the code is working, it will be necessary to use Print to see how the conditions are evaluating.

    Buy stop market orders must be placed above the current Ask price. Try printing the stop price and the GetCurrentAsk() price to confirm the buy stop price is above the ask.

    GetCurrentAsk - https://ninjatrader.com/support/help...currentask.htm

    Below is a link to a forum post that demonstrates using prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.

    https://ninjatrader.com/support/foru...121#post791121

    Please let us know if you have any other questions.
    Gaby V.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rhyminkevin, Today, 04:58 PM
    0 responses
    16 views
    0 likes
    Last Post rhyminkevin  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    6 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    49 views
    0 likes
    Last Post futtrader  
    Started by Option Whisperer, Today, 09:55 AM
    1 response
    15 views
    0 likes
    Last Post bltdavid  
    Working...
    X