![]() |
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 |
|
Junior Member
Join Date: Dec 2008
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
Hello,
I have a strategy which enters a trade after a few different indicators are triggered within the first condition. I than have set a profit target, if the position reaches the targt it's closes out. However, I would like to reenter the position and I set a very simple entry to do so. My problem is that I cannot get the second entry to work. I have enclosed the strategy. Obviously, my condition 2 set is not right and I have tried to hunt around in the help forum but with no luck. Can someone tell me what I'm doing wrong? Thank you. // Condition set 1 if (CrossAbove(EMA(Fast), SMA(Slow), 1) && Rising(Momentum(10)) == true && MACD(12, 26, 9).Avg[1] >= 0) { EnterLong(1, "Long 1"); } // Condition set 2 if (Position.MarketPosition == MarketPosition.Flat && Close[1] > Fast) { EnterLong(1, "Long 2"); |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
I do not see anything wrong with your code. You will need to debug it. This link will help: http://www.ninjatrader-support2.com/...ead.php?t=3418 Try printing out the Fast variable right before the condition 2: Print("fast " + Fast);
Ben
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Long ? short when flat vs. position | ju1234 | Strategy Development | 1 | 11-21-2008 07:16 AM |
| How to return the Position Entry Price?? | Ninja in Training | Strategy Development | 3 | 08-05-2008 10:06 AM |
| position flat trading 2 strategies on same instrument | ceesvh | Automated Trading | 3 | 08-29-2007 01:48 PM |
| Flat a position on a market | Respond | SuperDOM and other Order Entry Windows | 2 | 06-27-2007 08:51 AM |
| Incorrect position entry on SIM | EuroFX | Miscellaneous Support | 12 | 09-24-2006 01:33 PM |