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 10-30-2011, 07:11 PM   #1
pandyav
Member
 
Join Date: Oct 2011
Posts: 70
Thanks: 2
Thanked 1 time in 1 post
Default Executing only single trade if a condition is fulfilled

I am experimenting with a simple strategy that when SMMA (Smoothed Moving Average) for current bar is grater than the SMMA for the previous bar - go long.

My profit target is 10 points on ES. The challenge is once I hit the profit target, the ATM strategy immediately places another long trade if SMMA is on rise and is increasing. I do now want this to happen. I'd like to place only one trade every time the condition is fulfilled.

Ideally the next trade will be a short one when SMMA stars going down and then long again.

Is there a way to code this in NT so that only one trade is placed in one direction?

Many Thanks.
pandyav is offline  
Reply With Quote
Old 10-31-2011, 06:34 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,570
Thanks: 262
Thanked 1,018 times in 999 posts
Default

You could either do this with user variables / boolean flags as showcased in this example -

http://www.ninjatrader.com/support/f...ad.php?t=15417

or you would express your entry rule with a cross over condition so it would not evaluate to 'true' on a only rising SMMA value.

http://www.ninjatrader.com/support/h...crossabove.htm
NinjaTrader_Bertrand is online now  
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
Executing a trade at a specific time ExactlyMyPoint Strategy Development 3 02-11-2011 01:55 PM
Prevent strategy from executing trade at the same price level within a session suprsnipes Strategy Development 1 03-01-2010 03:08 AM
How can I set the app so that a single 100-contract trade is listed as 1 trade? Kovacs Miscellaneous Support 1 12-08-2008 05:12 PM
Enetering Multiple Orders with Single Condition daven Automated Trading 1 09-26-2008 04:03 PM
Long trade, executing shorts Dunthrin Automated Trading 15 07-11-2007 09:49 AM


All times are GMT -6. The time now is 02:14 AM.