![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Oct 2008
Location: Dallas, TX
Posts: 120
Thanks: 10
Thanked 2 times in 2 posts
|
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, "");
}
}
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 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
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
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Oct 2008
Location: Dallas, TX
Posts: 120
Thanks: 10
Thanked 2 times in 2 posts
|
Thanks - it was a minbarsback issue.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |