![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jun 2012
Posts: 6
Thanks: 5
Thanked 0 times in 0 posts
|
Hello everyone. I am new to Ninja Trader and have no programming background hence I am using the strategy wizard to build my strategy. I have been building my strategy within the wizard and am starting to get more comfortable with it. However I've run into a problem I can't seem to solve. I need some help to place instructions using the wizard to sell once price drops below the lowest low in the last 10 days. Is this possible to do simply using the strategy wizard? Any help would be appreciated. Thanks!
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
|
Hello,
Thank you for your post and welcome to our forums! This would be possible, however it would require that you run the strategy on a Daily interval. You can easily setup this condition by Comparing the Price Data--> Close to the "Misc"--> "Lowest Bar" function, with 10 as the Period.
Matthew
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Matthew for this post: |
|
|
|
#3 |
|
Junior Member
Join Date: Jun 2012
Posts: 6
Thanks: 5
Thanked 0 times in 0 posts
|
Thanks for your quick reply. Setting up the condition is quite simple as you outlined, however, when I backtest this, it doesn't seem to capture my sell instructions. You mentioned running the strategy on a daily interval, where would I specify this? Just to make sure I'm inputting this correctly, I've put these instructions in the section where it says, "when the following conditions are true" in the wizard. I've then put "exit long" in the section where it says, "do the following" just to keep things simple. Did I input this correct and in the right spot/format?
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
|
Hello,
Yes, that should be in the correct place. When you're back testing the strategy in the Strategy Analyzer, you will have an option for the "Data Series" to test on. In order for the Lowest Bar period to look back 10 days, you would need to run the strategy on the Daily interval, rather than a tick or minute.
Matthew
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Matthew for this post: |
|
|
|
#5 |
|
Junior Member
Join Date: Jun 2012
Posts: 6
Thanks: 5
Thanked 0 times in 0 posts
|
Yes, in the strategy analyser I have the data series set to "day". I also have the minimum bars required set far back enough to allow the strategy enough time. But once again, my sell instructions are not being captured. That is my only exit condition. Any other thoughts/ideas?
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
|
Hello,
Instead of using the DefaultSeries, please try using Price Data--> Low as the series of the Lowest bar
Matthew
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Matthew for this post: |
|
|
|
#7 |
|
Junior Member
Join Date: Jun 2012
Posts: 6
Thanks: 5
Thanked 0 times in 0 posts
|
Thank you again, however, that still doesn't quite work for me. When I input the close as < the low of 10 bars ago, it only uses exactly 10 days ago as opposed to the lowest low in the last 10 days. Maybe I have this inputted wrong. Thanks for you patience on a simple issue.
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
|
Hello,
Sorry for the confusion - we need to be using MIN to get the lowest price. You will find this under Indicators--> Min The parameters you would use would be Period of 10 and Barsago of 1.
Matthew
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Matthew for this post: |
|
|
|
#9 |
|
Junior Member
Join Date: Jun 2012
Posts: 6
Thanks: 5
Thanked 0 times in 0 posts
|
OK, so I've tried using the MIN indicator as outlined, but it when I input the instructions like you've outlined, a sell signal is generated when the low goes below the lowest close of the last 10 days, not the low.
|
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
|
Did you run this on the "DefaultInput" or did you change that to "Low"?
Matthew
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Matthew for this post: |
|
|
|
#11 |
|
Junior Member
Join Date: Jun 2012
Posts: 6
Thanks: 5
Thanked 0 times in 0 posts
|
This worked, thank you very much!
|
|
|
|
|
|
#12 |
|
Member
Join Date: Jan 2009
Posts: 42
Thanks: 0
Thanked 0 times in 0 posts
|
hi - can you tell me how i would do a similar instruction via the GUI. I want to "exit" (a long) if price trades below - the low on the bar prior to entery if that can not be done than 25pip less than low of the bar upon which i entered the trade
|
|
|
|
|
|
#13 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello hifreq,
You cannot do it via the Strategy Wizard. You can however do it by unlocking the code and further edit it via the NinjaScript editor. As an alternative you can evaluate your code with the average entry price. The attached screenshot demonstrates how to exit a position if it is 25 below your average entry price.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Check order on a price level | er111222 | Strategy Development | 9 | 06-18-2012 04:09 AM |
| Position best price level | cgeorgan | General Programming | 3 | 03-06-2011 07:39 PM |
| Version 6.5.1000.9 drops Gain feed connection | popeyeuk | Connecting | 3 | 03-31-2009 11:09 AM |
| Price level colour on SuperDOM | garyford | Suggestions And Feedback | 1 | 03-02-2009 04:25 AM |
| SA drops indicators on backtest | Billy Valentine | Strategy Analyzer | 3 | 11-17-2008 03:12 PM |