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 10-11-2008, 06:49 PM   #1
tahoebry
Junior Member
 
Join Date: Oct 2008
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Execute on price HOD

I'm trying to plan some executions around the High of the Day and the Low of the Day.

What is the easiest way to do this in the condition builder? Can't seem to figure out how to get it to find the HOD or LOD

Thanks
tahoebry is offline  
Reply With Quote
Old 10-12-2008, 12:14 AM   #2
NinjaTrader_RJ
NinjaTrader Customer Service
 
NinjaTrader_RJ's Avatar
 
Join Date: Jul 2008
Location: Denver, CO, USA
Posts: 1,828
Thanks: 4
Thanked 19 times in 18 posts
Default

Hello,

Thank you for your post.

In the condition builder of Strategy Analyzer, you will find High/ Low wich you can set to the current bar, or day.

Please see my attachments as an example.
Attached Images
File Type: jpg condition builder.JPG (55.3 KB, 19 views)
File Type: jpg Conditions.JPG (52.4 KB, 16 views)
NinjaTrader_RJ is offline  
Reply With Quote
Old 10-12-2008, 10:17 AM   #3
tahoebry
Junior Member
 
Join Date: Oct 2008
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Just to clarify

When I plugged in your sample, it triggered trades from high's above bars and not triggering trades only at the HOD. Did I need to change something to make it HOD instead of at a bar?

Thanks,
Bryan
tahoebry is offline  
Reply With Quote
Old 10-13-2008, 10:00 AM   #4
NinjaTrader_RJ
NinjaTrader Customer Service
 
NinjaTrader_RJ's Avatar
 
Join Date: Jul 2008
Location: Denver, CO, USA
Posts: 1,828
Thanks: 4
Thanked 19 times in 18 posts
Default

Hello,

Can you please explain to me the exact condition you are looking for?

Do you wish to enter your trade after the current price exceeds yesterday's high?

Do you wish to enter your trade after the current price makes a new high for the current day? If so, you need to specify the time range, 1 hour high, 30 min high, etc.
NinjaTrader_RJ is offline  
Reply With Quote
Old 10-14-2008, 07:26 AM   #5
tahoebry
Junior Member
 
Join Date: Oct 2008
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Trade just below current high of day

I wish to setup trades just below the current high of the current day. Also sell just above the current low of the current day.

I see you say 1 hour high, 30 min high.... How do you set DAY high or DAY low?

When I plug it in, it is executing trades based on bars back. Not based on price back.

Thanks for your help.
tahoebry is offline  
Reply With Quote
Old 10-14-2008, 10:58 AM   #6
NinjaTrader_RJ
NinjaTrader Customer Service
 
NinjaTrader_RJ's Avatar
 
Join Date: Jul 2008
Location: Denver, CO, USA
Posts: 1,828
Thanks: 4
Thanked 19 times in 18 posts
Default

Hello,

You will need to use the indicator CurrentDayOHL and set the plot to Current High.
NinjaTrader_RJ is offline  
Reply With Quote
Old 10-14-2008, 03:58 PM   #7
tahoebry
Junior Member
 
Join Date: Oct 2008
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Almost there

So do I put those on both sides with a "==" in the middle? like you had mentioned below?

Trades are still executing above the lowest price of the day and not enough trades are being made.

It looks like it is executing on the open or close of a candle and not within a candle.

Thanks
tahoebry is offline  
Reply With Quote
Old 10-14-2008, 05:13 PM   #8
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Post up screenshots of what you have now so we can better assess the next step. Thanks.
NinjaTrader_Josh is offline  
Reply With Quote
Old 10-16-2008, 04:10 PM   #9
tahoebry
Junior Member
 
Join Date: Oct 2008
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Here are some pics about problem

Here are some pics about the problem..



You will at 9:17 a.m. it executes a short higher than the current LOD of 1282.25.. Why?

Is this a simple change.
Attached Images
File Type: jpg LOD3.JPG (68.5 KB, 9 views)
File Type: jpg LOD1.JPG (53.0 KB, 7 views)
File Type: jpg LOD2.JPG (26.4 KB, 11 views)
tahoebry is offline  
Reply With Quote
Old 10-16-2008, 04:18 PM   #10
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Hi tahoebry,

Your code looks correct. Possible reason could be that the bar's low is actually the current day's low, but since you are submitting market orders it just happened to fill at a higher price. This can happen and the only way to prevent would be to use limit orders.
NinjaTrader_Josh 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
Market Trades don't always execute malbeth35 Strategy Development 4 09-24-2008 05:36 PM
Order won't execute? edgeliner General Programming 11 12-12-2007 09:01 AM
What bar does order execute? Folls Strategy Development 1 05-15-2007 01:22 PM
Failed to execute DB job ratherBgolfing Automated Trading 7 04-14-2006 05:18 AM
Failed to Execute error werosen Miscellaneous Support 7 01-12-2006 02:57 AM


All times are GMT -6. The time now is 08:10 PM.