How to identify which entry/exit condition fired the trade in Rules-based code output?
Author: soshaughnessey
Creation Date: 10/17/2015 2:36 PM
profile picture


Sorry for this newbie question.

When I run my strategy and look at the trades, the header has Exit name and Entry name. Right now, it is always Group 1. Is there a way for me to use this to identify which exit condition or entry condition actually fired the trade? I have searched the manual to no avail. Unfortunately searching "Exit Name" on this forum simply results in too many hits to help me.
profile picture


Please mind the forum category name when posting, don't just put everything under "General". "General" is reserved for more universal questions that go beyond WL to some extent. The categories explained briefly on the Forum page. Thanks.

Let me suggest you visit the Wiki FAQ where this question has been answered:

FAQ | Strategies and WealthScript > "After generating strategy code with "View Strategy Code", there are strings like "Group1" and "Group1|". What do they mean?"

I have searched the manual to no avail.

For example, check out the QuickRef > Position.ExitName and .EntryName if you want to find out more. But it's more really a question of C# knowledge rather than "documenting" it. It's impossible to document how the actual entry/exit naming would happen in a computer-generated script with a flexible, unknown number of rules. If you know C# basics, you'll instantly "know" which string is responsible for a particular entry/exit in your system. There's no hard and fast rule. From the same FAQ, hope this helps:

How do I start with C# ?
profile picture



I had the same question when I got started. Here is what I did:

1. Convert the Rules based strategy to Code based.

2. Look at the BuyAtXXX function calls. You will see something like BuyAtMarket(b + 1, ""); or BuyAtMarket(b + 1, "Group1|");

3. Examine the if clauses that contain the BuyAtXXX functions.

4. Add those conditions in the if clauses to the second parameter in the BuyAtXXX functions and/or replace "Group1|" with those conditions that appear in the if clauses. You can type in whatever you want.

5. Since your strategy is rules based, odds are the if clauses in your code should be easy to read.

6. Save the Code based strategy, compile, and run.

Really this is an easy process even for non-programmers. Hope this helps.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).