Fib Queen EMA Trigger


Category:
0
0

i

Hi PETE Can you change this code into a thinkscirip scan of TOS? Thanks Roscoe

 

 

nput price = close;

input fast_length = 8;

input slow_length = 34;

input displace = 0;

def na = double.nan;

 

plot fastema = ExpAverage(price[-displace], fast_length);

fastema.SetDefaultColor(color.blue);

fastema.SetLineWeight(2);

 

 

plot slowema = ExpAverage(price[-displace], slow_length);

slowema.SetDefaultColor(color.dark_red);

slowema.SetLineWeight(2);

 

 

def crossover = if fastema > slowema AND fastema[1] <= slowema[1] then 1 else 0;

def crossunder = if fastema < slowema AND fastema[1] >= slowema[1] then 1 else 0;

 

Plot LongTrigger = if crossover then low – tickSize() else na;

Plot ShortTrigger = if crossunder then high + tickSize() else na;

 

LongTrigger.SetPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_UP);

LongTrigger.SetLineWeight(3);

LongTrigger.SetDefaultColor(color.GREEN);

LongTrigger.HideBubble();

LongTrigger.HideTitle();

ShortTrigger.SetPaintingStrategy(paintingstrategy.BOOLEAN_ARROW_DOWN);

ShortTrigger.SetLineWeight(3);

ShortTrigger.SetDefaultColor(color.RED);

ShortTrigger.HideBubble();

ShortTrigger.HideTitle();

 

#Trigger alerts

alert(crossover[1], “Long Trigger”, Alert.Bar, Sound.Ding);

alert(crossunder[1], “Short Trigger”, Alert.Bar, Sound.Ding)

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on November 5, 2019 9:19 am
272 views
0
Private answer

There is absolutely no need for a custom solution to this. What you have here is nothing more than a moving average crossover. This type of scan is already built into the Thinkorswim platform.

FYI: Since you are requesting a scan I moved this post out of the "Alerts and Notifications" topic and into the "Stock Scanners" topic. I also updated the question title. All caps are not needed here. And your code presents an Exponential Moving Average crossover so I changed the MA in your question title to EMA.

You also included "Fib Queen" in your question title. What exactly does Carolyn Boroden have to do with a simple moving average crossover scan? When quoting another source in your request you must also provide a link to that source so that everyone viewing your post can follow along and understand the full context.

Screenshot below shows this scan setup using the built-in scan named "MovingAvgCrossover", adjusted to the default settings in the code you provided.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4091)
Answered on November 5, 2019 9:53 am