![]() |
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 |
|
|
#16 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
This is not on a gap down where this is happening.
Example during a backtest..... 1/ prior bar hits high of 13955 & closes at 13942. 2/ TrailStop updated on bar close (i.e. set to true) & is set to 1 (lowest value I believe that is possible). 3/ current bar OHLC = 13942, 13947, 13921, 13928. 4/ trade exits on current bar at 13954. so it would appear that stoploss is set to 13955 at the close of the prior bar & then since the price at the next bar open is 13 less than stoploss set point it assumes a 'gap' & therefore exits in midair. but why would one in real time get a fill at higher price than the current market price --- I cannot understand this. thx DG |
|
|
|
|
|
#17 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
A fill price of 13954 means that the stop price going into the current bar was at at a price higher than the low of the current bar and thus you are filled at your stop price + commission values.
I realize you say that your stop was changed to a price of 1 but if that was the case, your stop would not have triggered. You can verify this by enabling TraceOrders = true in the Initialize() method and reviewing the Output window. The simulator or exchange can fill you at a price higher than the market. Usually does not happen but it can.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#18 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
Ray - thx for your guidance on this.
The way I see it is that the simulator is always filling me at the stop price (= 1 tick lower than high of prior bar) every time the current bar high is lower than prior bar high & if the trailstop value been set to <= 0. I don't think you will agree....... but I can send the strategy for you to back test if you wish. thx David |
|
|
|
|
|
#19 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Please use the TraceOrders option and check the price of your "sell" stop order at the fill in question. If the price is a value of <= 0, let me know.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#20 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
With TraceOrders, Value = 1 (I presume this is the minimum value, since the trailstop calculation actually takes the value < 0).
So my prior comment still stands.............The way I see it is that the simulator is always filling me at the stop price (= 1 tick lower than high of prior bar) every time the current bar high is lower than prior bar high & if the trailstop value been set to <= 0 (.........sets itself to value=1). |
|
|
|
|
|
#21 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Is this a "BUY" or "SELL" stop order?
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#22 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
since this is a long strategy, it is a sell stop order to exit. DG
|
|
|
|
|
|
#23 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Hi dgregor5,
Lets try to get to the root of this problem. Would you mind sending me a simple as possible strategy that displays the issues you are experiencing along with a replay file that highlights the problem? Thank you.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#24 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
Josh - sent a strategy via email to support for you to backtest. thx. David
|
|
|
|
|
|
#25 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
testing out a similar dynamic trailing stop strategy with simulated real time data feed observed the following:
Conditions: 1/ CalculateOnBarClose=True. 2/ SetTrailStop set in OnBarUpdate section. 3/ trail stop value sent to output window at onbarclose. 4/ TraceOrders = true in initialise method. Obervations with real time simulated feed: 1/ If end of bar trail stop calculation on prior bar leads to stop price > open price of current bar, then trade exits immediately at open price of current bar. this is exactly what I expect. Observations in backtestmode: 1/ If end of bar trail stop calculation on prior bar leads to stop price > open price of current bar, then trade exits immediately at stop price ---- hence why certain trades exit in mid-air. Isn't this an issue !!?!?! Again am I being dumb ?!?!?!? thx DG |
|
|
|
|
|
#26 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
No, you are not being dumb. I understand your concern and will see what I can do. Would you mind sending me the things you sent through support to josh [at] ninjatrader [dot] com? Thanks.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#27 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
Josh - have sent the files. thx. DG
|
|
|
|
|
|
#28 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Hi dgregor5,
The issue will be fixed for NinjaTrader 6.5. In the meantime you can do this to fix the issue on your NinjaTrader 6.0.1000.5 install.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#29 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
Hey Josh - great turnaround. thx for your assistance. Now works as expected. David
|
|
|
|
|
|
#30 |
|
Senior Member
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
|
Josh:
I am now seeing similar mid-air exits when using a dynamic profit target (using SetProfitTarget from within OnBarUpdate). This time the mid-air exits are always below where the exit should be........ (n.b. this is a long strategy again) Similar issue ??? thx David |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Switching from stop to trailing | MrBaffalo | Strategy Development | 1 | 02-02-2007 03:33 AM |
| Dynamic Trailing Stops | whitmark | Suggestions And Feedback | 4 | 05-09-2006 11:57 PM |
| Can't get trailing stop | Savage1701 | Automated Trading | 1 | 04-07-2006 08:03 AM |
| Trailing Stop Question | underground | Miscellaneous Support | 3 | 06-06-2005 07:11 AM |
| Dynamic Stop and Adjust OIF | scjohn | Automated Trading | 19 | 03-24-2005 04:37 AM |