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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      57 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      143 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      161 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      97 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X