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 Barry Milan, Today, 10:35 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by WeyldFalcon, 12-10-2020, 06:48 PM
          14 responses
          1,427 views
          0 likes
          Last Post Handclap0241  
          Started by DJ888, Yesterday, 06:09 PM
          2 responses
          9 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          40 views
          0 likes
          Last Post jeronymite  
          Started by bill2023, Today, 08:51 AM
          2 responses
          16 views
          0 likes
          Last Post bill2023  
          Working...
          X