NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 07-28-2009, 02:35 PM   #1
texasnomad
Senior Member
 
Join Date: Oct 2008
Location: Dallas, TX
Posts: 120
Thanks: 10
Thanked 2 times in 2 posts
Default 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;
             }
          }
texasnomad is offline  
Reply With Quote
Old 07-28-2009, 02:42 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

I suggest you check the Control Center log for errors. Please try using TraceOrders = true also to see what is happening with your orders.
NinjaTrader_Josh is offline  
Reply With Quote
Old 07-28-2009, 02:48 PM   #3
texasnomad
Senior Member
 
Join Date: Oct 2008
Location: Dallas, TX
Posts: 120
Thanks: 10
Thanked 2 times in 2 posts
Default

Thanks - it was a minbarsback issue.
texasnomad is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I Have No Trades Showing donatella Strategy Analyzer 2 05-06-2009 06:25 AM
Trades rtj4201 Miscellaneous Support 15 03-30-2009 05:23 AM
Total # of Trades Differ on Summary and Trades shiptastic Strategy Analyzer 4 01-08-2009 11:49 AM
Live trades not appearing in Positions tab but bogus trades showing up bluelou Automated Trading 5 10-16-2008 06:39 AM
Trades I Can't Account For jeremymgp Miscellaneous Support 3 02-28-2008 09:05 AM


All times are GMT -6. The time now is 01:05 PM.