Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to combine " if any" and 'if all in one condition in strategy builder

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

    How to combine " if any" and 'if all in one condition in strategy builder

    Dear Team,
    question1:

    I want to set a condition in strategy builder:
    if (Position.MarketPosition = MarketPosition.Short)
    {

    if(CrossAbove(MACD(12, 26, 9).Default, MACD(12, 26, 9).Avg, 3) || loss>10 )

    {
    Exit short;
    }

    }

    Since there is only if any and if all ,but how to combine them?

    question2:

    I want to set separate value of stop loss to long and short,but in strategy builder ,it seems that I can only set the same stop loss to long and short at the same time.
    Is any good way to solve this issue?

    Thank you very much!
    Last edited by williamzz; 07-03-2019, 03:26 PM.

    #2
    Hello williamzz, thanks for your note.

    You can make a group for your second conditional. In the set, first make this statement: if (Position.MarketPosition = MarketPosition.Short) and set it to if all

    Then add a group and set that group to "If any", then add these conditions to that group: if(CrossAbove(MACD(12, 26, 9).Default, MACD(12, 26, 9).Avg, 3) || loss>10 )

    On your second question: You must give your long and short orders unique signal names. Then you can make two pairs of stops and targets, one set for longs and the other for shorts. You will notice that the set stop loss and set profit target both take a signal name, match this up with the name you gave your orders.

    Kind regards.

    Comment


      #3
      Very helpful!
      Thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      77 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X