Welcome! Log In Create A New Profile

Get Earnings and Seasonal Trends - Subscribe Today!

Advanced

Fun with ThinkScript

Posted by robert 
Re: Fun with ThinkScript
July 16, 2015 05:00AM
Rob: Do you have a script just for auto retracement and extensions fibs?
Re: Fun with ThinkScript
July 16, 2015 06:35AM
Quote
Tampman
Rob: Do you have a script just for auto retracement and extensions fibs?

The one I just posted could be used. Anything you don't want to see can be turned off from within the settings. Just hide everything except the fibonacci lines.





- robert


Professional ThinkorSwim indicators for the average Joe
Re: Fun with ThinkScript
July 16, 2015 02:24PM
Ah..Ok..thanks!
Re: Fun with ThinkScript
July 17, 2015 07:40PM
Quote
Palmer
Heyyyyyy Robert. This is not the entire idea but I can take what you give back and go from there.

Wondering if this is possible:

Thinking in terms of going long when:

Condtion1: The RSI(14) crosses above 50.

Starting from the close of that bar, what was the lowest low value in the next 5 bars? Even better, what was the maximum difference in price from the close of that bar during the cross minus the lowest low in the next 5 bars?

This will get you started. I leave the rest to you.



def RSI = reference RSI(length = 14).rsi;
def Xup = RSI crosses above 50;
# if more than one cross up in a 5 day period, only use the first one
plot SignalUP = Xup and Sum(Xup[1], 5) == 0;
     SignalUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
     SignalUP.SetDefaultColor(Color.YELLOW);
# get the highest high during the 5 days following the cross up
def HH = Highest(high, 5);
# plot a 5 bar line at the highest high following the cross up
def countUP = if SignalUP then 0 else countUP[1] + 1;
plot HH5 = if countUP <= 5 then GetValue(HH, countUP - 5) else Double.NaN;
     HH5.SetDefaultColor(Color.WHITE);
# label the highest 5 day high
AddChartBubble(high == HH5, high, Round(HH5), Color.WHITE);
# calculate and label the difference between the highest 5 day high and the close of then signal day
def diff = if high == HH5 then high - GetValue(close, countUP) else Double.NaN;
AddChartBubble(high == HH5, high, "diff: " + Round(diff), Color.LIGHT_ORANGE);

- robert


Professional ThinkorSwim indicators for the average Joe
Re: Fun with ThinkScript
July 18, 2015 09:08AM
Robert:

You ROCK! You absolutely ROCK!
Re: Fun with ThinkScript
July 18, 2015 03:44PM
How do I access the values created by EnableApproximation? For instance, I want to determine the slope (line - line[1]) but it still contains NaN...

robert Wrote:
-------------------------------------------------------
> You are going to need to use the
> EnableApproximation() feature.
>
> Here's an example to get you started.
>
> [i.imgur.com]
>
>
> # ----- define a valley as any point which is
> lower than the three preceding lows and the three
> following lows
> def Valley = low < Lowest(low[1], 3) and low <
> Lowest(low[-3], 3);
>
> # ----- mark each valley with an up arrow -----
> plot ArrowUP = Valley;
>
> ArrowUP.SetPaintingStrategy(PaintingStrategy.BOOLE
> AN_ARROW_UP);
> ArrowUP.SetDefaultColor(Color.WHITE);
> ArrowUP.SetLineWeight(4);
>
> # ----- draw a straight line connecting each
> valley -----
> plot line = if ArrowUP then low else Double.NaN;
> line.EnableApproximation();
> line.SetDefaultColor(Color.LIME);
> line.SetLineWeight(2);
>



Edited 1 time(s). Last edit at 07/18/2015 03:45PM by KevinR.
Re: Fun with ThinkScript
July 19, 2015 12:57PM
Quote
KevinR
How do I access the values created by EnableApproximation? For instance, I want to determine the slope (line - line[1]) but it still contains NaN...

Unfortunately, you cannot access the values that EnableApproximation() generates. However, you can manually calculate slope. Here's an example building on our last bit of sample code.



