Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

ADX Strategy not working

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

    ADX Strategy not working

    Hello,

    I have created a code and one of the conditions is that it enters a position when the ADX exceeds the 45 level. During backtesting it works great, but when live testing it doesn't. Please find below my code and attached screenshot of the trades the strategy took live. I have marked the short entries in red and the longs in green. My CalculateOnBarClose() is set to true.

    PHP Code:
     if (ADX(MyADX)[0] > 45
                    
    && ATR(MyATR)[0] < MyATRLevel                                    
                        
    && CrossBelow(RSI(MyRSI1).AvgMyLowerLevel1)    
                            && 
    Position.MarketPosition == MarketPosition.Flat)  
                {    
                    Print(
    MyATRLevel);
                    
    MyPositionSize = (int) (myRiskAmount 0.002);
                    
    EnterLong(MyPositionSize"Enter long");                            // Enter long
                

    Any ideas?

    Thanks.
    Attached Files

    #2
    Hello Bruin813,

    Thank you for writing in and welcome to the NinjaTrader Support Forum!

    I notice that there is a (D) next to the name of your strategy on the chart. This would mean that the strategy is disabled.

    Have you enabled the strategy when you have added it to the chart?

    Right-click on your chart and select Strategies.

    Select your strategy and ensure the Enabled option within the General category is set to True. Then, click OK.

    Please let me know if your strategy still has not traded when ensuring it was enabled.
    Last edited by NinjaTrader_ZacharyG; 07-23-2016, 12:10 PM.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Dear Zachary,

      Thanks for the quick response.

      The strategy has been working last week. The screenshot is from today, so that explains why the strategy is disabled.

      Comment


        #4
        Hello,

        Did anyone of the support team had a chance to look at my question?

        Thanks.

        Comment


          #5
          Hello Bruin813,

          What debugging steps have you already done with your strategy?

          Have you added print statements to your strategy to check if your conditions are becoming true in real-time?

          In the strategy add prints that print the values of every variable used in every condition that places an order along with the time of that bar.

          This will print to the output window.

          Below I am providing a link to a video that demonstrates adding prints to a script to get further information about the behavior of the script.

          Dive into manipulating C# code from within an unlocked NinjaScript strategy using the NinjaScript Editor.NinjaTrader 7 is an award winning end to end online ...


          Are you seeing your conditions becoming true but the strategy not entering?
          Zachary G.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by zstheorist, Today, 07:52 PM
          0 responses
          3 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          149 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          5 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          5 views
          0 likes
          Last Post tkaboris  
          Working...
          X