I have 3 strategies trading same symbol within same solution. I don't want a strategy to open position on this symbol if there is already position opened by another strategy. How do I check that? If I understand it right "if !HasPosition" would not work here since it checks positions opened by one strategy only?

To do any kind of communication between strategies, you must use the global hashtable. In your particular scenario, each strategy would keep its current positions recorded in (your) custom datastructure in the global hashtable, where all the other strategies could check that info before they opened their own positions, and would of course update their own info in the global place after they changed their own position.

Thank you for reply! Do you have any sample code on those global hashtables or any link to where I could get more info about them? I dont remember anything like that covered in OpenQuant pdf documentation.

Here's a link to a small example. The global hashtable is just a typical C# datastructure (probably a Dictionary), so you code it in a normal way. You can search the net for many examples of C# Dictionary usage examples.

The biggest issue that you might have with the Global table is casting types that you fetch out of the table into specific data types so you can use them again. The table stores "objects" (so you can store anything in there). So when you fetch something out of the table, you need to know what type of thing you are fetching, so you can cast it back to the right kind of object with the "is" operator, the "as" operator, or with the "(cast-to-type)" format.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum