![]() |
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: Nov 2005
Location: , Ontario, Canada
Posts: 400
Thanks: 0
Thanked 0 times in 0 posts
|
How would you check if your stop has been hit, and at what price?
|
|
|
|
|
|
#2 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Do you mean in the strategy isself or in the NT UI?
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2005
Location: , Ontario, Canada
Posts: 400
Thanks: 0
Thanked 0 times in 0 posts
|
In the strategy.
For example, I want to fire an alert and/or email when the stop is hit. Easy to do if the strategy just uses ExitShort/Long as I have control. But Stops are set and then triggered outside my program logic. |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Hmm, let me think. You could monitor Position.MarketPosition and Position.Quantity and check for changes in your OnBarUpdate method. If your position "goes down" an exit must have triggered.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#5 | |
|
Join Date: Apr 2007
Location: Tucson, Arizona, USA
Posts: 29
Thanks: 0
Thanked 0 times in 0 posts
|
Dierk Droth wrote:
Quote:
a) Is it not possible to access these fields any more? b) If they are still accessible (and will remain in the forseeable future), what exactly do they return (i.e. I guess that Position.MarketPosition holds the total current position of the primary instrument - that is all filled orders, but what does Position.Quantity hold?). c) are there other undocumented position related fields of interest for an automated strategy? Thanks in advance for clarification. Peter Lipa PS: FYI, the current Nt6beta11 online docu http://www.ninjatrader-support.com/H...l?ReleaseNotes has some missing .jpg's in the updated NinjaScript Tutorial sections. The installed (local) docu, however,is fine. |
|
|
|
|
|
|
#6 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
See here - http://www.ninjatrader-support.com/H...tPosition.html
Thanks for the missing images comment. Ray
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Join Date: Apr 2007
Location: Tucson, Arizona, USA
Posts: 29
Thanks: 0
Thanked 0 times in 0 posts
|
Ahh, many thanks!
Sorry, that was a stupid question... |
|
|
|
|
|
#8 |
|
Junior Member
Join Date: May 2011
Posts: 15
Thanks: 3
Thanked 2 times in 1 post
|
Hi I am having the same stop loss query issue here. However, I am writing 2 independent strategies where I want to query for a stop loss within each strategy. For example if I use
if (Position.MarketPosition = MarketPosition.Flat) is the above statement global or local in nature? If strategy#1 has an open position & strategy #2 just got stopped out when using the above line in strategy#2 give flat? If not, how to query for stoploss event WITHIN the strategy? |
|
|
|
|
|
#9 | |
|
Senior Member
|
Quote:
|
|
|
|
|
|
|
#10 | |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Quote:
Another option is combining signals into one 'master' strategy so individual fills for each entry become querable.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|