InvestorsHub Logo
Followers 43
Posts 22874
Boards Moderated 2
Alias Born 10/16/2008

Re: None

Saturday, 10/29/2011 10:58:00 PM

Saturday, October 29, 2011 10:58:00 PM

Post# of 79025
TOS ThinkScript

COPY code below and save "Everything", all #'s from 1st TO Last #

ON TOS chart
click Studies
click edit studies
(Studies Block on left side of page)
click NEW on lower left > New Study box pops up
Left Click hold and drag THRU > plot Data = close; RELEASE Left Click
RIGHT CLICK PASTE with the saved code from below
CLICK OK ..?? Should accept IF SO new screen Pops Up
Click APPLY
Click OK >>>>> Should be On Screen

(Turn off other indicators you have on that chart and Add Back as Wanted)





### THIS SYSTEM USES THE MA OF THE HIGH AND THE MA OF THE LOW, TO TRIGGER SIGNALS UP OR DOWN ONCE ACTUAL PRICE HAS CROSSED ABOVE THE MA OF THE HIGH OR BELOW THE MA OF THE LOW. ###
###############################################################
input MainPrice = close;
input TriggerLineSmoothing = 1;
def price = average(mainprice,triggerlinesmoothing);
input MaLengthOfHighAndLow = 50;
def Length = MaLengthOfHighAndLow;
# DON'T USE NEGATIVE NUMBERS FOR BACK PERIODS, IT PRODUCES UNREAL RESULTS.
input BackPeriodsOfHighAndLow = 0;
def BackPeriods = BackPeriodsOfHighAndLow;
input AverageTypeOfHighAndLow = {default Simple, Exponential, Hull, Weighted, Variable, Wilders};
###############################################################
plot AvgHigh;
AvgHigh.SetDefaultColor(GetColor(3));
AvgHigh.hidebubble();
plot AvgLow;
AvgLow.SetDefaultColor(GetColor(3));
AvgLow.hidebubble();
###############################################################
switch (AverageTypeOfHighAndLow) {
case Simple:
AvgHigh = Average(High, Length)[BackPeriods];
AvgLow = Average(Low, Length)[BackPeriods];
case Exponential:
AvgHigh = ExpAverage(High, Length)[BackPeriods];
AvgLow = ExpAverage(Low, Length)[BackPeriods];
case Hull:
AvgHigh = hullMovingAvg(High, Length)[BackPeriods];
AvgLow = hullMovingAvg(Low, Length)[BackPeriods];
case Weighted:
AvgHigh = wma(High, Length)[BackPeriods];
AvgLow = wma(Low, Length)[BackPeriods];
case Variable:
AvgHigh = VariableMA(High, Length)[BackPeriods];
AvgLow = VariableMA(Low, Length)[BackPeriods];
case Wilders:
AvgHigh = WildersAverage(High, Length)[BackPeriods];
AvgLow = WildersAverage(Low, Length)[BackPeriods]; }
###############################################################
ADDCLOUD(AvgHigh,AvgLow,color.blue,color.blue);
###############################################################
# THIS CODE CHANGES THE CANDLE COLORS, IF YOU WISH TO RETAIN THE ACTUAL CANDLE COLORS, THEN TYPE THE # SYMBOL IN FRONT OF assignPriceColor.
assignPriceColor( if price > AvgHigh then color.green else if price < AvgLow then color.red else color.blue);
###############################################################
# THIS CODE CHANGES THE BACKGROUND OF THE CHART FOR A BETTER VISUAL CLUE.
# ASSIGnBackgroundColor( if price > AvgHigh then color.dark_green else if price < AvgLow then color.dark_red else color.gray);
###############################################################
plot UpSignal;
UpSignal = if price > AvgHigh AND price[1] <= AvgHigh[1] then low else double.nan;
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_up);
UpSignal.SetDefaultColor(GetColor(1));
UpSignal.SetLineWeight(3);
UpSignal.HideBubble();
######################
plot DownSignal;
DownSignal = if price < AvgLow AND price[1] >= AvgLow[1] then high else double.nan;
DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_down);
DownSignal.SetDefaultColor(GetColor(0));
DownSignal.SetLineWeight(3);
DownSignal.HideBubble();
######################
def Neutral = price > AvgLow and price < AvgHigh;
###############################################################
# THIS CODE ALLOWS THE SYSTEM TO ALERT YOU WITH SOUNDS, IF YOU WISH TO TURN IT OFF, THEN TYPE THE # SYMBOL IN FRONT OF ALERT.
Alert(UpSignal, "BUY", Alert.TICK, Sound.Ring);
alert(UpSignal, "BUY", Alert.BAR, Sound.Ring);
###############################################
alert(DownSignal,"SHORT",Alert.TICK,Sound.Ding);
alert(DownSignal,"SHORT",Alert.BAR,Sound.Ding);
###############################################
alert(Neutral,"Neutral",Alert.TICK,Sound.Bell);
alert(Neutral,"Neutral",Alert.BAR,Sound.Bell);
###############################################################
AddChartLabel(if price > AvgHigh then yes else no, "BUY BUY BUY ! ! !", color.green);
#########################
AddChartLabel(if price < AvgLow then yes else no, "SHORT SHORT SHORT ! ! !", color.red);
#########################
AddChartLabel(if price > AvgLow and price < AvgHigh then yes else no, "CAUTION CAUTION CAUTION ! ! !", color.YELLOW);
###############################################################

Disaster is Only a Keystroke Away!

Join the InvestorsHub Community

Register for free to join our community of investors and share your ideas. You will also get access to streaming quotes, interactive charts, trades, portfolio, live options flow and more tools.