Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Building Strategy where I only trade when Stochastics is between 10 and 60
Collapse
X
-
Hello kelliot,
Welcome to the forum and thanks for your post. I will be glad to help you get started with the strategy wizard and build a sample for you to review. I would like to clarify your request with the following questions:
1) When you say to trade between 10 and 60, are you referring to both the %k and the %d lines between those values?
2) Are you looking for the strategy to give you a signal of some kind when those conditions exist?
3) Do you have any other trade entry conditions to consider?
I look forward to your response and again welcome!
-
1) When you say to trade between 10 and 60, are you referring to both the %k and the %d lines between those values?
I am speaking of %d line, I believe. when the two line cross above but I only want to trade when i am between the 10 and 60 percent scale on the right side of the chart.
2) Are you looking for the strategy to give you a signal of some kind when those conditions exist?
see attached
3) Do you have any other trade entry conditions to consider?
Comment
-
Hello kelliot,
Thank-you for the reply. It looks like your attachment didn't get attached, please try again.
From what you wrote, I think I understand that the strategy should consider when the stochastics %D and %k lines cross above the 60 line and the %d is less than the 60 line you want to enter short? If true do you want the opposite action when the lines cross below 10 and the %d line goes above the 10 line to enter long? Or do you just want an indication/marker on the chart that the condition exists? A marker can be a shape such as a dot, cross, diamond. Other options are coloring background, candles, etc. So there really is a lot that can be done and it is just a matter of definition.
I look forward to your response
Comment
-
Comment
-
Hi Ken,
Thanks for the attachment. It looks like you are off to a good start using the wizard and I can see that there is considerably more information needed in order to be able to help you along. I see you are using the macd as well as stochastics for entry decisions and I am trying to understand when the %d line fits.
Would you be able to take a chart and mark on each of the indicators where your long entry would be and the same for your short entry? Just a vertical line for long and one for short is all I need. This would help me to understand all of the conditions needed to meet your needs.
Thanks for your patience as we work through this, I look forward to your response.
Comment
-
Hi Trader Paul,
I am interested in trading long only when the macd crosses above and the stochastics crosses up with the %d between 10 and 60 percent. see attached 600 chart sample.
my question is how to constrain the %d between 10 % and 60 %.
Thanks
KenAttached Files
Comment
-
Hi Ken,
Thanks for the clarifying information and chart. I created a strategy in the wizard to test out and attached are the screen shots of the wizard settings to use along with a chart showing the strategy in use. I set the strategy to output Blue dots showing where the long entries would be. I used two variables: Upper and Lower in case there was a need to change the 60 and 10 lines.
Briefly, I used the macd cross above and both macd lines below zero and the stochastic %d line above 10 and below 60. For short entries you would flip the logic, macd cross below, both macd lines above zero and the stochastics %d line below 60 and above 10. Where the blue dots show is where your long entry would go.
Please let me know if I can be of further assistance.
Comment
-
Hi Ken,
Thank-you for post.
We cannot provide trading advice in regards to which bar type or time-frame is better. This is an individual trader decision to make. To facilitate making such decisions NinjaTrader has a built in strategy analyzer that you can use to backtest your strategy over a number of market conditions. Here is a link to the guide regarding the strategy analyzer: http://www.ninjatrader.com/support/h...y_analyzer.htm
Please let me know if I can be of further assistance.
Comment
-
Paul,
Sorry for the delay, I did a little testing and what you sent works great...
Questions:
1 - During back testing I figured out how to make the macd and stochatics to display but how do I get the keltner channel to display during back testing?
2 - How can I set the upper keltner channel as a moving target OR get out when macd crosses downward? I already have the strategy exiting when macd crosses but need other or which ever happens first.
3 - Is it possible to calculate the positive angle to the negative angle change of the macd and exit the net change greater then X?
4 - Is it possible to change the keltner channel past the default of 256 to 300 say? OR How do I copy the code from the keltner channel indicator and paste to a new indicator?
5 - how do I insert and moving stoploss that follows let say 4 ticks below the market?
Thanks again Paul The code works well that you sent and I am glad you sent the macd values because I was going there next...
Ken
Comment
-
Hi Ken,
Thanks for your post and comments, we appreciate the feedback.
In answer to your post I have used the same numbers.
1) To display an indicator in the backtesting chart you need to add it to the strategy. Please see KS1 that highlights the "plot" selection on the Kelter Channel.
2) To have your strategy exit a long position when price touches the high line on a Kelter channel you will need to add those conditions to another conditions tab in the strategy builder. See image KS2, it shows when price (High[0]) is greater than or equal to the Keltner channel upper line AND you are already in a LONG position, exit the position.
3) It is not possible to calculate the angle in the strategy builder, however Slope of a data series is available. See image ks4. What this example does is it look at the slope of the last 10 bar series and compares it to the last 4 bar series. This is an example only and is something you will need to adjust to your needs. Note that I added Slope first and then changed the input series of Slope from the default (price data) to the MACD line. I did this on both sides of the equation.
4) You can change the look back period in the parameters window of the strategy itself. The choices are 256 bars or infinite.
5) In the strategy builder you can set up a trailing stop in the "Stops and Targets" window. Please see image Ks5.
Please let me know if I can be of further assistance.
Comment
-
Hi Ken,
The condition builder contains a set called "Strategy" that contains the market position and it is a matter of testing if it is long, short or flat. I've attached the image of the strategy with red boxes to show the selections used.
Please let me know if I can be of further assistance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
648 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment