Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM Strategy in Automated Strategy

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

    #16
    for example, I've changed lines 71 to say:

    Code:
    			if ((orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])
    				&& (EMA(4)[0] > EMA(19)[0]))
    I've added this condition of one ema being over another. However, this strategy does not trade.

    Where does one input more lines of code to add conditions to the existing sampleATM strategy?

    Comment


      #17
      You can put these checks in a number of areas.

      Your statement is going to wait until all of those conditions are satisfied and it may be difficult to debug what condition is not returning true.

      To work around that, you can put the condition checks in separate blocks and add Print statements to the beginning of the blocks. This will help you identify exactly what part of the code is not true, and you can debug from there.

      for example:
      Code:
      				// checks your data condition
      				if(Close[0] > Open[0] && EMA(4)[0] > EMA(19)[0])
      				{
      					Print("Condition is true");
      					
      					//checks ATM Strategy is empty
      					if (orderId.Length == 0 && atmStrategyId.Length == 0)
                                              {
      						Print("ATM Strategy is empty");
      					
      						//rest of ATM logic goes here
      					}
      				}
      In this example, when the strategy is running, you can check the Tools--> Output Window and if your data condition is true, you should get "Condition is true" printed. If that is true, it will run through the rest of the logic and check your ATM Strategy. Once you're sure the logic is sound, you can remove these debug prints.
      MatthewNinjaTrader Product Management

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      650 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      370 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      577 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X