![]() |
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
|
|||||||
| Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 28 times in 24 posts
|
Hi,
I have a strategy that has been running fine for some time. I run it in charts, loaded with 3 days of data. Today, for the first time the strategy didn't appear to be taking trades. After much head scratching, I tried loading 4 days, and the trades that should have been there appeared historically. I understand how many lookback bars I need and have coded accordingly. And, again, the strategy has traded just fine using 3 days of look back for many weeks now. I'm totally stumped and need to determine why this happened, as it cost a lot of money. I don't want to just set everything to 4 days and assume it'll be correct. Thanks in advance. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
coolmoss,
A strategy would display historical trades when first applied to a chart, however these trades are sort of a backtest to see what state the strategy should be in at the present. Are you asking why your strategy did not place these trades initially? Unfortunately I am not sure here without more information. During this time, was your strategy in a "Green" state in the Control Center > Strategies tab? This implies its ready to place an order. It it was yellow, it would mean its waiting to sync to your account position and/or until its supposed to be flat depending on your sync account positions settings. http://www.ninjatrader.com/support/h..._positions.htm
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 28 times in 24 posts
|
Strategy was in green state and should have placed trades, but didn't.
I know this is a bit like chasing a needle in a haystack, so let me ask this question, which really hits at the crux of the issue: I have a strategy that has look back bars of 60, running on 24/7 default session and range bars. Why do I have to have many more than 60 bars in a chart before a trade will execute? 60 bars is more than enough bars to cover indicator needs and any logic, so I would think that on, say, bar 70, there should be no problem with a signal and a trade. To the best of my knowledge, in the past, I could get a trade as early as bar 61. Now, suddenly, today, I need to have many more bars present to effect a trade (whether it be real time or historical). So, what could have caused this sudden shift in behavior? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
coolmoss,
Perhaps the BarsRequired setting changed? By default NinjaTrader should wait 20 bars before calculating indicators.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Apr 2012
Location: Toronto, Canada
Posts: 24
Thanks: 5
Thanked 2 times in 2 posts
|
I am running under SIM101 account connecting to my IB production account.
My strategy run fine sometime in reply and with SIM101 but some time it just does not go beyond yellow. I mean how long does this software take to sync the position. This is so frustrating..... I have read all the threads regarding this issue on the forum and tried all combinations of settings in the options menu and strategy UI dialoge. Is there a manual way of syncing account positions? Can someone please help? |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,786
Thanks: 160
Thanked 567 times in 558 posts
|
Hello,
When the strategy is Yellow, it is 'waiting until flat until executing live'. This mean it is waiting until the NinjaScript code determines that the strategy position would be in a position, and is waiting for the strategy position to go flat. If you want to immediately submit orders, please go to Tools--> Options--> Strategy tab--> NinjaScript tab--> set the "On Starting real-time strategy" to "Immediately submit live working historical orders". However you may run into cases where the strategy position does not match the account position. If you want your Account Position to match your Strategy Position, you will need to place a manual order into the account the strategy is running on
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Apr 2012
Location: Toronto, Canada
Posts: 24
Thanks: 5
Thanked 2 times in 2 posts
|
Thank you for the quick response. I have tried as per your advised. However, the strategy is just not going anywhere....
I have taken out all the conditions for filling orders as below and is still sitting and looking for Flat: I have changed the EntriesPerDirection to 12 but still not going anywhere. // LongEntry if ( Position.MarketPosition != MarketPosition.Short // && GetCurrentAsk() >= Close[1] //&& ADX(20)[0] >= inputADX //&& CurrentBar > BarTraded ) { FillLongEntry1(); } // ShortEntry if ( Position.MarketPosition != MarketPosition.Long //&& GetCurrentAsk() <= Close[1] //&& ADX(20)[0] >= inputADX //&& CurrentBar > BarTraded ) { FillShortEntry1(); } 1. Is there a reset of the database or can I access the internal database where it has kept the previous position. 2. Is the "flatten everything" or "close" does not update the internal database for position sync? From the Order Trace this is what I get: 7/31/2012 1:24:00 AM Entered internal PlaceOrder() method at 7/31/2012 1:24:00 AM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' 7/31/2012 1:24:00 AM Ignored PlaceOrder() method at 7/31/2012 1:24:00 AM: Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Sell short' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties' 3. Is this happens on the replay and/or SIM101 account or will this happen in the production too? Please help! |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
mypkonline,
Can we see your FillLongEntry1() and FillShortEntry1() methods as well? This would most likely occur again until you debug your strategy.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Apr 2012
Location: Toronto, Canada
Posts: 24
Thanks: 5
Thanked 2 times in 2 posts
|
#region Entry Functions
private void FillLongEntry1() { EnterLong(); BarTraded = CurrentBar; } private void FillShortEntry1() { EnterShort(); BarTraded = CurrentBar; } #endregion |
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,786
Thanks: 160
Thanked 567 times in 558 posts
|
Hello,
The strategy is likley detecting a historical order when starting the strategy. I'd suggest putting the following at the beginning on OnBarUpdate() Code:
if(Historical) return; Yes, this could happen in a live mode as well.
Matthew
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| days to load | binwang2 | Charting | 1 | 04-06-2012 05:42 PM |
| Days to load | ScottB | Automated Trading | 2 | 02-22-2012 06:34 AM |
| days to load | madLyfe | Charting | 3 | 11-18-2011 03:22 AM |
| Days to load 1 gets 3 days | Crassius | Charting | 3 | 08-11-2011 07:53 PM |
| Days to load | Remek | Version 7 Beta General Questions & Bug Reports | 2 | 05-28-2010 04:33 AM |