# ----- define a valley as any point which is lower than the three preceding lows and the three following lows
def Valley = low < Lowest(low[1], 3) and low < Lowest(low[-3], 3);

# ----- mark each valley with an up arrow -----
plot ArrowUP = Valley;
ArrowUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
ArrowUP.SetDefaultColor(Color.WHITE);
ArrowUP.SetLineWeight(4);

# ----- draw a straight line connecting each valley -----
plot line = if ArrowUP then low else Double.NaN;
line.EnableApproximation();
line.SetDefaultColor(Color.LIME);
line.SetLineWeight(2);

# ----- calculate slope using the rise over run method -----
# setup "run" as a recursive variable to count the number of bars between vallies
def run = if Valley then 1 else run[1] + 1;
# "rise" will be current valley low - previous valley low
# the "run" counter can be used in conjunction with the "GetValue" function to lookup the previous valley low
def rise = if Valley then low - GetValue(low, run[1]) else Double.NaN;
# slope is calculated as rise / run
def slope = rise / run[1];
# display slope just so that you know what it is
AddChartBubble(Valley, low, slope, if slope > 0 then Color.LIGHT_GREEN else Color.PINK);


# ----- bonus section -----
# just for fun, let's use the slope calculated above to extend the lines connecting each valley
def slopeX = if Valley then slope else slopeX[1];
def lineX = if Valley then low else lineX[1] + slopeX;
plot LineExtension = lineX;
LineExtension.SetDefaultColor(Color.CYAN);
LineExtension.SetPaintingStrategy(PaintingStrategy.POINTS);

- robert


