![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jan 2011
Posts: 8
Thanks: 0
Thanked 0 times in 0 posts
|
Hello,
How do you code %K cross below %D with the strategy wizard. Will the system trade only when the cross takes place or during the period %K < %D. Thank you. Kind regards, Rene Zeemeijer |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,398
Thanks: 252
Thanked 968 times in 951 posts
|
Hi Rene, if you use the dedicated CrossOver / under functions then the condition would only evaluate to 'true' once a cross is seen, and not just %K being greater then %D or vice versa.
Please review the 7th section in this link from our helpguide for how to define a CrossOver condition in the wizard - http://www.ninjatrader.com/support/h...on_builder.htm Thanks,
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Apr 2013
Posts: 44
Thanks: 18
Thanked 0 times in 0 posts
|
I understand what your saying but instead of creating inputs could i switch the period. My thought process was when %K crosses above %D to go long, but i need to change the variable in order for the code to recognize the difference between %K or D%. Or do i need to simply put
&& CrossAbove(Stochastics(7, (int) (Variable0), (int) (Variable0)).D, Stochastics((int) (Variable1), 14, 3).D, 1)) { EnterLong(1, ""); } Or do i need to simply put as per the the link like the EMA's and MACD and it will read the %K cross above the D% && CrossAbove(Stochastics(7, 14, 3).D, Stochastics(7, 14, 3).D, 1)) { EnterLong(1, ""); } Thanks for your help in advance |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,398
Thanks: 252
Thanked 968 times in 951 posts
|
Hello, you can use the second call, just make sure you select the correct plot of the Stochastics to use here -
&& CrossAbove(Stochastics(7, 14, 3).K, Stochastics(7, 14, 3).D, 1)) { EnterLong(1, ""); }
Bertrand
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Bertrand for this post: |
|
|
|
#5 |
|
Member
Join Date: Apr 2013
Posts: 44
Thanks: 18
Thanked 0 times in 0 posts
|
if (CrossAbove(MACD(12, 26, 9), MACD(12, 26, 9).Avg, 1)
How would i differentiate the cross on the MACD as was done with the stochastics D &K Thanks a bunch
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,398
Thanks: 252
Thanked 968 times in 951 posts
|
Should be fine already, you're checking for MACD main value and it's avg here.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Bertrand for this post: |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Code to detect cross above of Stochastics.K/Stochastics.D, MACD.Value/MACD.Avg? | qfweiwei | General Programming | 5 | 07-20-2011 10:42 PM |
| Stochastics Cross Indicator | DennisA | Market Analyzer | 1 | 03-31-2011 07:32 AM |
| Price at Cross Above / Cross Below | sgordet | Indicator Development | 7 | 01-11-2011 02:58 PM |
| Cross Above / Cross Below for NT7? | Elliott Wave | Market Analyzer | 12 | 11-20-2010 05:27 PM |
| Stochastics vs Fast Stochastics Indicator | KBJ | Miscellaneous Support | 4 | 10-17-2007 04:44 PM |