![]() |
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 |
|
Senior Member
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
|
I want to have an entry stop limit order working but it needs to have it's parameters altered as conditions change. How do I do that from the code in a strategy?
tu Max |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
To modify your order just call EnterLongStopLimit() or whichever method you were using again with your new parameters.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
|
I suspected that might do it, thanks much...
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Dec 2008
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
|
I have this double entry problem where my strategy cancels the OLD limit order and
sends in a NEW one at the opening of the next bar. I've able to produce this same bug few times. What happened was the OLD limit order did NOT cancel on time when the NEW limit order was issue. If the price touch the OLD + NEW limit order prices quickly (fast market), it will result in BOTH the OLD + NEW limit order being filled. Can I modify my existing LIMIT ORDER to prevent this from happening? Thanks! >Jim |
|
|
|
|
|
#5 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Jim,
As you call EnterLongLimit() again it should just modify any preexisting order. If your existing order was filled in that very instant that the order was making it across the internet to your brokerage then the scenario you are seeing is very possible. What you want to do in these instances is to address the extra order and immediately cancel that when you notice such a case. To cancel an order you can use CancelOrder(). Also, prevention is key here too. Try using if (Position.MarketPosition == MarketPosition.Flat) to ensure you are flat at the time of order submission. This will not weed out all race conditions, but will help keep it rare.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#6 | |
|
Junior Member
Join Date: Mar 2010
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
In my strategy, I have limit order and stop/profit target orders tied to it. see code: entryLongOrder = EnterLongLimit(0, true, 1, entryPrice, "LongEntry"); SetStopLoss("LongEntry", CalculationMode.Ticks, stopOffset, false); SetProfitTarget("LongEntry", CalculationMode.Ticks, profTargetOffset); My question is, if I want to modify the limit price by recall EnterLongLimit(...) with a new entry price, do I need to do anything with the StopLoss and ProfTarget orders? (My guess is not, since I use the offset mode for these orders, unless I want change these offsets, Am I right?) Regards, JD |
|
|
|
|
|
|
#7 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
You are right. Changing the limit price for entry does not require changing your stop/targets.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Aug 2008
Location: Netherlands
Posts: 159
Thanks: 17
Thanked 5 times in 5 posts
|
Nice thread.
![]() I was wondering, is it possible (in a strategy) to change the entry and exit prices? For example, if I wanted to measure the efficiency of an trading strategy, I would like to compare it to the results of buying at the bottom and selling at the top. That way I can measure how much of the total move gets captured by the strategy, which in turn gives an indication of quality of the strategy. But to arrive at the data of the total move (and all the moves in the time window), I need to code something as "if the move is over, the enter long price was the MIN(Low) value and the exit long was the MAX(high) value". Can I change the entry and exit prices afterwards? Perhaps there is a different way? Can anyone give me some pointers for the creation of such a (non-tradeable) strategy? ![]() Regards,
Last edited by J_o_s; 07-14-2010 at 03:02 AM.
Reason: typo's, expanded
|
|
|
|
|
|
#9 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
J_o_s,
Unfortunately you cannot change the entry/exit prices afterwards. What you can try to do is try creating your own fill algorithm and using that instead of the default ones supplied. http://www.ninjatrader-support.com/H...FillTypes.html
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| B-LINE Indicator(modify) | jake28787 | Indicator Development | 3 | 01-06-2009 10:23 AM |
| modify PriorDayOHLC | Awash | Indicator Development | 20 | 12-07-2008 02:41 PM |
| Modify CurrentDayOHL | dwalls | NinjaScript File Sharing Discussion | 1 | 11-28-2008 12:52 PM |
| How to modify and retest an ATM strategy | cassb | Strategy Analyzer | 19 | 04-24-2008 02:14 PM |
| Manually modify ATM strategy | rally7 | ATM Strategies (Discretionary Trading) | 6 | 03-31-2007 03:38 PM |