Using True – cumulating positions
Forums › ProRealTime English forum › ProOrder support › Using True – cumulating positions
- This topic has 6 replies, 4 voices, and was last updated 4 years ago by robertogozzi.
Tagged: countofposition
-
-
05/04/2019 at 9:27 AM #9765005/04/2019 at 9:43 AM #97651
COUNTOFPOSITION returns the number of open positions.
COUNTOFLONGSHARES returns the number of open Long positions.
COUNTOFSHORTSHARES returns the number of open Short positions.
Example:
1234MaxPositionsAllowed = 5If MyConditions And CountOfPosition < MaxPositionsAllowed ThenBuy 1 contract at marketEndif05/04/2019 at 11:07 AM #97661Don’t forget that COUNTOFPOSITION is a negative value if you are short on the market and a positive value if you are long. You can use:
1abs(countofposition)to return only a positive value. So Roberto’s code needs to be like the following to work with short position quantities.
1234MaxPositionsAllowed = 5If MyConditions And abs(CountOfPosition) < MaxPositionsAllowed ThenSellshort 1 contract at marketEndif1 user thanked author for this post.
05/04/2019 at 12:04 PM #9767005/04/2019 at 12:15 PM #97671Copied to here
Another successful collaboration on the Snippet Log! 🙂
1 user thanked author for this post.
06/15/2020 at 10:25 PM #136055z = n*3/2
And is n*3/2 allowed as a lot size for the Instrument you are trading?
If it were me I would concentrate on making a profit by getting the strategy correct for Long entry / exit and Short entry / exit and use Lot size = 1 for simplicity?
After you are making consistent profit every week for months … then tweak lot size etc??
06/15/2020 at 10:47 PM #136058Sorry @GraHal, I deleted all of his posts here because he had started another topic in the French forum.
You may want to post your reply, in French, there https://www.prorealcode.com/topic/taille-de-position-en-fonction-de-lhoraire-de-trading/.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on