Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to tell if a stop loss/target has been hit in NinjaScrpt?
Collapse
X
-
imported post
Dierk Droth wrote:Hi, I can't find any reference to the Position.MarketPosition and Position.Quantity members in the Help doucmentation (NT6beta11). I think there was an empty page titled 'Position' in the NinjaScript section of the manual of the NT6beta10, but now it seems to be gone.You could monitor Position.MarketPosition and Position.Quantity and check for changes in your OnBarUpdate method.
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.
Comment
-
imported post
See here - http://www.ninjatrader-support.com/H...tPosition.html
Thanks for the missing images comment.
Ray
RayNinjaTrader Customer Service
Comment
-
Query Stop Loss Event
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?
Comment
-
Same question in this thread: http://www.ninjatrader.com/support/f...osition+globalOriginally posted by geekodude View PostHi 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?
Comment
-
The Position would report per individual strategy instance, strategies would unfortunately not cross communicate. Some users have reported success by exchanging the info needed via text files for example.Originally posted by geekodude View PostHi 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?
Another option is combining signals into one 'master' strategy so individual fills for each entry become querable.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
47 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
22 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
15 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
21 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
23 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment