It would be great if one of the more experienced coders out there lent me a helping hand.
I have finally managed to put together a screener all by myself. The only thing that I cannot figure out is how to customize the output. Say this is my last line:
SCREENER [((c1 AND c2 AND c3 AND c4 AND c5) or (c6 AND c7 AND c8 AND c9 AND c10)) and c11 and c12] (Variation AS "%Chg prev bar")
I want the screener to display in the output/screener list a column with the word
– “long” when the first argument is valid, i. e. “c1 AND c2 AND c3… and c12”
– “short” when the second argument is valid, i. e. “c6 AND c7 AND c8…and c12”
Could anyone tell me how I need to modify this?
Thanks so much!
The best you can do is to setup a variable with your long or short conditions, like this:
//long conditions test
if c1 and c2 and c3 then
sort = 1
endif
//short conditions test
if c4 and c5 and c6 then
sort = -1
endif
It’s not possible to make string variable, so the result of sort would “1” for long and “-1” for short.
Now for your screener display, you should write it like this :
SCREENER [(c1 and c2 and c3) or (c4 and c5 and c6)] (sort as "trade direction")
Of course this is an example and you should adapt it to your screener already coded conditions. Please let us know if it’s ok for you.
Nicolas,
Thank you so much for the quick reply! Where would I add the variable – if I put it in the code before the Screener output, the “sort” apparently creates an error message.
//long conditions test
if c1 AND c2 AND c3 AND c4 AND c5 and c11 and c12 then
sort = 1
endif
//short conditions test
if c6 AND c7 AND c8 AND c9 AND c10 and c11 and c12
sort = -1
endif
SCREENER [((c1 AND c2 AND c3 AND c4 AND c5) or (c6 AND c7 AND c8 AND c9 AND c10)) and c11 and c12] (sort as "trade direction")
and what is the error message you have?