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.

Reply
 
Thread Tools Display Modes
Old 04-02-2010, 09:25 AM   #1
foxido
Junior Member
 
Join Date: Apr 2010
Location: New York
Posts: 1
Thanks: 0
Thanked 0 times in 0 posts
Default How to program stop on close at close price

Hi all, wondering if somebody could please help me with a small issue i'm having in the Ninjascript development on a strategy that uses daily data only.

My strategy generates a stop order everyday based on a historical indicator. I should be able to fill that stop order if the current daily bar has its low < stop order, and its high > stop order. If both these conditions are true, then I simply want to be filled at the stop level and then exit my position at the end of the day at the bar close.

I want to stick with daily data, not intraday, and this should be possible to implement, but so far I am having no luck. I have tried setting 'exit on close' to true but that doesn't help, I have also tried setting an exit condition based on the current bar being <> previous bar, but that also failed.

Any simple solutions to this? Thank you for your help and time!
foxido is offline  
Reply With Quote
Old 04-02-2010, 09:33 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

foxido, welcome to our forums and thanks for the post - unfortunately you would need to work with intraday data in this case to be able to submit orders to a finer timeseries to exit on the close or slightly before it. The general concept can be reviewed here -

http://www.ninjatrader-support2.com/...ead.php?t=6652

For realtime trading, you could also program a time condition into the strategy and set CalculateOnBarClose to false -

http://www.ninjatrader-support.com/H...BarClose1.html
NinjaTrader_Bertrand is offline  
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
Exit-on-close handling initiated after market close tooearly Automated Trading 3 08-05-2009 08:07 AM
CrossAbove Close & Close[0] different results un$ane Strategy Development 6 06-05-2009 09:59 AM
Enter at Close, Exit next day Close tjendra Strategy Development 3 04-08-2009 11:33 AM
Startegy involving previous day close price and current open price kirankksimon General Programming 3 03-11-2009 08:59 AM
Charting high/low/close and open/close widths gluebunny Charting 11 09-29-2008 10:47 AM


All times are GMT -6. The time now is 10:37 AM.