Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

trigger when strategy NOT met

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

    trigger when strategy NOT met

    Hello,

    Let's say I have a custom strategy called "apples", with criteria in it to trigger an action. Let's say I have another called "oranges", with a different set of criteria.

    I would like to create a trigger that basically says, if neither of those strategies are triggered, take a certain action (buy/sell/etc).

    Is it possible for a custom strategy in NT to reference other strategies which I have saved?

    EDIT: I've seen other posts that say calling outside strategies into a current running strategy doesnt work.

    So then lets say I have this....

    if ( indicator1 > 10
    && indicator2 > 300

    {buy etc}

    if ( macd > 1
    && bollinger > 2)

    {sell etc}

    so here, i have 2 conditions in 1 strategy....but....i would like there to be a condition here that says, if neither of these are met, then take a different action.
    Last edited by Bobbybattles; 05-10-2021, 06:59 PM.

    #2
    Hi Bobbybattles,
    You could add/use a bool (e.g. "CanDoTheTrade") and set it to "false", if the first or/and the second condition set is true.
    Only if the first and the second condition are false, set the CanDoTheTrade to "true", then allow the strat to fire.

    if ((first condition set) || (second condition set))
    { CanDoTheTrade = false; }
    else { CanDoTheTrade = true; }

    if ((CanDoTheTrade = true) && (third condition set)
    {
    Fire off the trade;
    CanDoTheTrade = false; (optional)
    }

    NT-Roland


    Last edited by NT-Roland; 05-11-2021, 01:09 AM.

    Comment


      #3
      Hello BobbyBattles,

      Thank you for your post.

      You could write to static variables in an addon to have strategies share variables with one another.

      See the sample script created by my colleague Chelsea in this forum post demonstrating the use of static variables.


      Let us know if we may assist further.
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      559 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      546 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X