How to avoid Signal Name below a Priority number
Author: swuzy
Creation Date: 5/4/2009 7:07 AM
profile picture

swuzy

#1
For backtests and alerts, I would like to be able to eliminate or skip or avoid signal names below a priority number, say 5 or whatever, or a variable.

How can I do so for the code below? Thanks very much.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
Is it a simple mathematical operation of comparing the priority variable with some arbitrary number?
profile picture

swuzy

#3
Yes, that should do it. But here in WL5 code, I do not know where or how to insert the simple but necessary language. Sorry for my elementary grade status and 'fear of coding' like a deer frozen in the middle of the road.

maybe something somewhere in the nature of, "if (priority > 5, BuyAtMarket( bar+1);" ?

so the last two lines would become

CODE:
Please log in to see this code.


?
profile picture

swuzy

#4
The strategy being referenced is either the 33 Liner, the seventeen liner or that family group of strategies.
profile picture

Cone

#5
CODE:
Please log in to see this code.
Trnaslation: The Position priority value is priority - i. So, only if priority-i is greater than 5 will the BuyAtMarket function be executed.
profile picture

swuzy

#6
I tried the above change, it does not work.

Priority is not assigned until after the buy conditions segment, so is there a need for a goto jump or loopback reference to modify the buy at market by the subsequent priority calculation?
profile picture

Cone

#7
Of course it works. The priority - i is value known before the position is created as I explained already.
profile picture

swuzy

#8
Apology. I did not refresh the page and did not see your response and code. I was saying my noted code does not work.
profile picture

swuzy

#9
Yes, it is working fine. Thank you Cone for your help.
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).