![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 28 times in 24 posts
|
Hi,
I'm using a primary bar series which is a Range bar, and a secondary series which is 1 minute bars. I've added this code: Code:
if(BarsInProgress == 1)
{
if(ToTime(Time[0])>=eodExitTime)
{
ExitShort();
ExitLong();
Print("forced exit on bars series 2");
}
}
"5/10/2012 11:09:00 PM Entered internal PlaceOrder() method at 5/10/2012 11:09:00 PM: BarsInProgress=1 Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' 5/10/2012 11:09:00 PM Ignored PlaceOrder() method: Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' Reason='This was an exit order but no position exists to exit'" Yet, a position was actually held at the time. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
coolmoss,
If you call both exit orders here it will ignore at least one of them. You could eliminate this if you check if you are in a long or short position before calling either method. if (Position.MarketPosition == MarketPosition.Short) { ExitShort(); }
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 28 times in 24 posts
|
Thanks Adam,
I found out that ToTime is a bit different for multi bars scripts. I changed it to ToTime(Times[1][0]) and things seem to work now. Just sharing this to complete the thread if anyone else comes across this thread with similar problem. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| GetBar() missing an overload | saltminer | Indicator Development | 1 | 01-05-2012 06:22 AM |
| No overload for method | kenb2004 | Strategy Development | 9 | 09-23-2010 05:01 AM |
| Overload problem | advs108 | General Programming | 2 | 06-07-2010 04:33 AM |
| Fast Tick and Overload conditions | Turtle Trader | Strategy Development | 1 | 03-11-2010 01:46 PM |
| No Overload error | aaron1281 | General Programming | 2 | 09-18-2007 11:51 PM |