Why do I always get a fixed Priority value?
Author: mrsic
Creation Date: 8/12/2017 8:27 PM
profile picture

mrsic

#1
Hi,
could someone check this Strategy + priority for me? I think something is wrong. I always get as prio 98 at long and fo Short 2.
Thanks.

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

Eugene

#2
Hi,

Because you've coded it this way. Your DataSeries behind the Priority take only a few integer values ranging from -2 to +2. Most of the time they are at -2.

CODE:
Please log in to see this code.


Actually, it would be beneficial to you to learn how to debug scripts using PrintDebug and plotting statements.
profile picture

mrsic

#3
Hi Eugene,

QUOTE:
Actually, it would be beneficial to you to learn how to debug scripts using PrintDebug and plotting statements

do you know any examples to understand it better how to debug scripts?

What do you think, makes this strategy sense without a priority? and did you find any mistakes in coding?

Thanks in advance.

greetings Damir
profile picture

Eugene

#4
Hi Damir,

QUOTE:
do you know any examples to understand it better how to debug scripts?

1. Look up PrintDebug in the QuickRef (F11 key). FlushDebug and ClearDebug make it more flexible.
2. Type in "debug" in forum's search box.
3. You can also use methods like AnnotateBar to attach some printout to a bar in a more visual way than PrintDebug but it's limited by screen space.

I deliberately didn't suggest this article as it requires Visual Studio IDE skills: How can I debug my trading strategies in Wealth-Lab?. But it's the best one can have when it comes to debugging with its powerful features such as breakpoints, Edit and Continue and DataTips.
profile picture

mrsic

#5
Hi Eugene,

I will try it and thank you for your help

greetings damir
profile picture

mrsic

#6
Hi,

CODE:
Please log in to see this code.

For my understanding. Can someone explain me what this exactly does. I have not found an explanation for DataSeries.Abs.

Thanks in advance.

greetings Damir
profile picture

Eugene

#7
QUOTE:
I have not found an explanation for DataSeries.Abs

It naturally can be found in the QuickRef (F11 key), explained under DataSeries chapter with an example.

And /= in WealthScript (C#) divides the DataSeries by another DataSeries (or a value) and assigns the result to the divisible.
profile picture

mrsic

#8
Hi Eugene,

thank you.

greetings Damir
profile picture

mrsic

#9
Hi,

i did try to calculate the priority step by step, but i'm stucking with the sum.series.
Can anyone explain me that, please.

CODE:
Please log in to see this code.

for example:
Sum.Series(9, 2)

QUOTE:
Calculation: Sum = ( D1 + D2 + ... + Dn )
D = DataSeries to be summated, Bars.Open, Bars.Close, TrueRange.Series, SMA.Series, etc..


Results: 9 + 2 = ?

I don't know what kind of Closes? RSI.Series.Closes?

greetings damir
profile picture

Eugene

#10
QUOTE:
I don't know what kind of Closes? RSI.Series.Closes?

What you passed to the Sum series, of course. In particular, the "diff" series from the code you borrowed earlier. There's nothing to add to what you're already quoting - the Sum documentation. It's all explained there.

Damir, let's go the other way around. What do you want the Priority to be here, in plain English?
profile picture

mrsic

#11
Hi Eugene,

QUOTE:
Damir, let's go the other way around. What do you want the Priority to be here, in plain English?

because, if i have a pos.Size of 20% and get 7 signals. Then i like take the best 5 Signals with the highest priority.
For example: RSI Range 0 -100;
1 Signal: 99,59
2 Signal: 99,49
and so on.
This is the reason why i'm confused with only 98, but this is not a drama.

greetings damir
profile picture

Eugene

#12
Damir, sorry if I wasn't clear. The question was not "why" (the priority) but rather "what" (priority value algorithm). So, summated are the "diff" values (based on RSI in its turn) over the lookback period ("slider5.ValueInt").
profile picture

mrsic

#13
Eugene, i'm not sure if i can follow you.

QUOTE:
So, summated are the "diff" values (based on RSI in its turn) over the lookback period ("slider5.ValueInt").


PriorityLong = 100 - diff
profile picture

Eugene

#14
I was talking about this logic:
CODE:
Please log in to see this code.
profile picture

mrsic

#15
this is part of the strategy.

in my case.
CODE:
Please log in to see this code.

profile picture

Eugene

#16
OK. Is there anything left not clear regarding Sum.Series etc.?
profile picture

mrsic

#17
Yes. 9 and 2 are the Values but not the result (calculation) of the Sum.Series. Ist that correct?
What is here D1 + D2 and Dn? Is D1 = 9? and Dn = 2?
profile picture

Eugene

#18
QUOTE:
DataSeries diff = 11 - RSI-calculation with Lookback 2;

Right. 11 - RSI(2) value.
QUOTE:
diff /= |diff|;

Correct.
QUOTE:
diff = Sum.Series( 9, 2);

D1 would be a 9 only when the RSI value is 2.0 on a given bar (11 - 9). The Sum period is 2 days, that's correct.
profile picture

mrsic

#19
QUOTE:
D1 would be a 9 only when the RSI value is 2.0 on a given bar (11 - 9). The Sum period is 2 days, that's correct.

Okay. I think i got it. The SumSeries do only summarize periods or bars.Is that correct? That's the reason why i am always getting a priority of 98 (100-2 = 98).
I checked this in my strategy. I have change the slider5 from to 2 to 3 and the result was 97 (100-3 = 97).
profile picture

Eugene

#20
QUOTE:
The SumSeries do only summarize periods or bars.

It sums values from the specified DataSeries over the desired period. That's it.
profile picture

mrsic

#21
Eugene, thank you for your help and patience.
greetings damir
profile picture

Eugene

#22
Damir, you're welcome.
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).