![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Apr 2008
Posts: 310
Thanks: 0
Thanked 0 times in 0 posts
|
I'm developing a simple strategy based on entering a limit order and then canceling it if not filled in 3 bars. I get no trades at all. That's what I did:
In the Variables region private IOrder myEntryOrder = null; OnBarUpdate(): // Entry Long Condition if (myEntryOrder == null) { myEntryOrder = EnterLongLimit(1, true, DefaultQuantity, MaxRange, "LongLimit"); } // Cancel LimitOrders condition if (BarsSinceEntry() >= 3) CancelOrder(myEntryOrder); // Exit Condition Long if (conditions && Position.MarketPosition == MarketPosition.Long) { ExitLong("Take Profit Long", "LongStopLimit"); myEntryOrder = null; } // Stop Loss Long if (conditions && Position.MarketPosition == MarketPosition.Long) { ExitLong("LongStopLoss", "LongStopLimit"); myEntryOrder = null; } Thank you |
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CancelOrder() problem | John833 | Strategy Development | 41 | 10-31-2008 03:15 PM |
| Simple strategy | rnr123 | Strategy Analyzer | 1 | 10-17-2008 07:04 AM |
| need help with simple strategy | mike8943 | Strategy Development | 1 | 07-17-2008 08:21 AM |
| RFE: ability to type in limit price in the simple order window and the FX Pro window | henry.omd | ATM Strategies (Discretionary Trading) | 6 | 12-24-2007 04:05 PM |
| Simple Strategy | Oli | Automated Trading | 2 | 03-05-2007 11:42 PM |