![]() |
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 |
|
Member
Join Date: Jul 2010
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
I have created a simple strategy from the wizard using a channel indicator that buys on crossing above and sells when crossing below. I have set the strategy on a AAPL daily chart and I am not getting any signals. Is there something wrong with the way the wizard set up the code:
private int lengthMA = 10; // Default setting for LengthMA private int lengthATR = 10; // Default setting for LengthATR private double offset = 1; // Default setting for Offset // User defined variables (add any user defined variables below) #endregion /// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// </summary> protected override void Initialize() { Add(ddKeltnerChannel(LengthATR, Offset, LengthMA)); Add(ddKeltnerChannel(LengthATR, Offset, LengthMA)); CalculateOnBarClose = true; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Condition set 1 if (CrossAbove(Close, ddKeltnerChannel(LengthATR, Offset, LengthMA).Upper, 1)) { EnterLongStop(DefaultQuantity, 0, ""); } // Condition set 2 if (CrossBelow(Close, ddKeltnerChannel(LengthATR, Offset, LengthMA).Lower, 1)) { EnterShortStop(DefaultQuantity, 0, ""); } } I have a more complex intraday strategy that is also not producing any back-tested results all of the sudden. It used to work fine. What could the problem be? |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Asing,
I am happy to assist you. You are using "EnterShortStop" and "EnterLongStop". I would suggest using "EnterLong" or "EnterShort" instead. I am not familiar with the ddKeltnerChannel indicator so I cannot comment much further. Is it the same as the default one that comes with NinjaTrader? Please let me know if I may assist further.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Jul 2010
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
hi Adam, the dd channel is slightly modified, but I actually am working with the NT keltnerChannel and neither is producing signals. I also have a proprietary code that uses intraday bars and it was working until recently. I am trying to do historical backtests and i am not getting any signals at all from any of these strategies.
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Asing,
Are you wanting to enter market orders on these signals? If you could, please post your strategy here. It is located in My Documents / NinjaTrader 7 / bin / custom / strategy. I look forward to assisting you in resolving your issue.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Jul 2010
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
hi Adam, I changed the entries from stops to just vanilla entry and now I am getting signals, My question is how is this executed in real time, as market orders? "Enter Long", Enter Short"
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Asing,
Yes, these are market orders. I am happy you have resolved your issue. Please let me know if you require additional assistance.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: Jul 2010
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
Just a question as to how these entries are executed in real time. Enter long is a market order that gets executed on the next bar's open after a signal is generated from the closing of the previous bar?
|
|
|
|
|
|
#8 |
|
Member
Join Date: Jul 2010
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
The problem that I have now is hat the strategy buys and exits on the same bar. It is the strategy that was posted earlier in this chain
|
|
|
|
|
|
#9 |
|
Member
Join Date: Jul 2010
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
I am wondering if this is related to time zone as this has caused all kinds of problems in the past with charts and strategies . I am trading from Asia time zone, but I am using a a day bar for this backtest and I did not think it would matter, Can you think of any other reason why the strategy would enter and exit at the open of the same bar?
|
|
|
|
|
|
#10 |
|
Member
Join Date: Jul 2010
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
If I use the sample MA strategy provided by NT the same thing happens whether with daily or intraday data. Enter and exit on the open of same bar.
|
|
|
|
|
|
#11 | ||
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Asing,
Quote:
Quote:
I look forward to assisting you.
Adam P.
NinjaTrader Customer Service
Last edited by NinjaTrader_AdamP; 01-10-2012 at 07:48 AM.
|
||
|
|
|
|
|
#12 |
|
Member
Join Date: Jul 2010
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Adam, I am only using the Enter Long and Enter Short. And as I said, as a test I used the sample MA strategy provided by NT on an AAPL daily chart and had the same problem of enter and exit on the same daily bar at the same price
|
|
|
|
|
|
#13 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Asing,
Please be sure that in the strategy analyzer properties, you are setting the "Time in force" property to "GTC" not "Day". Please let me know if I may assist further.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#14 |
|
Member
Join Date: Jul 2010
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
Yes, it has always been set to GTC.
|
|
|
|
|
|
#15 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Asing,
What session template are you using? Could you possibly take a screen shot of all of your settings you have for your back test in the Strategy Analyzer? Could you also please take a screen shot of the chart showing the orders? http://www.wikihow.com/Take-a-Screen...rosoft-Windows I cannot reproduce your issue on my end with SampleMACrossOver, ExitOnClose = true, Time in Force = GTC, on the ES being back-tested over the last 2 months of data. I get trades over multiple days. I look forward to helping you resolve your issue.
Adam P.
NinjaTrader Customer Service
Last edited by NinjaTrader_AdamP; 01-10-2012 at 08:07 AM.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems getting a simple strat working | mikeklein | ATM Strategies (Discretionary Trading) | 6 | 04-18-2011 02:38 PM |
| Simple Indicator Not Working | tradinginzen | Indicator Development | 7 | 11-08-2010 08:54 AM |
| What is going on here? Simple things not working. | lookOutBelow | Automated Trading | 6 | 07-26-2010 07:55 AM |
| Simple strategy on SRS - backtest/Wizard | Dan Leontieff | Strategy Development | 5 | 03-03-2009 11:43 AM |
| Starting Simple - Not working | GoBoks | General Programming | 5 | 10-20-2007 09:59 PM |