How add alert on a pattern?


0
0

Hey I’m trying to set an alert when WilliamFractal up is true. Using this script in thinkscript “WilliamsFractal(“sequence count” = 2).DownFractal is true”. When setting up the alert it shows that everything works fine like it should. However when the alert is active it doesn’t trigger, even when I watch the WilliamFractal up is true. I even added a within 2 bars, it still don’t work

Marked as spam
Posted by (Questions: 7, Answers: 13)
Asked on January 25, 2019 4:24 am
243 views
0
Private answer

WilliamFractal does not exist as a built-in study on Thinkorswim. Therefore it is not available when creating study alerts. Instead of referencing the name and plot of the study you will have to use the full code.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 27, 2019 11:07 am
0
I’m not sure how to do that, could you please provide me with the code to paste in the alert thinkscritpt, to trigger the up or down of WilliamsFractel is true and another condition “any”. I can’t seem to get one working. After pasting the code in it shows signals at the bottom of page but yet they never triggered while the chart was adding more. Thanks again for your time and help!
( at January 30, 2019 1:40 pm)
0

I cannot help you unless you provide the actual code for the “WilliamFractal”. As stated in my answer, this study does not exist in Thinkorswim. So I don’t even have the code.

( at February 1, 2019 10:06 am)
0

yes, here is the code, but its a pattern and I have set alerts on other patterns when they are true, I can’t seem to figure out why this one won’t work.

input sequenceCount = 2;

def maxSideLength = sequenceCount + 10;
def upRightSide = fold i1 = 1 to maxSideLength + 1 with count1 while count1 != sequenceCount and count1 != -1 do
if GetValue(high, -i1) > high or (GetValue(high, -i1) == high and count1 == 0) then -1
else if GetValue(high, -i1) < high then count1 + 1 else count1; def upLeftSide = fold i2 = 1 to maxSideLength + 1 with count2 while count2 != sequenceCount and count2 != -1 do if GetValue(high, i2) > high or (GetValue(high, i2) == high and count2 >= 1) then -1
else if GetValue(high, i2) < high then count2 + 1 else count2; def downRightSide = fold i3 = 1 to maxSideLength + 1 with count3 while count3 != sequenceCount and count3 != -1 do if GetValue(low, -i3) < low or (GetValue(low, -i3) == low and count3 == 0) then -1 else if GetValue(high, -i3) > low then count3 + 1 else count3;
def downLeftSide = fold i4 = 1 to maxSideLength + 1 with count4 while count4 != sequenceCount and count4 != -1 do
if GetValue(low, i4) < low or (GetValue(low, i4) == low and count4 >= 1) then -1
else if GetValue(low, i4) > low then count4 + 1 else count4;

plot UpFractal = if upRightSide == sequenceCount and upLeftSide == sequenceCount then high else Double.NaN;
plot DownFractal = if downRightSide == sequenceCount and downLeftSide == sequenceCount then low else Double.NaN;

UpFractal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
UpFractal.SetDefaultColor(GetColor(3));
UpFractal.SetLineWeight(2);
DownFractal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
DownFractal.SetDefaultColor(GetColor(4));
DownFractal.SetLineWeight(2);

( at February 3, 2019 10:04 pm)
0

I can’t get this full code to work either. Sorry, I don’t have a solution for you.

( at February 4, 2019 10:02 am)
0

Thank you for the try! Glad to know I wasn’t the only one.

( at February 5, 2019 3:51 am)