Chasing The Holy Grail

@HighBredCloud
Hey HighBredCloud, just a quick note on a tweak i made this morning and then had a decent trading day with it (i was going to post, last night, a Fib target of 3125 on the S&P e-mini...and it hit. I moved the Trend Line setting in STSW to the following:

input fastLengthTrend = 23;
input slowLengthTrend = 50;
input KPeriodTrend = 17;
input DPeriodTrend = 16;
input averageTypeTrend = AverageType.EXPONENTIAL;

I'll report more tomorrow I hope, pretty busy right now. Good trading
If the up trend continues, i wouldn't be surprised the e-mini getting to 3130 to 3135

@vvcv If you take a look at the regular Schaff indicator the settings are:

input fastLengthTrend = 23;
input slowLengthTrend = 50;
input KPeriodTrend = 10;
input DPeriodTrend = 3;
input averageTypeTrend = AverageType.EXPONENTIAL;

The one that you posted with the Trend Line and Moving average seems to quadruple the MACD settings

input fastLengthTrend = 48;
input slowLengthTrend = 104;
input KPeriodTrend = 36;
input DPeriodTrend = 8;
input averageTypeTrend = AverageType.EXPONENTIAL;

In any case...how did you end up with the K period trend 17 and the D period trend 16 in your original response? Reason why I ask...is that I even changed the settings to 24 52 18 on the multi line Schaff and it didn't work my way...lol...seems like our settings were not too far off...
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@HighBredCloud

I'm trying the new k and d settings on the #1 area in your image. I knew you would figure out that the original settings were MACD settings x4. :) (y)

I've been going back and forth with the Trend settings for awhile. I want them to point out the trend, but i'm thinking that the Stochastic calculations in the indicator may inhibit the idea of making it work as the 'trend' portion of the indicator. I'm thinking of taking out the Stochastic calculations of the Trend line. I'd really like the Trend line to keep you in the longer trend, and use the 'Wave line', more strategically, to add to positions, or get in at a time when you missed the trends initial move. I've also thought of having the Trend line calculate a 15 minute time interval with the 12,26,10,3 settings. That's the basic idea anyway -1 line for the trend 1 for the more strategic entries. I know i could use two different indicators, but I work really well with overbought/oversold type of oscillators. Any ideas on what to do for the Trend portion to the indicator? I hope this makes sense.

I should add that I was told about this indicator by a very good very quick trader, which it works well for. I just added a 'trend' aspect (to try and help me stay in the trade longer), but it's not working as well, for the trend, as I would like it to.

...I've even entertained the idea of putting Heiken Ashi calculations in for the Trend Line. I'm just not that good with coding.
 
@vvcv I don't think the settings you provided go in #1 field...In fact that's how I screwed up today. I think those settings go in the #2 field. I pulled up the original Schaff indicator that you posted a link to in this thread...it was the post that had the MACD script in it as well. You will find that the settings were 23 50 K 10 D 3 OB 75 OS 25...I actually used those settings on a 3 min chart and kept the 12, 26, 9, 2 setting for both the 5 and 15 min...and on a 30 min charts I changed those to 8, 17, 9, 2...

The Trend line appears to be the settings in the field #1 in my pic.

As far as your questions go...This is how I have been testing this indicator:

I paired it with True Momentum Oscillator with Fisher Transform built in.

I also incorporated a Tillson T3 set to 13 periods on both 5 and 15 min charts along with a Dual HULL Moving Average 20 periods on 5 min and 14 periods on 15 min...I displaced the second HULL MA by -1 so that when the HULL does a cross over I can identify if its a pull back or potential reversal by looking at the Tillson T3 to see if that also switched colors. It seems to me that HULL reacts faster than Tillson...but Tillson is the more defined trend. I noticed that when HULL crosses over Tillson that's when you possibly see a Trend Reversal or a continuance of trend.

The basic idea of how I trade this indicator is when the WAVE is purple and breaking over the yellow 10 moving average...even though the TREND line could be RED (or negative) I look at the True Momentum Oscillator to see if that is an uptrend or downtrend...I also peak to see which way the HULL and Tillson moving averages are pointing...Sometimes I find that the True Momentum Oscillator is faster than the HULL or the Tillson...so I make sure if I do engage in a trade that the candles are above or below the HULL or Tillson moving average lines...I hope this helps...I like this indicator a lot...I just need to figure it out more and see how it could be improved...If you find anything else out let me know as I will do the same.

BTW: I will be testing a 3 chart approach tomorrow...3 min 5 min and 15 min using this indicator.

 
@HighBredCloud
t
Okay, i'm confused. :)

You said "The Trend line appears to be the settings in the field #1 in my pic." Which is correct, but you also say "I think those settings go in the #2 field." I'm not sure what you mean in all honesty, as the tweaks that I posted above, of 23,25,17,16 I would place in field #1. As i'm sure you know, both the Trend and Wave fields are interchangeable. I think i've got lost in the technicalities we're speaking of regarding the Trend and Wave fields. 😨

In either case, I use the 'longer' settings in the "Trend" area, and the shorter/faster movements in the "Wave" area. I've also just realized, though it doesn't make a difference on what you see on the indicator, but the code is a bit more organized on the original post I made of Schaff -the one that includes RSI. I have so many versions of this code, but that version I had organized the code a bit more while working on it.

For me anyway, if I could improve the Trend portion of this indicator, it would be the only indicator i need...well, along with HA. I'm doing very good with those two. I would, however, like to try the True Momentum Osc. indicator you have, is the code posted somewhere?

Just an FYI, the e-mini has been rockin' by following and hitting Fib lines day after day.
 
Last edited:
@vvcv I just saw your response now...I don't know how I didn't get an alert. Anyways....please see the TMO code below. It comes with Fisher Transform and time aggregation.

The settings that you mentioned above 23 50 17 16...you should probably put them in the second field labeled in my pic because it seems as tho these settings are for the WAVE...and they resemble the default settings of Schaff indicator that you posted. I have no idea if you altered them or not so I am going by what those settings were by default.

The first field is the trend line...I feel that if you change the settings from 48 104 36 8...you're going to get more fake outs and or the TREND line will resemble the moving average line...I ran into this issue when I changed the TREND line settings to 24 52 18 few days ago before you posted the 23 50 17 16...

Also I don't know where you're getting the 17 and 16 part for the K and the D setting, however, for a longer term trend for stochastics it is recommended to use 21, 7, 7 or even 14,7,7...I have not implemented the settings you put as I just stuck with the original Schaff settings of 23 50 10 3...

I like this indicator...I would like to see how possibly the TREND line could be altered to show a different trend other than MACD settings...I think you mentioned before of implementing Heikin Ashi trend...that would be great if you could do that. I asked before but I wanted to see if was possible to create a SuperTrend that reflected Hekin Ashi trend but on regular candles sticks without the Heikin Ashi candles overlay.

Anyways...trial and error right? I do not trade the e-mini so I cannot say how the settings you mentioned work with that...

TMO with Fisher Transform and higher aggregation script:

Code:
#TMO True Momentum Oscillator with Higher Aggregation _Mobius
#Tuesday, May 15, 2018 12:36 PM
## OneNote Archive Name: TMO True Momentum Oscillator with Higher Aggregation _Mobius
## Archive Section: Momentum
## Suggested Tos Name: TrueMomentumOscillator_w_HigherAggregation_Mobius
## Archive Date: 5.15.2018
## Archive Notes:
## 08:43 Mobius: Well give it a few days to get altered, munched, distorted and twisted. Then when it get back to being used as intended someone will start making money with it.
## 08:45 Mobius: Oh and in my view - It's highest and best use is as designed with a secondary aggregation plotted either on it or with it around 5 to 10 time higher.
## "##" indicates an addition or adjustment by the OneNote Archivist
## Original Code Follows
# TMO ((T)rue (M)omentum (O)scillator) With Higher Aggregation
# Mobius
# V01.05.2018
#hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.

declare Lower;

input length = 14;
input calcLength = 5;
input smoothLength = 3;
input agg = AggregationPeriod.weeK;
input displayFisherLabels = no;

def o = open(period = agg);
def c = close(period = agg);
def data = fold i = 0 to length
           with s
           do s + (if c > getValue(o, i)
                   then 1
                   else if c < getValue(o, i)
                        then - 1
                        else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
     Main.AssignValueColor(if Main > Signal
                           then color.green
                           else color.Red);
     Signal.AssignValueColor(if Main > Signal
                             then color.green
                             else color.red);
     Signal.HideBubble();
     Signal.HideTitle();
addCloud(Main, Signal, Color.LIGHT_GREEN, color.red);
plot zero = if isNaN(c) then double.nan else 0;
     zero.SetDefaultColor(Color.gray);
     zero.hideBubble();
     zero.hideTitle();
plot ob = if isNaN(c) then double.nan else round(length * .8);
     ob.SetDefaultColor(Color.gray);
     ob.HideBubble();
     ob.HideTitle();
plot os = if isNaN(c) then double.nan else -round(length * .8);
     os.SetDefaultColor(Color.gray);
     os.HideBubble();
     os.HideTitle();
addCloud(ob, length, Color.LIGHT_RED, Color.LIGHT_RED, Yes);
addCloud(-length, os, Color.GREEN, Color.GREEN, showBorder = Yes);
# End Code TMO with Higher Aggregation

# JQ_FisherTransform_wLabels v02
# assistance provided by AlphaInvestor, amalia, randyr and nube

# v02 9.23.2018 JQ added arrows

input Fisherprice = hl2;
input FisherLength = 10;
input TriggerLineOffset = 1; # Ehler's value of choice is 1
input TriggerLine_Color_Choice = {"magenta", "cyan", "pink", default "gray", "Mustard", "red", "green", "dark_gray", "Pale Yellow", "white"};
input deBug = no;

input BuyLabelText = " FisherTransform Buy ";
input SellLebelText = " FisherTransform Sell ";

def maxHigh = Highest(Fisherprice, FisherLength);
def minLow = Lowest(Fisherprice, FisherLength);
def range = maxHigh - minLow;
def value = if IsNaN(Fisherprice)
then Double.NaN
else if IsNaN(range)
then value[1]
else if range == 0
then 0
else 0.66 * ((Fisherprice - minLow) / range - 0.5) + 0.67 * value[1];
def truncValue = if value > 0.99 then 0.999 else if value < -0.99 then -0.999 else value;
def fish = 0.5 * (Log((1 + truncValue) / (1 - truncValue)) + fish[1]);
def FTOneBarBack = fish[TriggerLineOffset];
def FT = fish;

plot FisherBullCross = if FT crosses above FTOneBarBack then lowestall(Main) else Double.NaN;
FisherBullCross.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
FisherBullCross.SetDefaultColor(Color.UPTICK);

plot FisherBearCross = if FT crosses below FTOneBarBack then highestall(Main) else Double.NaN;
FisherBearCross.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
FisherBearCross.SetDefaultColor(Color.DOWNTICK);



AddLabel (displayFisherLabels, "" + if FT >= FTOneBarBack then BuyLabelText else SellLebelText + " ",
(if FT > FTOneBarBack
then Color.LIGHT_GREEN
else if FT < FTOneBarBack
then Color.LIGHT_RED
else Color.GRAY));



# End Fisher Transform Code

Also...here is a pic of TMO with a secondary TMO with higher aggregation of 6 times the original timeframe...the idea is to match both trends and go in the same direction of both trends...the shorter TMO will serve as the pull back and the longer TMO will serve as the trend...

Please see how that method compares with the Schaff indicator you posted with the multiple lines.

 
Last edited by a moderator:
@HighBredCloud

A few weeks ago I talked with a retired trader I know, an old boss/friends father, and his idea was, why not just use moving averages to display trend. After that talk, I made a ribbon of SMAs (which I've posted a picture of a few days ago), today I used it for trading. I had a very successful day, and glad i've kept his suggestions in mind, because pairing it with Schaff and HA, it all seemed to paint a very simple perspective on price action.

to make a long story short, I made an image of my trades. I was also pretty damned happy when I woke up to see that the e-mini hit the target I called out last night in a post above...the high hit 3132.50. Right smack in the middle of the target i called "between 3130 and 3135. There's not an edit on the post either. It's just uncanny how the e-mini has been following Fibs. I mean c'mon, that's almost spooky. Anyway, that told me it was going to be a 'down' day. So the image i'm posting shows 3 shorts. The ribbon may not be for you, but damn, with Schaff, it's really strong.

The ribbon gives me very clear trend lines to draw on it. You will notice that uptrend is green, downtrend is purple. In an up move, for example, the ribbon slowly starts to show blips of purple when the trend starts to rest, or come to an end. At this time, when uptrend is over, the ribbon crosses over to full purple, this is when I know to get out of the trade. At that time, it will also cross below the uptrend line. It's so simple, easy, and accurate, because there is no room for interpretation. It is all just price action. I like it a lot when paired with STSW.

Now, how to get this kind of information (what the ribbon shows) into the Trend line of the Schaff Indicator. I'm just gonna call it what i named it STSW (Schaff Trend/Schaff Wave). Anyway, i'm going to test the ribbon more, I just exited another winning trade while using it. Just trying to figure out a way to get the calculations into STSW.

I hope the image sheds some light. I'm thinking the e-mini may go lower from now and near 3100 unless the FMOC does something positive or some good interest rates news hits the markets.

Thanks for the code and good trading to you tomorrow.
3-Shorts.jpg
 
@vvcv very interesting work! AND yes you called the price on e-mini...I remember reading about it. The wave that you built...was that based on the FISH indicator you shared earlier? Anyways...yeah I would really LOVE to see you find a better way to implement the TREND line on the STWS indicator...I think that's the only place where the indicator falls a bit short when I compare it to other "TREND" type lines...its not bad tho, but using it with the WAVE at times does create an issue...Good luck trading to you as well...keep me posted on this. BTW...if you are using moving averages...check out the NEW Slimmer Ribbon with line smoothing @netarchitech just finished...fresh from the oven...still warm. More enhancements will probably be made...but for now here it is.

Slimmer Ribbon

Code:
# filename: MR__EZ_Slimmer_Ribbon_
# source: https://usethinkscript.com/threads/slim-ribbon-indicator-for-thinkorswim.245/
# original authors: Slim Miller and [USER=140]@markos[/USER]
# idea source: [USER=1381]@HighBredCloud[/USER]
# enhancements: [USER=72]@netarchitech[/USER]

#V01.01.11.20.2019

input price = close;
input SlimmerMALength1 = 8;
input SLimmerMALength2 = 13;
input SlimmerMALength3 = 21;
input SlimmerMAType = AverageType.EXPONENTIAL;

# plot and smooth the Moving Averages
def SlimmerMA1 = MovingAverage(SlimmerMAType, price, SlimmerMALength1);
plot SlimmerMovAvg1 = SlimmerMA1;
SlimmerMovAvg1.SetDefaultColor(Color.GREEN);
SlimmerMovAvg1.SetLineWeight(2);
SlimmerMovAvg1.hide();

def SlimmerMA2 = MovingAverage(SlimmerMAType, price, SlimmerMALength2);
plot SlimmerMovAvg2 = SlimmerMA2;
SlimmerMovAvg2.SetDefaultColor(Color.YELLOW);
SlimmerMovAvg2.SetLineWeight(2);
SlimmerMovAvg2.hide();

def SlimmerMA3 = MovingAverage(SlimmerMAType, price, SlimmerMALength3);
plot SlimmerMovAvg3 = SlimmerMA3;
SlimmerMovAvg3.SetDefaultColor(Color.RED);
SlimmerMovAvg3.SetLineWeight(2);
SlimmerMovAvg3.hide();


input applySelectSmoothing = yes;

def smooth_MA1 = EhlersSuperSmootherFilter(MovingAverage(SlimmerMAType, price, SlimmerMALength1));
def smooth_MA2 = EhlersSuperSmootherFilter(MovingAverage(SlimmerMAType, price, SlimmerMALength2));
def smooth_MA3 = EhlersSuperSmootherFilter(MovingAverage(SlimmerMAType, price, SlimmerMALength3));

input SelectSmoothingType = {default "Smooth MAs", "No Smoothing"};

plot X;
X.SetDefaultColor(Color.GREEN);
X.SetLineWeight(2);
plot Y;
Y.SetDefaultColor(Color.YELLOW);
Y.SetLineWeight(2);
plot Z;
Z.SetDefaultColor(Color.RED);
Z.SetLineWeight(2);

switch (SelectSmoothingType) {
case "Smooth MAs":
    X = if applySelectSmoothing and SlimmerMA1 then smooth_MA1 else SlimmerMA1;
    Y = if applySelectSmoothing and SlimmerMA2 then smooth_MA2 else SlimmerMA2;
    Z = if applySelectSmoothing and SlimmerMA3 then smooth_MA3 else SlimmerMA3;
case "No Smoothing":
    X = if applySelectSmoothing and SlimmerMA1 then SlimmerMA1 else SlimmerMA1;
    Y = if applySelectSmoothing and SlimmerMA2 then SlimmerMA2 else SlimmerMA2;
    Z = if applySelectSmoothing and SlimmerMA3 then SlimmerMA3 else SlimmerMA3;
}
;
 
@HighBredCloud

Hey, I've been thinking and looking around for some indicators to perhaps cut/paste into STSW for the "trend" settings. I've even looked up the Schaff Trend Cycle developer in hopes of asking him a question or two, but it looks like he's a CEO at a forex broker house, so not going to bother. You mentioned before about getting the HA values in an above post "create a SuperTrend that reflected Hekin Ashi trend but on regular candles sticks without the Heikin Ashi candles overlay".

I'm thinking this would be a fantastic implementation into the Trend value of STSW. I just can't find a HA indicator to get ideas from, and I'm certainly not skilled enough at coding to do this from nothing. I did find the page listed below however. Below is an image at this link. It shows an HA cloud/color laid over hollow candles. It may be something similar to what you were considering with the SuperTrend idea. I can't find a link to any indicator though. If we were able to find/get the code, it may be a good insight for me to start coding. Then the STSW would be at an even better starting point for more fine tuning. If you don't mind, have a look'sie and let me know what you think. I think we're both seeing how an HA based Trend line settings, to STSW, could be beneficial. Personally, I'd feel more confident with something like that in STSW -in order to start placing larger e-mini contract sizes.

Link: https://researchtrade.com/forum/read.php?7,2258,page=18

7z3n6n5.png
 
@HighBredCloud

Hmm, let me back up. I actually did find code to this HA cloud. Somewhere in the thread, someone mentioned something about the 'posted code being incomplet'. Well, just for kicks, i placed the code and got it up. So, it is a complete indicator, maybe I could find a way to place regular candles for you. Plus, it may be some code I could implement into STSW. I'll get back with you on that. Here's the HA Clould/Candle code for the image I posted above.

Code:
declare lower;

def o = open;
def h = high;
def l = low;
def c = close;
def HAclose = ohlc4;
def HAopen = CompoundValue(1, (HAopen[1] + HAclose[1]) / 2,
(o[1] + c[1]) / 2);
def haopen_ = HAopen + 0;
def HAhigh = Max(Max(h, HAopen), HAclose);
def HAlow = Min(Min(l, HAopen), HAclose);

def openmod = if haopen > haclose then haclose else haopen;
def closemod = if haopen > haclose then haopen else haclose;


AddChart(fallcolor = color.black, high = HAhigh, low = HAlow, open = openmod, close = closemod, type = ChartType.CANDLE);

addcloud(haopen_, haclose, color.downtick, color.uptick);
 
@HighBredCloud

Okay, maybe you could use this. This new code is placed on your price pane, choose candle type, and the cloud will give you Heiken Ashi Values (ups/downs -even over regular candles). Do try it with hollow regular candles. Hope it's something close to what you were looking for.

Code:
def o = open;
def h = high;
def l = low;
def c = close;
def HAclose = ohlc4;
def HAopen = CompoundValue(1, (HAopen[1] + HAclose[1]) / 2,
(o[1] + c[1]) / 2);
def haopen_ = HAopen + 0;
def HAhigh = Max(Max(h, HAopen), HAclose);
def HAlow = Min(Min(l, HAopen), HAclose);

def openmod = if haopen > haclose then haclose else haopen;
def closemod = if haopen > haclose then haopen else haclose;

#addcloud(haopen_, haclose, color.downtick, color.uptick);

AddCloud(HAClose, HAopen_, Color.BLUE,  Color.red);
AddCloud(HAOpen_, HAClose, Color.red,  Color.Blue);

EDIT: Changed the cloud so it is a less transparent cloud. Planning to add an option to turn on/off cloud on the version that included the HA Candles. I've always wanted HA and regular candles on same chart
 
Last edited:
@vvcv I have several Heiken Ash candles that overlay on regular candles...give those a try and see if you can use the code for something useful.

Code:
# TS_HeikinAshiSmoothed
# http://www.thinkscripter.com
# [email protected]
# Last Update 30 June 2013

### YOU MUST HAVE THE STYLE SETTING FIT STUDIES ENABLED ###
#hint: The style setting Fit Studies must be enabled to use these bars.

input period = 21;
input hideCandles = NO;
input candleSmoothing = {default Valcu, Vervoort};

DefineGlobalColor("RisingMA", color.blue);
DefineGlobalColor("FallingMA", color.red);

input movingAverageType = {default TEMA, Exponential, Weighted, Hull, Variable, SIMPLE};

def openMA;
def closeMA;
def highMA;
def lowMA;

switch (movingAverageType) {
case Simple:
    openMA = compoundValue(1, Average(open, period), open);
    closeMA = compoundValue(1, Average(close, period), close);
    highMA = compoundValue(1, Average(high, period), high);
    lowMA = compoundValue(1, Average(low, period), low);
case Exponential:
    openMA = compoundValue(1, ExpAverage(open, period), open);
    closeMA = compoundValue(1, ExpAverage(close, period), close);
    highMA = compoundValue(1, ExpAverage(high, period), high);
    lowMA = compoundValue(1, ExpAverage(low, period), low);
case Weighted:
    openMA = compoundValue(1, WMA(open, period), open);
    closeMA = compoundValue(1, WMA(close, period), close);
    highMA = compoundValue(1, WMA(high, period), high);
    lowMA = compoundValue(1, WMA(low, period), low);
Case Hull:
    openMA = compoundValue(1, HullMovingAvg(open, period), open);
    closeMA = compoundValue(1,  HullMovingAvg(close, period), close);
    highMA = compoundValue(1,  HullMovingAvg(high, period), high);
    lowMA = compoundValue(1,  HullMovingAvg(low, period), low);
case variable:
    openMA = compoundValue(1, VariableMA(open, period), open);
    closeMA = compoundValue(1, VariableMA(close, period), close);
    highMA = compoundValue(1, VariableMA(high, period), high);
    lowMA = compoundValue(1, VariableMA(low, period), low);
case TEMA:
    openMA = compoundValue(1, TEMA(open, period), open);
    closeMA = compoundValue(1, TEMA(close, period), close);
    highMA = compoundValue(1, TEMA(high, period), high);
    lowMA = compoundValue(1, TEMA(low, period), low);
}


hidePricePlot(hideCandles);

def haOpen;
def haClose;

switch(candleSmoothing) {
case Valcu:

    haOpen = CompoundValue(1, ( (haOpen[1] + (openMA[1] + highMA[1] + lowMA[1] + closeMA[1]) /4.0)/2.0), open);
    haClose = ((OpenMA + HighMA + LowMA + CloseMA)/4.0) ;
   
case Vervoort:
    haOpen = CompoundValue(1, ( (haOpen[1] + (openMA[1] + highMA[1] + lowMA[1] + closeMA[1]) /4.0)/2.0), open);
    haClose = ((((OpenMA + HighMA + LowMA + CloseMA)/4.0) + haOpen + Max(HighMA, haOpen) + Min(LowMA, haOpen))/4.0);

}

plot o = haopen;
o.hide();

def haLow =  min(lowMA, haOpen);
def haHigh = max(highMA,haOpen);

AddChart(high = haHigh, low  = haLow, open = o, close = haclose, type = ChartType.CANDLE, growColor = GlobalColor("RisingMA"), fallColor = GlobalColor("FallingMA"), neutralColor = color.gray);
 
@vvcv here's another...

Code:
# Heikin Ashi Smoothed
# HoboTheClown / blt
# 9.15.2016

# HoboTheClown: I recently found a code for smoothed heiken ashi bars, 
# however for some reason all the bars are displayed as one color (going up or down). 
#
# blt: Modified the code and replaced the addchart code at the bottom,
# you should now see proper coloring. This is how that was coded to plot 
# as an overlay to the chart candlesticks. That is two sets of candles, 
# with different coloring for each. If you have the heikin ashi candle 
# coloring code on your chart, then they will likely appear the same color.

input period = 6;
input hideCandles = YES;
input candleSmoothing = {default Valcu, Vervoort};

DefineGlobalColor("RisingMA", color.green);
DefineGlobalColor("FallingMA", color.red);

input movingAverageType = {Simple, default Exponential, Weighted, Hull, Variable, TEMA};

def openMA;
def closeMA; 
def highMA; 
def lowMA; 

switch (movingAverageType) {
case Simple:
    openMA = compoundValue(1, Average(open, period), open);
    closeMA = compoundValue(1, Average(close, period), close);
    highMA = compoundValue(1, Average(high, period), high);
    lowMA = compoundValue(1, Average(low, period), low);
case Exponential:
    openMA = compoundValue(1, ExpAverage(open, period), open);
    closeMA = compoundValue(1, ExpAverage(close, period), close);
    highMA = compoundValue(1, ExpAverage(high, period), high);
    lowMA = compoundValue(1, ExpAverage(low, period), low);
case Weighted:
    openMA = compoundValue(1, WMA(open, period), open);
    closeMA = compoundValue(1, WMA(close, period), close);
    highMA = compoundValue(1, WMA(high, period), high);
    lowMA = compoundValue(1, WMA(low, period), low);
Case Hull:
    openMA = compoundValue(1, HullMovingAvg(open, period), open);
    closeMA = compoundValue(1, HullMovingAvg(close, period), close);
    highMA = compoundValue(1, HullMovingAvg(high, period), high);
    lowMA = compoundValue(1, HullMovingAvg(low, period), low);
case variable:
    openMA = compoundValue(1, VariableMA(open, period), open);
    closeMA = compoundValue(1, VariableMA(close, period), close);
    highMA = compoundValue(1, VariableMA(high, period), high);
    lowMA = compoundValue(1, VariableMA(low, period), low);
case TEMA:
    openMA = compoundValue(1, TEMA(open, period), open);
    closeMA = compoundValue(1, TEMA(close, period), close);
    highMA = compoundValue(1, TEMA(high, period), high);
    lowMA = compoundValue(1, TEMA(low, period), low);
}

#hidePricePlot(hideCandles);

def haOpen;
def haClose;

switch(candleSmoothing) {
case Valcu:
    haOpen = CompoundValue(1, ( (haOpen[1] + (openMA[1] + highMA[1] + lowMA[1] + closeMA[1]) /4.0)/2.0), open);
    haClose = ((OpenMA + HighMA + LowMA + CloseMA)/4.0) ;

case Vervoort:
    haOpen = CompoundValue(1, ( (haOpen[1] + (openMA[1] + highMA[1] + lowMA[1] + closeMA[1]) /4.0)/2.0), open);
    haClose = ((((OpenMA + HighMA + LowMA + CloseMA)/4.0) + haOpen + Max(HighMA, haOpen) + Min(LowMA, haOpen))/4.0);
}

plot o = haopen;
o.hide();

def haLow = min(lowMA, haOpen);
def haHigh = max(highMA,haOpen); 

### NO LONGER SUPPORTED BY TOS
###
### AddChart(high = haHigh, low = haLow, open = o, close = haclose, type = ChartType.CANDLE, growColor = GlobalColor("RisingMA"), fallColor = GlobalColor("FallingMA"), neutralColor = color.gray);

input charttype = ChartType.CANDLE;
def haopen_ = if haopen>haclose 
              then HAopen + 0 
              else double.nan;
def HAhi   = if haopen>=haclose 
              then hahigh
              else double.nan;
def HAlo    = if haopen>=haclose 
              then halow
              else double.nan;

AddChart(growColor = color.red, fallColor = Color.green, neutralColor = Color.current, high = HAhi, low = HAlow, open = haopen_, close = HAclose, type = ChartType.CANDLE);

def HAclose1 = ohlc4;
def HAopen1  = if haopen<=haclose 
               then CompoundValue(1, (HAopen[1] + HAclose[1]) / 2, (open[1] + close[1]) / 2)             
               else double.nan;
def haopen_1 = if haopen<=haclose 
               then HAopen1 + 0
               else double.nan;
def HAhigh1  = hahigh;
def HAlow1   = halow;

AddChart(growColor = Color.green, fallColor = Color.red, neutralColor = Color.current, high = HAhigh1, low = HAlow1, open = haopen_1, close = HAclose1, type = ChartType.CANDLE);

# End Study
##############################################################################
 
Last edited by a moderator:
yeah man, I've tried so many things and i just don't have enough understanding of 'creating' code. The best i could do is tweak existing code. I think i'm gonna have to use another indicator for the trend.
 
@HighBredCloud

hehe! Okay, just tried to make an indicator with 2 SMA's and 2 EMA's on their own indicator. I then tried the same code to an existing indicator and the results are different. I then went even more basic and tried to add code from a simple indicator I made that plots a long trend cloud, and jeez, the results are different when i placed that code to my ribbon indicator. No idea as to why -can't make heads or tails out of it. I don't think I can trust anything I make until I could understand why a SMA cloud indicator, on it's own, shows different results when that simple code is added to an indicator with other MA's on it. ugggg!!!🤬

Maybe we could get some help from someone with a little free time. We do have a direction we want to take STSW
 
@HighBredCloud

hehe! Okay, just tried to make an indicator with 2 SMA's and 2 EMA's on their own indicator. I then tried the same code to an existing indicator and the results are different. I then went even more basic and tried to add code from a simple indicator I made that plots a long trend cloud, and jeez, the results are different when i placed that code to my ribbon indicator. No idea as to why -can't make heads or tails out of it. I don't think I can trust anything I make until I could understand why a SMA cloud indicator, on it's own, shows different results when that simple code is added to an indicator with other MA's on it. ugggg!!!🤬

Maybe we could get some help from someone with a little free time. We do have a direction we want to take STSW
@vvcv I am not a coder or else I would help...but let me tag some that could possibly help you with what you are looking for. ANY one willing to try this? I tested this indicator and its good...I would like to see a Heiken Ashi type trend line personally...Have you tried Tillson Trend Line for this possibly?

@netarchitech @tomsk @diazlaz @horserider
 
@HighBredCloud

Just got it and noticed it's T3. If it's like T3 in Ninja Trader, i actually used that T3 years ago. There was a programmer actually working with the T3 indicator where he was trying to plot, from the latest bar/last two highest highs/last two lowest lows, in an attempt to plot two 'visualized' movements /directions/plots the T3 may go in the near future. Was a very interesting concept, sadly we did not see it come to fruition. Jusr due to lack of abilities on the Ninja platform.
 
@vvcv try this Tillson...you can go as high as T6...

code:

Code:
# filename: Tillson_T3_Moving_Average
# source: https://futures.io/thinkorswim/34287-tilson-t3-moving-average.html#post460861
# created by: rmejia
# last update: 12/17/2014

#hint:<b>T3 Adaptive Smoothing Indicator</b>\nThis study was adopted from the Technical Analysis of Stocks and Commodities article "Smoothing Techniques for More Accurate Signals" by Tim Tillson, Jan 1998 (V16:1 pp33-37)
#hint: indicator: Defines the level of filtering to occur, default is 3
#hint: volumeFactor: Adjusts the amplitude of the feedback added back into the base filter

declare upper;

input indicator    = { T1, T2, default T3, T4, T5, T6 };
input price        = close;
input period       = 15;
input volumeFactor = 0.70;
input displace = 0;
input sign         = { default plus, minus };
input Label        = No;
input paintbars    = No;


script _gd {
  input _price  = close;
  input _period = 10;
  input _v      = 0.70;
  input _sign   = { default plus, minus };
  def _ema      = ExpAverage( _price, _period );
  plot _gd      = ( _ema * ( 1 + _v ) ) - ( ExpAverage( _ema, _period ) * _v );
}

def _t1 = _gd( price[-displace], period, volumeFactor, sign );
def _t2 = _gd( _t1,   period, volumeFactor, sign );
def _t3 = _gd( _t2,   period, volumeFactor, sign );
def _t4 = _gd( _t3,   period, volumeFactor, sign );
def _t5 = _gd( _t4,   period, volumeFactor, sign );
def _t6 = _gd( _t5,   period, volumeFactor, sign );

plot T3;
switch( indicator ) {
  case T1:
    T3 = _t1;
  case T2:
    T3 = _t2;
  case T3:
    T3 = _t3;
  case T4:
    T3 = _t4;
  case T5:
    T3 = _t5;
  case T6:
    T3 = _t6;
}

T3.AssignValueColor(if T3 > T3[1] then Color.GREEN else Color.RED);
T3.HideBubble();

AddLabel(Label, if T3 > T3[1] then "  A  " else "  A  ", if T3 > T3[1] then Color.GREEN else Color.RED);

assignPriceColor(if paintbars and T3 < T3[1] then color.DARK_RED else if paintbars and T3 > T3[1] then color.DARK_GREEN else color.CURRENT);
 
@HighBredCloud

I was talking with a friend, who still actively trades with NinjaTrader and I told him about what I was trying to do with Schaff Trend. He mentioned a indicator he's come across in NT. I read the description and it sounded similar to what I want to do with STSW. I loaded up NT with this indicator and grabbed a screenshot for you. Looks exactly what I was visualizing with the Trend settings in STSW. I've also included the Schaff Trend Cycle for a reference. Looks like something I'd like to put in as the STSW Trend settings. Going to watch it during tomorrow's session.

Schaff doesn't seem to be getting interest here, and it's making me too much money to not seriously find a trend indicator to use with it. If it works out, I may move some cash to my NT broker if i like this indicator enough. (i hear NT 8 is pretty stable now).

https://ninjatraderecosystem.com/user-app-share-download/wave-trend-oscillator-2/
Wave-Trend-an-Schaff-Trend.jpg
 
Thread starter Similar threads Forum Replies Date
G TradingWarz Holy Grail / Nirvana For ThinkOrSwim Indicators 17
BenTen Holy Grail ADX Trading Setup for ThinkorSwim Indicators 60

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
302 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top