Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Just curious is there are any big differences between using "THEN BEGIN...END;" and not using them. Below are the sets of instructions I'm trying to compare. I'd like to figure out what (if any) differences would appear when the code executes (the 1st example does not have "THEN BEGIN," and the 2nd one does).
ex1
ex2
Any insight would be greatly appreciated!
-Brandon
Can you help answer these questions from other members on NexusFi?
there will be a difference between the codes and the reason simply is that in case you are using a "if ... then begin... end; " everything within the "begin" and "end" can only be executed while the condition you check for is true.
For you example 1 this means that you "goLong" order will trigger when Condition1 is true and your "coverLong" order triggers in case of Condition2 being true.
In your second example the goLong triggers when Condition1 is true, but due to the "begin" your "coverLong" can only trigger while both Condition1 and Condition2 are valid. Which depending on the actual checks for the conditions can be quite different.
You will have the same effect for your other orders as described for goLong and coverLong.
This is incredibly helpful, thank you ABCTG! Something like this changes how strategies perform a great deal.
I had no idea that when using "THEN BEGIN," All the above conditions had to trigger in order for the others below to trigger as well (ie, not covering a position when needed).
That makes sense, thanks so much! And one last thing .. what about assigning each condition a "MarketPosition" instead of leaving them without one? Would that matter at all?
not knowing your conditions I can't really comment on that. However think about what you do, you add another condition that has to be valid in order for the order to trigger. So it can make a huge difference of course.
I would suggest to test it yourself and see if it makes a difference. After all you must have a rational for adding the MarketPosition as condition and don't just add something because you can.