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

No trades

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

    No trades

    If I use this code the strategy places a trade.
    Code:
            protected override void OnBarUpdate()
            {
               if (ParabolicSAR(0.02, 0.2, 0.02)[1] > Close[1]
                    && ParabolicSAR(0.02, 0.2, 0.02)[0] < Close[0]
                    && Position.MarketPosition == MarketPosition.Flat)
                {
                    EnterLong(Lots, "");
                }
            }
    If I use this code, no trades enter. What's wrong here?
    Code:
    protected override void OnBarUpdate()
            {
                double atr, stop;
                
                if (ParabolicSAR(0.02, 0.2, 0.02)[1] > Close[1]
                    && ParabolicSAR(0.02, 0.2, 0.02)[0] < Close[0]
                    && Position.MarketPosition == MarketPosition.Flat)
                {
                    EnterLong(Lots, "");
                    sdev = CalculateSDev(SDEV_LOOKBACK);
                    atr = ATR(14)[1] * ATR_MULTIPLIER;
                    stop = Close[0] - atr;
                 }
              }

    #2
    I suggest you check the Control Center log for errors. Please try using TraceOrders = true also to see what is happening with your orders.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks - it was a minbarsback issue.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cyberpete76, 03-27-2023, 12:29 AM
      7 responses
      267 views
      1 like
      Last Post slightly  
      Started by renewsaltwater, Today, 01:15 AM
      0 responses
      2 views
      0 likes
      Last Post renewsaltwater  
      Started by slightly, Today, 12:49 AM
      0 responses
      4 views
      0 likes
      Last Post slightly  
      Started by sdauteuil, 09-23-2021, 10:16 AM
      4 responses
      1,210 views
      0 likes
      Last Post jacobpescaia44  
      Started by agclub, 04-21-2024, 08:57 PM
      5 responses
      39 views
      0 likes
      Last Post agclub
      by agclub
       
      Working...
      X