Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with "OR"

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

    Problem with "OR"

    Hello,

    when I add a condtion with "OR" (= "||") I get many entries in the script strategies. Everything works fine but when I add like herein this example some condtions with OR (in red color) then I have not 2 entries (limited with tradecounter) but 2011 entries. I do not understand what is wrong.

    if (tradecounterLP8 < maxtradesLP8
    && Position.MarketPosition == MarketPosition.Flat
    &&Rising(MACD(BarsArray[2],5, 20, 30).Avg) == true
    && Rising(Stochastics(BarsArray[5],7,14,3).D) == true|| Rising(Stochastics(BarsArray[4],7,14,3).D) == true|| Rising(Stochastics(BarsArray[3],7,14,3).D) == true
    && Close[1] < Open[1]
    && Close[0] > Open[0])


    Thank you
    Tony

    #2
    Hello tonynt,
    You should consolidate the OR logics as shown below.

    if (tradecounterLP8 < maxtradesLP8 && Position.MarketPosition == MarketPosition.Flat
    &&Rising(MACD(BarsArray[2],5, 20, 30).Avg) == true && (Rising(Stochastics(BarsArray[5],7,14,3).D) == true|| Rising(Stochastics(BarsArray[4],7,14,3).D) == true|| Rising(Stochastics(BarsArray[3],7,14,3).D) == true)
    && Close[1] < Open[1]
    && Close[0] > Open[0])

    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thank you!

      Originally posted by NinjaTrader_Joydeep View Post
      Hello tonynt,
      You should consolidate the OR logics as shown below.

      if (tradecounterLP8 < maxtradesLP8 && Position.MarketPosition == MarketPosition.Flat
      &&Rising(MACD(BarsArray[2],5, 20, 30).Avg) == true && (Rising(Stochastics(BarsArray[5],7,14,3).D) == true|| Rising(Stochastics(BarsArray[4],7,14,3).D) == true|| Rising(Stochastics(BarsArray[3],7,14,3).D) == true)
      && Close[1] < Open[1]
      && Close[0] > Open[0])

      Please let me know if I can assist you any further.

      Comment


        #4
        Hello tonynt,
        Glad you could solve the issue.
        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        5 responses
        3,290 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        6 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        8 responses
        61 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        8 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        24 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X