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

Using "Signal Name" as Input?

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

    Using "Signal Name" as Input?

    Hi,
    I'd like to be able to create a rule that prevents the next trade if the last historical trade was a "Stop Loss".
    Rough logic being something like:

    Last "Exit Name" does not equal "Stop Loss"
    or
    Last:SignalName:ExitName:StopLoss = False.

    Is there a simple way to access this? Is there a different way to accomplish this goal?

    Thanks for any ideas - Marcus

    #2
    Hello mazcis,

    Thank you for your note.

    For something like this, you'd need to manually code the strategy, just in case you're using the Builder currently.

    I think the best route here would be create a bool set to true, and to monitor in OnExecutionUpdate for when you have an order come in that has a status of filled or partially filled that also has the same signal name you've set for your stop loss, and if it it does match, set the bool to false, and if any other kind of order comes in, set it to true.

    You could then check the bool in On Bar Update in your conditions for entry, and not allow entry if the bool is false. You'd probably want more logic to reset it to true if conditions look right to reallow trading, or it would just cease trading at the point that the bool becomes false.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    147 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    5 views
    0 likes
    Last Post tkaboris  
    Started by GussJ, 03-04-2020, 03:11 PM
    16 responses
    3,282 views
    0 likes
    Last Post Leafcutter  
    Working...
    X