NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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

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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 07-28-2009, 02:35 PM   #1
texasnomad
Senior Member
 
Join Date: Oct 2008
Location: Dallas, TX
Posts: 120
Thanks: 9
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
 

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 09:28 AM.