Professional ThinkorSwim indicators for the average Joe
Re: Fun with ThinkScript
July 19, 2015 01:57PM
Robert, your market structure script with auto fibs is brilliant. I attempted to write something like that when I was reading the art and science of technical analysis but I couldn't get past the first order pivots. As someone else said, you ROCK!
Re: Fun with ThinkScript
July 20, 2015 06:01PM
First, thanks to optiontrader101 for the algo previous page. I love it. Second, thanks to mtut for warning, as this helped me refine the strategy. Here are my results of 10 trades, EURUSD, using mostly 10-min chart or Hourly and the algo (let's call it WAVES). All times are New York time. Entry is at open of candle unless specified otherwise. Exit is "sometime" during the specified candle, unless specified otherwise.

Number of trades: 10. Long: 4 Short: 6
Max drawdown: 16p; Avg drawdown: 8.7p; Total Flats: 1
Total Loss: 0p; Avg Loss: 0p
Total Gain: 49p; Avg Gain: 4.9p/trade
Loss pct: 0%; Win pct: 90%; Flat pct: 10%
Targets: condition-dependent
Stoploss: up to 3x Target value
Total trading time: 887 mins; Avg time: 88.7 mins/trade
[ On a few trades I was exploring limits and that drove up my average time per trade. The real avg time is probably closer to 30 mins/trade, now that I know how best to run it. I usually didn't watch the longer trades- just set it and forget it. ]
WAVE Settings: length= -10 (replace "def length = -50;" with "input length = -50;" and reset to -10 on chart window).; width (variable) = usually 50 or 30, depends on chart period.
Drawdowns listed include spread.
------------------------
Trade #1. Enter LONG. 7/15/15, 1:20pm.
Drawdown 11p. Exit 1:40pm. WIN 5p.

Trade #2. Enter SHORT. 7/15/15, 2:00pm.
Drawdown 7p. Exit 3:20pm. WIN 5p.

Trade #3. Enter SHORT. 7/15/15, 7:10pm.
Drawdown 5p. Exit 7:50pm. WIN 5p.

Trade #4. Enter SHORT. 7/16/15, 7:20am.
Drawdown 9p. Exit 8:00am. WIN 9p.

Trade #5. Enter SHORT. 7/16/15, 1:24pm.
Drawdown 4p. Exit 1:50pm. WIN 7p.

Trade #6. Enter LONG. 7/17/15, 6:40am.
Drawdown 3p. Exit 6:50am. WIN 5p.

Trade #7. Enter SHORT. 7/17/15, 7:27am.
Drawdown 9p. Exit 8:30am. WIN 8p.

Trade #8. Enter SHORT. 7/19/15, 5:12pm.
Drawdown 11p. Exit 7:30pm. WIN 1p.

Trade #9. Enter LONG. 7/19/15, 7:37pm.
Drawdown 12p. Exit 2:49am (7/20/15). WIN 8p.

Trade #10. Enter LONG. 7/20/15, 4:36pm.
Drawdown 16p (EOD surprise). Exit 5:20pm. OUT FLAT.
-----------------------------
Observations.
1. On a 10-min chart, I got in trouble a couple of times but I noticed that almost all trends self-limit to 10-bar max then reverse. So I was confident to stay in the trade.
2. Caution during steep trends against your intended trade,ie, NOT necessarily steep trend of price but steep trend of BANDS.
3. I like the algo well enough that I allow a stoploss of 2x or even 3x target, feeling confident price will come back to me, and so far it has.
5. Gains are small. My target is 10% account compounding per day. I only need 30p per day for that on EURUSD since I run 70% of available margin on each trade. With this WAVES algo and Robert's Averaging algo I now have all the weapons I need.
Methodology.
1. As mtut and optiontrader101 pointed out, this is an evil mutant algo, tongue sticking out smiley even though I like it. Best to watch only current candle near its close in relation to algo, piercing into a band and at least its wick still being there at close. Then trade opposite at open of next bar.
2. Things can go wrong. But usually not for long. If somebody wants to open a freebie chatroom, I'll be glad to take a couple hours to demonstrate this method.



Edited 3 time(s). Last edit at 07/21/2015 02:47AM by baffled1.
plot trendline but not horizontal
July 21, 2015 10:12PM
I would like to plot a trendline on 2 highs in Thinkscript.
I was thinking 2 recent highest highs (on any timeframe)

def HH = HighestAll(high)
def HH = HighestAll(high[1]) <--------------[1] in thinkscript mean 1 prior

plot HighTrendline = ?

Seems somewhat simple but cannot find the right commands to do it.
Horizontal line is well documented but I want a line with some slope on it.
Anyone know how to do this?

Thanks in advance



Edited 3 time(s). Last edit at 07/21/2015 10:20PM by RickT.
Re: plot trendline but not horizontal
July 21, 2015 10:55PM
Quote
RickT
I would like to plot a trendline on 2 highs in Thinkscript.
I was thinking 2 recent highest highs (on any timeframe)

def HH = HighestAll(high)
def HH = HighestAll(high[1]) <--------------[1] in thinkscript mean 1 prior

plot HighTrendline = ?

Seems somewhat simple but cannot find the right commands to do it.
Horizontal line is well documented but I want a line with some slope on it.
Anyone know how to do this?

Thanks in advance

Take a look at the two links below. It's an example of connecting lows but can easily be modified to connect highs instead.

[www.researchtrade.com]

[www.researchtrade.com]

- robert


Professional ThinkorSwim indicators for the average Joe
Re: Fun with ThinkScript
July 23, 2015 12:58PM
Robert:

I looked (to lessen your unmantched generosity) but didn't find a clear example.

Just looking to reference more than one time frame for an indicator or condition.

Say you're looking for strength in the 1hr and 30min time frame before making an entry on the 15min chart.

The strength can be defined as:

def Cond1 = RSI(14) on the 1hr chart > 50;
def Cond2 = RSI(14) on the 30min chart > 50;

plot alert = Cond1 and Cond2;

That's all I need and can take it from there. I remember that simpling lengthening, or shortening the period of the RSI is similar to referencing a longer time frame but can't remeber where I saw that.

Something like If the 15 min RSI(14) updates 4 times(bars) on a 60min chart then referencing the 60min RSI(14) on the 15 min chart would be the equivalent of 4x14 or RSI(56)???
Re: Fun with ThinkScript
July 23, 2015 03:39PM
Quote
Palmer
Just looking to reference more than one time frame for an indicator or condition.

Say you're looking for strength in the 1hr and 30min time frame before making an entry on the 15min chart.

I'm short on time tonight so this'll have to be a super short answer. Ask me again later if you can't figure it out.

First, read TOS tutorial chapter 12 about referencing secondary aggregation periods.

Second, in the example below, the standard RSI is plotted on a 60 min chart and the following code is plotted on a 15 min chart but it references the 60 min RSI.

declare lower;

plot RSI60min = reference RSI(price = close(period = AggregationPeriod.HOUR)).rsi;



- robert


Professional ThinkorSwim indicators for the average Joe
Re: Fun with ThinkScript
July 23, 2015 03:49PM
ahhhhhhhhhhhhhh....got it...thumbs up
Re: Fun with ThinkScript
July 23, 2015 05:17PM
Hi Robert,

Let me know if you would like some divergence studies. I have RSI, MACD, and a few others

Dave
Re: Fun with ThinkScript
July 23, 2015 08:03PM
Hi Robert, 

Let me know if you would like some divergence studies. I have RSI, MACD, and a few others 

Dave

I'm always happy to learn something new. Thanks, Dave.

- robert


Professional ThinkorSwim indicators for the average Joe
Re: Fun with ThinkScript
July 24, 2015 05:33PM
1-RSI divergence, by Mobius, change lengths and modify, let me know what you think

2- MACD Divergence,by Mobius, change lengths and modify

1-RSI:

declare lower;

input nRSI = 5; #hint nRSI: RSI periods
input nTrend = 100; #hint nTrend: RSI Trend Line periods
input over_Bought = 70; #hint over_Bought: Over Bought Line
input over_Sold = 30; #hint over_Sold: Over Sold Line
input MidLine = 50; #hint MidLine: MidLine
input TrendLine = {EMA, SMA, default LRL, WMA};
input AlertOn = yes;

def o = open;
def h = high;
def l = low;
def c = close;
def NetChgAvg = WildersAverage(c - c[1], nRSI);
def TotChgAvg = WildersAverage(AbsValue(c - c[1]), nRSI);
def ChgRatio = if TotChgAvg != 0
then NetChgAvg / TotChgAvg
else 0;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot RSItrend;
switch (TrendLine) {
case EMA:
RSItrend = ExpAverage(RSI, nTrend);
case SMA:
RSItrend = Average(RSI, nTrend);
case LRL:
RSItrend = InertiaAll(RSI, nTrend);
case WMA:
RSItrend = WMA(RSI, nTrend);
}

def lowestLow = if RSI > over_Sold
then l
else if RSI < over_Sold and
l < lowestLow[1]
then l
else lowestLow[1];
def lowestRSI = if RSI > MidLine
then RSI
else if RSI < MidLine and
RSI < lowestRSI[1]
then RSI
else lowestRSI[1];
def divergentLow = if RSI < over_Sold and
l <= lowestLow[1] and
RSI > lowestRSI[1]
then over_Sold
else Double.NaN;
plot DLow = divergentLow;
DLow.SetPaintingStrategy(PaintingStrategy.POINTS);
DLow.SetLineWeight(2);
DLow.SetDefaultColor(Color.YELLOW);

def highestHigh = if RSI < over_Bought
then h
else if RSI > over_Bought and
h > highestHigh[1]
then h
else highestHigh[1];
def highestRSI = if RSI < MidLine
then RSI
else if RSI > MidLine and
RSI > highestRSI[1]
then RSI
else highestRSI[1];
def divergentHigh = if RSI > over_Bought and
h >= highestHigh and
RSI < highestRSI
then over_Bought
else if RSI < over_Bought and
c < o
then Double.Nan
else divergentHigh[1];

plot DHigh = divergentHigh;
DHigh.SetPaintingStrategy(PaintingStrategy.POINTS);
DHigh.SetLineWeight(2);
DHigh.SetDefaultColor(Color.YELLOW);

RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", GetColor(1));
RSI.AssignValueColor(if RSI > over_Bought
then RSI.Color("OverBought"winking smiley
else if RSI < over_Sold
then RSI.Color("OverSold"winking smiley
else RSI.Color("Normal"winking smiley);
OverSold.SetDefaultColor(Color.BLUE);
OverBought.SetDefaultColor(Color.BLUE);

def AlertCond1 = RSI crosses RSItrend;

# Alert(AlertCond1, "RSI crossed RSI Trend Line", Alert.Bar, Sound.Bell);

# End Code Wilders RSI with Divergence






2-Macd

declare lower;

input fastEMA = 12;
input slowEMA = 26;
input Smooth = 9;

def c = close;
def h = high;
def l = low;
def FSignal = (c * .15) + (.85 * ExpAverage(c, fastEMA)[1]);
def SSignal = (c * .075) + (.925 * ExpAverage(c, slowEMA)[1]);

plot MACD = FSignal - SSignal;
MACD.SetPaintingStrategy(PaintingStrategy.LINE);
MACD.SetLineWeight(2);
MACD.AssignValueColor(if MACD < 0 and
MACD < MACD[1]
then Color.RED
else if MACD < 0 and
MACD > MACD[1]
then Color.CYAN
else if MACD > 0 and
MACD > MACD[1]
then Color.GREEN
else Color.LIME);

plot MACDSL = ExpAverage(MACD, Smooth);
MACDSL.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
MACDSL.SetLineWeight(5);
MACDSL.AssignValueColor(if MACDSL < 0 and
MACDSL < MACDSL[1]
then Color.PLUM
else if MACDSL < 0 and
MACDSL > MACDSL[1]
then Color.GREEN
else if MACDSL > 0 and
MACDSL > MACDSL[1]
then Color.BLUE
else Color.LIGHT_RED);

rec MACDh = CompoundValue(1, if MACD < 0
then Double.NaN
else if MACD crosses above 0
then MACD
else if MACD > 0 and
MACD > MACDh[1]
then MACD
else MACDh[1], 0);

rec Valueh = CompoundValue(1, if MACD < 0
then Double.NaN
else if MACD crosses above 0
then h
else if MACD > 0 and
h > Valueh[1]
then h
else Valueh[1], 0);

plot divSignal = if MACD > 0 and
h > Valueh[1] and
MACD < MACDh[1]
then 0
else Double.NaN;
divSignal.SetPaintingStrategy(PaintingStrategy.POINTS);
divSignal.SetLineWeight(4);
divSignal.SetDefaultColor(Color.RED);

rec MACDl = CompoundValue(1, if MACD > 0
then Double.NaN
else if MACD crosses below 0
then MACD
else if MACD < 0 and
MACD < MACDl[1]
then MACD
else MACDl[1], 0);

rec Valuel = CompoundValue(1, if MACD > 0
then Double.NaN
else if MACD crosses below 0
then l
else if MACD < 0 and
l < Valuel[1]
then l
else Valuel[1], 0);

plot divSignall = if MACD < 0 and
l < Valuel[1] and
MACD > MACDl[1]
then 0
else Double.NaN;
divSignall.SetPaintingStrategy(PaintingStrategy.POINTS);
divSignall.SetLineWeight(4);
divSignall.SetDefaultColor(Color.GREEN);

def SMA = Average(c, 20);
def SD = StDev(c, 20);
def ATR = Average(TrueRange(h, c, l), 20);
def UpperBB = SMA + (SD * 2);
def UpperKC = SMA + (ATR * 1.5);
plot SQ = if UpperBB - UpperKC < 0
then 0
else Double.NaN;
SQ.SetPaintingStrategy(PaintingStrategy.Points);
SQ.SetLineWeight(2);
SQ.SetDefaultColor(Color.Yellow);

plot zeroLine = if IsNaN(divSignal) and
IsNaN(divSignall) and
IsNaN(SQ) and
!IsNaN(c)
then 0
else Double.NaN;
zeroLine.SetPaintingStrategy(PaintingStrategy.POINTS);
zeroLine.SetLineWeight(2);
zeroLine.SetDefaultColor(Color.BLUE);

#AddCloud(MACD, MACDSL, Color.LIGHT_GRAY, Color.YELLOW);

plot ArrowUP = if isNaN(SQ) and
SQ[1] == 0 and
MACD >= 0 and
MACD > MACD[1]
then 0
else Double.NaN;
ArrowUP.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
ArrowUP.SetLineWeight(3);
ArrowUP.SetDefaultColor(Color.Green);

def SQbar = CompoundValue(2, if !IsNaN(SQ)
then SQbar[1] + 1
else if UpperBB > UpperKC
then Double.NaN
else SQbar[1], 1);



def LowTrough = if MACDSL < 0 and
MACDSL[1] < MACDSL[2] and
MACDSL > MACDSL[1]
then MACDSL
else if MACDSL > 0
then Double.NaN
else Double.NaN;

plot LowPoint = LowTrough;
LowPoint.EnableApproximation();
LowPoint.SetPaintingStrategy(PaintingStrategy.Line);
LowPoint.SetLineWeight(1);
LowPoint.SetDefaultColor(Color.White);
# End Code
Mel
Re: Fun with ThinkScript
July 25, 2015 01:07PM
Does anyone have code to add a chart bubble to the end of moving average line. Sometimes it gets confusing with multiple moving average and which one is which. I want to see the name of the moving average attach to the line at the end i.e: 50 EMA or 100 SMA.
Re: Fun with ThinkScript
July 25, 2015 01:40PM
Quote
Mel
Does anyone have code to add a chart bubble to the end of moving average line. Sometimes it gets confusing with multiple moving average and which one is which. I want to see the name of the moving average attach to the line at the end i.e: 50 EMA or 100 SMA.



input length = 50;
input AvgType = AverageType.SIMPLE;
input price = close;

plot Avg = MovingAverage(AvgType, price, length);
Avg.SetDefaultColor(Color.DARK_ORANGE);

def lastbar = IsNaN(close[-1]) and !IsNaN(close);
AddChartBubble(lastbar, Avg, "MA" + length, Color.DARK_ORANGE);

- robert


Professional ThinkorSwim indicators for the average Joe
Mel
Re: Fun with ThinkScript
July 25, 2015 02:00PM
Thank you Robert. Is there any way to move it forward in time i.e: 5 bars forward, so it is not covering the current bars?

Mel
Re: Fun with ThinkScript
July 25, 2015 02:04PM
Quote
Mel
Thank you Robert. Is there any way to move it forward in time i.e: 5 bars forward, so it is not covering the current bars?

AddChartBubble(lastbar[-5], Avg, "MA" + length, Color.DARK_ORANGE);

- robert


Professional ThinkorSwim indicators for the average Joe
Mel
Re: Fun with ThinkScript
July 25, 2015 02:12PM
Thank you, mucho appreciated.
Re: Fun with ThinkScript
July 25, 2015 07:23PM
Hi Robert, we're back again with another request.
Is there anyway to attach a sounded alert to the following script.
I would like to get the code to alert when the white volume tick is painted.
I'm sure you know the white volume tick generally coincides with either a doji or hammer like candle.
That would signal a bounce or trend change possibility.
Many thanks

declare lower;
declare zerobase;

plot Vol = volume;

Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up"winking smiley else if close < close[1] then Vol.color("Down"winking smiley else color.white);
Re: Fun with ThinkScript
July 26, 2015 08:19AM
This time it's not a request! the finger smiley

Remember the decal idea? How's this? They would be about 8 inches long and 4 inches high. Viny decals. You could put it on your laptop cover, filing cabinet, car window...center of your wife's make-up mirror...spinning smiley sticking its tongue out

Let me know about any adjustments or idea.

Will send you a few of them. I can adjust the size no problem so let me know about that. PM me your address. You have my word that it will remain P.

Re: Fun with ThinkScript
July 26, 2015 04:50PM
Quote
jakesdad
1-RSI divergence, by Mobius, change lengths and modify, let me know what you think

2- MACD Divergence,by Mobius, change lengths and modify

Thanks for sharing the scripts, Dave. I'll keep them on the back burner for now because I may be able to draw inspiration from them later.



Quote
mark1234
Hi Robert, we're back again with another request.
Is there anyway to attach a sounded alert to the following script.
I would like to get the code to alert when the white volume tick is painted.
I'm sure you know the white volume tick generally coincides with either a doji or hammer like candle.
That would signal a bounce or trend change possibility.
Many thanks

Adding the following to the bottom of your script should do the trick. Change the " same close value as before" portion to whatever you want your alert message to be.

Alert(close == close[1], GetSymbol() + " same close value as before", Alert.BAR, Sound.Bell);



Quote
Palmer
Remember the decal idea? How's this? They would be about 8 inches long and 4 inches high. Viny decals. You could put it on your laptop cover, filing cabinet, car window...center of your wife's make-up mirror...spinning smiley sticking its tongue out

That's very clever. Much better than the idea I had when you first mentioned making vinyl decals. The best I could come up with was just my name.

- robert


Professional ThinkorSwim indicators for the average Joe
Re: Fun with ThinkScript
July 26, 2015 06:42PM
Gotcha....well, now a request. I know it's simple but the past 4 hours has me stumped. Just tryng to reference the MoneyFLowIndex for a condition but things are not lining up correctly....

declare lower;


def mfi = reference MoneyFlowIndex(10, close).MoneyFlowIndex;


def bull = mfi > 50;
def cond1 = bull;

def bear = mfi < 50;
def cond2 = bear;


plot alert1 = cond1;
plot alert2 = cond2;






[i59.tinypic.com]
Re: Fun with ThinkScript
July 26, 2015 07:16PM
Quote
Palmer
Gotcha....well, now a request. I know it's simple but the past 4 hours has me stumped. Just tryng to reference the MoneyFLowIndex for a condition but things are not lining up correctly....

declare lower;


def mfi = reference MoneyFlowIndex(10, close).MoneyFlowIndex;

The MFI reference isn't correct. Please review this post for details on how to properly reference a predefined study.

These are the inputs for MFI. Pay special attention to the order in which they are listed.



The way you are currently referencing MFI { def mfi = reference MoneyFlowIndex(10, close).MoneyFlowIndex; } only provides two inputs while the study is expecting four inputs. That's fine as long as you know that since you didn't specify what the inputs were, the study will apply them in order starting with the first listed input then when it runs out of the inputs you provided, it will assume the default values.

So, what you've done is assign a value of 10 to "over_Sold" and the current "close" value to "over_Bought". Then, the defaults "length = 14" and "movingAvgLength = 1" are assumed.

I believe what you really wanted was this:

def mfi = reference MoneyFlowIndex(length = 10).MoneyFlowIndex;

- robert


Professional ThinkorSwim indicators for the average Joe
Re: Fun with ThinkScript
July 26, 2015 07:24PM
Makes 100% sense..as usual. Totally negated the structure format...will remember that...

Thanks again...
Re: Fun with ThinkScript
July 26, 2015 07:45PM
I think it would look better on the Wife's mirror if it had a clear background instead of Black. grinning smiley

Palmer Wrote:
-------------------------------------------------------
> This time it's not a request! the finger smiley
>
> Remember the decal idea? How's this? They would be
> about 8 inches long and 4 inches high. Viny
> decals. You could put it on your laptop cover,
> filing cabinet, car window...center of your wife's
> make-up mirror...spinning smiley sticking its tongue out
>
> Let me know about any adjustments or idea.
>
> Will send you a few of them. I can adjust the size
> no problem so let me know about that. PM me your
> address. You have my word that it will remain P.
>
> [i62.tinypic.com]
Re: Fun with ThinkScript
July 27, 2015 01:27AM
Thanks Robert will give that a try.
Sorry, only registered users may post in this forum.

Click here to login