![]() |
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
|
|||||||
| 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: 9
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;
}
}
|
|
|
|
| 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 |