Welcome! Log In Create A New Profile

Get Earnings and Seasonal Trends - Subscribe Today!

Advanced

::: TO EXPERTS IN THINKORSWIM SCRIPTS :::

Posted by optiontrader101 
::: TO EXPERTS IN THINKORSWIM SCRIPTS :::
May 24, 2014 04:44PM
Hi Swimmers ,,

Can we put more than one indicator in one script ?

For example if I have 4 indicators Macd , Stochastic , MFI , and CCI with a certain values and sometimes ( in the daily chart) they will come all together and give 4 signals. Can we make ONE SCRIPT to give these signals as ONE signal that represents these four signals and ignore any signals less than these 4 ?


Re: ::: TO EXPERTS IN THINKORSWIM SCRIPTS :::
May 24, 2014 05:52PM
I am definitely not a TOS swimmer but conceptually yes. That question is what started the Fun With Thinkscript thread. If you scroll through the first few pages you should find an example where four indicators are used for one signal. The premise is that you set up four counting variables. When a condition is met that variable is set to 1. You then sum. If the sum equals 4 then set an alert. Over simplifying but that is the basic premise. As I mentioned there are examples in the aforementioned thread.
Re: ::: TO EXPERTS IN THINKORSWIM SCRIPTS :::
May 25, 2014 04:29AM
Thank you NCTradet ,



1) MacD_dots:

# MACD Dots on Price Chart
# Shows Primary Signals only. Once a BuyAlert is issued another BuyAlert cannot be issued until after a SellAlert has been issued, etc.
# Change Displace value below to adjust where Dots are placed on the Price Chart

input displace = 0.0;

input fastLength = 2;
input slowLength = 3;
input MACDLength = 2;
input AverageType = {default EMA};

def Value = MACD(fastLength, slowLength, MACDLength, AverageType).Value;
def Avg = MACD(fastLength, slowLength, MACDLength, AverageType).Avg;

def BuyAlert = Value > Avg;
def SellAlert = Value <= Avg;

rec count=if BuyAlert==1 and count[1]==0 then 1 else if SellAlert==0 and count[1]>=1 then count[1]+1 else 0;

rec count1=if SellAlert==1 and count1[1]==0 then 1 else if BuyAlert==0 and count1[1]>=1 then count1[1]+1 else 0;

def PrimaryBuyAlert = BuyAlert==1 and count==1;
def PrimarySellAlert = SellAlert==1 and count1==1;

plot DotUp = if PrimaryBuyAlert then Low * (1 - displace) else double.nan;
DotUp.SetPaintingStrategy(PaintingStrategy.POINTS);
DotUp.SetDefaultColor(Color.BLUE);
DotUp.SetLineWeight(5);
DotUp.HideBubble();
DotUp.HideTitle();

plot DotDn = if PrimarySellAlert then High * (1 + displace) else double.nan;
DotDn.SetPaintingStrategy(PaintingStrategy.POINTS);
DotDn.SetDefaultColor(Color.YELLOW);
DotDn.SetLineWeight(5);
DotDn.HideBubble();
DotDn.HideTitle();


2) StochSlow:

# StochasticSlow Package - Signals
# Apr/11/2014
# jaimepinto@rogers.com

declare upper;

input over_bought = 80;
input over_sold = 30;
input KPeriod = 2;
input DPeriod = 2;
input priceH = close;
input priceL = close;
input priceC = close;
input smoothingType = {Default EMA};

def SlowD = reference StochasticFull(over_bought,over_sold,KPeriod,DPeriod,priceH,priceL,priceC,3,smoothingType).FullD;

plot buy = if SlowD crosses above over_sold then low else Double.Nan;
buy.SetPaintingStrategy( PaintingStrategy.ARROW_UP );
buy.SetDefaultColor( Color.MAGENTA );

plot sell = if SlowD crosses below over_bought then high else Double.Nan;
sell.SetPaintingStrategy( PaintingStrategy.ARROW_DOWN );
sell.SetDefaultColor( Color.CYAN );


3) CCI :

def CCI = CCI(14);
plot signalUP = if CCI crosses above -100 then low * 1.09 else Double.NaN;
signalUP.SetStyle(Curve.POINTS);
signalUP.SetLineWeight(2);
signalUP.SetDefaultColor(Color.GREEN);
plot signalDN = if CCI crosses below 100 then high * 1.09 else Double.NaN;
signalDN.SetStyle(Curve.POINTS);
signalDN.SetLineWeight(2);
signalDN.SetDefaultColor(Color.RED);


4) MFI crossover :



#wizard text: MFI crosses
#wizard input: crossingType
#wizard input: threshold
#wizard text: Inputs: length:
#wizard input: length

input length = 1;
input crossingType = {default above, below};
input threshold = 20;

plot signal = crosses(MoneyFlowIndex(length=length).MoneyFlowIndex, threshold, crossingType == CrossingType.above);

signal.DefineColor("Above", GetColor(4));
signal.DefineColor("Below", GetColor(5));
signal.AssignValueColor(if crossingType == CrossingType.above then signal.color("Above"winking smiley else signal.color("Below"winking smiley);
signal.SetPaintingStrategy(if crossingType == CrossingType.above
then PaintingStrategy.BOOLEAN_ARROW_UP
else PaintingStrategy.BOOLEAN_ARROW_DOWN);


Can any one put them in one Script with one signal when they come together in the daily chart ?
Re: ::: TO EXPERTS IN THINKORSWIM SCRIPTS :::
June 27, 2014 11:03PM
Can anyone help with a script of crossover that scans or alerts me when 4,8,21 EMA crossover within the body of a candle please.
Re: ::: TO EXPERTS IN THINKORSWIM SCRIPTS :::
June 28, 2014 12:18AM
Quote
Ethan14
Can anyone help with a script of crossover that scans or alerts me when 4,8,21 EMA crossover within the body of a candle please.

Take a look at this post. The default averages are 5, 10, 20 SMA but you can change them to 4, 8, 21 EMA from the script settings window.
Sorry, only registered users may post in this forum.

Click here to login