Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Addon Positions Orders and lock
Collapse
X
-
Hello, soulfx.
Thanks for the post.
The locks are used to prevent access violation exceptions/in-flight changes to the property. It is recommended to use locks wherever possible to prevent these violations since you might have other strategies that access the Accounts class. The issues that could arise from not using locks would be the inability to read the data. So using a lock on Account's properties being read would be the best way to prevent errors, even though some examples do not use locks.
More information about these multithreading considerations can be found here:
Please let us know if we may be of any further assistance.
-
Addon Positions Orders and lock
Hello,
In my application/Addon I am checking on Positions for the Account and the orders on the account too. In the Help pages the example of iterating over Positions :
it uses the lock statement
lock (Account.Positions)
{
}
whereas the example of the Orders in help does not
I am iterating over these with the foreach and wondered if it was recommended to use the lock if i am just 'read only' of these values to get a current snapshot? In what instance would the lock be recommended ie if attempt to update Position information during a read.
Will this cause any issue (not using lock or using lock) as my strategy/addon runs which will then update position / order information?
thanksTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by junkone, Today, 11:37 AM
|
2 responses
14 views
0 likes
|
Last Post
by junkone
Today, 12:09 PM
|
||
Started by frankthearm, Yesterday, 09:08 AM
|
12 responses
44 views
0 likes
|
Last Post Today, 12:05 PM | ||
Started by quantismo, 04-17-2024, 05:13 PM
|
5 responses
35 views
0 likes
|
Last Post Today, 11:32 AM | ||
Started by proptrade13, Today, 11:06 AM
|
1 response
7 views
0 likes
|
Last Post Today, 11:27 AM | ||
Started by love2code2trade, 04-17-2024, 01:45 PM
|
4 responses
35 views
0 likes
|
Last Post Yesterday, 10:31 PM |
Leave a comment: