Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Donchian channel entry?
Collapse
X
-
Donchian channel entry?
Hey. I'm trying to develop a strategy where I enter a trade when the slope of the upper donchian channel is > 0. Meaning that I enter when the slope changes from 0 (or a flat line) to greater than 0 (I.e. An increasing line.). Can someone please help me with the code. Thanks.. Ive tried using the strategy wizard but I cant get it to work. -
Originally posted by kringle427 View PostHey. I'm trying to develop a strategy where I enter a trade when the slope of the upper donchian channel is > 0. Meaning that I enter when the slope changes from 0 (or a flat line) to greater than 0 (I.e. An increasing line.). Can someone please help me with the code. Thanks.. Ive tried using the strategy wizard but I cant get it to work.
Code:private int period = 20; //say if (DonchianChannel(period)[2] == DonchianChannel(period)[1] && DonchianChannel(period)[1] < DonchianChannel(period)[0] ) MakeMegaBucks();
Last edited by koganam; 01-12-2015, 01:24 AM.
-
Hello kringle427,
Thank you for your post and welcome to the NinjaTrader Support Forum!
koganam provides great insight and an example here. So instead of looking at the slope koganam broke it down to the basic idea of if the values were flat-lined and now are trending up then execute the desired methods.
Comment
-
Thanks a lot for your help koganam. I'm relatively new to programming. So just one more question. What is the "Private period = 20; //say". All about and where do I put it? I.e. Onbarupdate(), above the if, or initialize(). Or are you just referring to the period of the channel. Thanks again for your help. I'm going to try programming it tomorrow!
Comment
-
Originally posted by kringle427 View PostThanks a lot for your help koganam. I'm relatively new to programming. So just one more question. What is the "Private period = 20; //say". All about and where do I put it? I.e. Onbarupdate(), above the if, or initialize(). Or are you just referring to the period of the channel. Thanks again for your help. I'm going to try programming it tomorrow!
Comment
-
Originally posted by tonynt View Postkoganam,
when I do this as a strategy it works, but when I copy this to onbarupdate of an indicator it doesn´t plot anything (I have simply backcoloring to see if it works. As strategy backcoloring is OK, as indicator nothing) Why?
Thank you
Tony
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by tsantospinto, 04-12-2024, 07:04 PM
|
7 responses
126 views
0 likes
|
Last Post
by aligator
Today, 11:08 AM
|
||
Started by futtrader, 04-21-2024, 01:50 AM
|
5 responses
56 views
0 likes
|
Last Post Today, 10:57 AM | ||
Started by PeakTry, Today, 10:49 AM
|
0 responses
2 views
0 likes
|
Last Post
by PeakTry
Today, 10:49 AM
|
||
Started by llanqui, Today, 10:32 AM
|
0 responses
5 views
0 likes
|
Last Post
by llanqui
Today, 10:32 AM
|
||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
45 responses
3,994 views
3 likes
|
Last Post Today, 09:51 AM |
Comment