A trend, momentum and cycle Trading System v3.0 (CSA)

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

Version 3.1 Release - see post 2 and 3 for more information.

Code:
#CSA - trend, a momentum and a cycle based indicator for ThinkorSwim V3.1
#
# 2020.01.29 V3.1 @diazlaz - Added ADXPaintBarsMode
#                            Integrated Derivative RSI Oscillator Module
 
@diazlaz wow...how the heck did I miss all of this? I was still paying attention to the other thread patiently awaiting updates that happened few days ago...Just to be clear...everything that you update is all on this thread moving forward? I will test out the newest update in post #3...Just curious if you plan on releasing more updates to this such as the Relative Volume by Mobius or the Schaff Trend Cycle? Terrific job once again.
 
@diazlaz wow...how the heck did I miss all of this? I was still paying attention to the other thread patiently awaiting updates that happened few days ago...Just to be clear...everything that you update is all on this thread moving forward? I will test out the newest update in post #3...Just curious if you plan on releasing more updates to this such as the Relative Volume by Mobius or the Schaff Trend Cycle? Terrific job once again.
Hi @HighBredCloud will get Scaff in by this weekend, and will try to see how to best represent the relative volume.
 
@BenTen To prevent the slowing down...and lagging is it best to comment out the studies not used in the CSA vs deleting them from the script itself? I don't think selecting NO on the studies not being used will help with the lag...
Correct is best to comment them out, as it's still being evaluated. it's slightly less since the enable flag will reduce the processing, but try it and see if disabling improves it, or then better off commenting it. from experience, on intel with 8GB, i5 or greater it has no issues running multiple charts with this indicator enabled.
 
Hi @HighBredCloud will get Scaff in by this weekend, and will try to see how to best represent the relative volume.
@diazlaz Sounds good...I will give that a try...In regards to relative volume indicator by Mobius in the code below...IMO the upper study and how it colors the candles would be the most important with the combination of other supertrends already in the CSA. I do not think the lower volume study is necessary. Let me know if you need the Schaff Trend script again the one that has the MA built in so that you can establish the correct logic when you code.

Relative Volume:

Code:
# Volume Comparison 
# Plots Yesterdays Total Volume At Same Bar and Average Volume At Same Bar
# Mobius
# V02.06.2018 Posted to Chat Room 07.13.2018
# tomsk added Alert when today's volume/avgVol > 300%, 1.17.2020

# Plots a comparison of yesterdays total volume at the same bar
# and compares an average volume to the same time yesterday.

declare on_volume;

input avgLength = 10;

def v = volume;
def vD = volume(period = AggregationPeriod.Day);
def c = close;
def x = BarNumber();
def nan = double.nan;
def RTHbar1 = if GetTime() crosses above RegularTradingStart(GetYYYYMMDD())
              then x
              else RTHbar1[1];
def RTH = GetTime() >= RegularTradingStart(GetYYYYMMDD()) and
          GetTime() <= RegularTradingEnd(GetYYYYMMDD());
def PrevRTHbar1 = if RTHbar1 != RTHbar1[1]
                  then RTHbar1[1]
                  else PrevRTHbar1[1];
def indexBar = RTHbar1 - PrevRTHbar1;
plot prevVol = if IsNaN(c)
               then nan
               else GetValue(v, indexBar);
prevVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
prevVol.SetDefaultColor(CreateColor(75, 75, 75));
prevVol.SetLineWeight(1);
plot Vol = v;
Vol.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
Vol.AssignValueColor(if close > open then CreateColor(5, 250, 12) else CreateColor(250, 5, 25));
AssignPriceColor(if close > open then CreateColor(5, 250, 12) else CreateColor(250, 5, 25));
def avgPrev = Average(prevVol, avgLength);
def avgCurr = Average(Vol, avgLength);
def prevDailyVol = if RTH and !RTH[1]
                   then getValue(v, indexBar)
                   else if RTH
                        then compoundValue(1, prevDailyVol[1] + GetValue(v, indexBar), GetValue(v, indexBar))
                   else prevDailyVol[1];
AddLabel(1, "Prev D Vol = " + prevDailyVol +
          "  Prev Vol avg(" + avgLength + ") = " + Round(avgPrev, 0), prevVol.TakeValueColor());
AddLabel(1, "Current D Vol = " + vD +
          "  Curr Vol avg(" + avgLength + ") = " + Round(avgCurr, 0), if vD > prevDailyVol
                                                                      then color.green
                                                                      else color.red);
Alert(vD/avgCurr > 3, "Daily Volume > 300% AvgVol", Alert.BAR, Sound.Ring);
# End Code Volume Comparison
 
V3.2 Released

@HighBredCloud Schaff Wave CrossOver Average Release in V3.2

Code:
#CSA - trend, a momentum and a cycle based indicator for ThinkorSwim V3.2
#
#VERSION
# 2020.02.01 V3.2 @diazlaz - Added SWCA - Schaff Wave CrossOver Average

https://usethinkscript.com/threads/...cycle-trading-system-v3-0-csa.1596/post-14867
Please review the logic of the module, and let me know if you need any changes to it.
@diazlaz WOW...it looks like you were able to incorporate EVERYTHING into this not just the Schaff Wave crossing over the MA...I cannot wait to test this as this indicator is very accurate and keeps you in the trade.

I will also experiment with what you suggested in post number #51...I run this CSA on 6 charts per monitor AND per each TOS instance...and I am running 4 instances of TOS in addition to a separate TMO SuperTrend and Heikin Ashi that I made for an exit indicator...So I might be stretching the limits of the performance...If commenting out the studies not being used is a way to help with performance and reduce lag than its a great thing to know.

Also...I have seen you list in post #6 what appears to be an individual study of the CSA...I am assuming that so people can make their own CSA in what indicators they want to use to avoid performance issues we are talking about?
 
@diazlaz WOW...it looks like you were able to incorporate EVERYTHING into this not just the Schaff Wave crossing over the MA...I cannot wait to test this as this indicator is very accurate and keeps you in the trade.

I will also experiment with what you suggested in post number #51...I run this CSA on 6 charts per monitor AND per each TOS instance...and I am running 4 instances of TOS in addition to a separate TMO SuperTrend and Heikin Ashi that I made for an exit indicator...So I might be stretching the limits of the performance...If commenting out the studies not being used is a way to help with performance and reduce lag than its a great thing to know.

Also...I have seen you list in post #6 what appears to be an individual study of the CSA...I am assuming that so people can make their own CSA in what indicators they want to use to avoid performance issues we are talking about?
Yes, correct. I've tried to decouple the modules and namespace to allow for extensions and version control.

Please keep us updated on your experiences and looking forward to your findings, best pairings based on your tests and observations.

If you have any feedback on logic or indicators just let me know. You might want to adjust the threshold input and the enabled input to change the behavior and signals of the study.
 
@diazlaz I will for sure keep you posted here. Other than the Relative Volume I posted above I really don't know of other indicators that might be beneficial to this study. Did you ever add the original Mobius Heikin Ashi SuperTrend that you corrected due to a potential his potential "mistake" that we talked about before? I am curious to see how using just the SuperTrends and HA would alter the results of the CSA...that will be my test next. The threshold will also be adjusted...I am thinking that if I use lets say 8 indicators I should set the threshold to 4? What do you think?

The CSA as of now seems to be a great trend indicator and it works awesome! You've already incorporated a lot of long trending studies that I am using. Now it's just a matter of preference for the end user to build what suits their trading style. You've truly given the end user to fully customize and a CSA to their liking, preference and trading style.

I do, however, want to bring up the possibility of a lower study to serve as an exit indicator to the CSA you made here. I tagged you in a thread that @YungTraderFromMontana started in his Bullish long term indicator thread...you may want to take a look to see what we've discussed.

There I mentioned a possibility of a lower study that serves as an exit indicator to the upper study. It would have to composed of different indicators...more "sensitive/volatile" to show a potential exit before the upper study reflects such a change I would assume...but who knows perhaps some indicators from the upper study could be used as well...not sure.

The indicators that I had in mind include the following: Stochastic RSI, Stochastic Momentum Index, Fisher Transform, Relative Volume, Lazy Bear's version of Ehlers Universal Oscillator...By themselves they are prone to produce fake signals in a choppy market...They do, however, work great in a trending market as with everything else when the market is trending.

I have something like this in mind for the lower study that will serve as an exit indicator to the upper study. Please see the pic below.


While the upper study colors the candlesticks...the lower study can be made into "dots" that when in confluence the 5 indicators or however many are reflected as dots.

Another option is to include the indicators I made to the upper study CSA...but at that point I don't know IF the outcome will change much as the CSA will try to find confluence when painting the candlesticks. I just don't know much about the outcome and I don't want to guess...I think it would be better to separate the long trending indicators from the more sensitive/volatile indicators personally.

Currently I use and MTF version of TMO along with an regular and MTF SuperTrend...Tend Magic and HA as an exit indicator along with the CSA you made..ONLY because I am still testing the CSA and its remarkable how well the CSA works...There are times tho where an exit indicator is needed as I do find the CSA lags...but that is normal.


regular timeframe SuperTrend, Trend Magic and HA is represented on the bottom of the TMO...and the MTF version is above the TMO...
 
@ezrollin its a dual hull ma set to 20 on both ma's with the dotted being displaced -1...I just reversed the colors because its hard for me to see the cyan over the green for the upward trend from the original script.
Code:
input movAvg1_Price = close;
input movAvg2_Price = close;
input movAvg1_Length = 55;
input movAvg2_Length = 55;
input movAvg1_Displace = 0;
input movAvg2_Displace = -1;
input showMovAvgLines = { default "yes","no"};

def HMA1 = MovingAverage(AverageType.HULL, movAvg1_Price, movAvg1_Length)[-movAvg1_Displace];
def HMA2 = MovingAverage(AverageType.HULL, movAvg2_Price, movAvg2_Length)[-movAvg2_Displace];

plot line1 = if !showMovAvgLines then HMA1 else double.nan;
line1.DefineColor("Up", GetColor(1));
line1.DefineColor("Down", GetColor(0));
line1.SetStyle(Curve.SHORT_DASH);
line1.AssignValueColor(if HMA1 > HMA1[1] then line1.color("Up" ) else line1.color("Down" ));

plot line2 = if !showMovAvgLines then HMA2 else double.nan;
line2.DefineColor("Up", GetColor(1));
line2.DefineColor("Down", GetColor(0));
line2.AssignValueColor(if HMA2 > HMA2[1] then line2.color("Up" ) else line2.color("Down" ));

def Upsignal = close crosses above line2;
def Downsignal =  close crosses below line2;

alert(Upsignal,” Price Crossing UP ”,alert.BAR,sound.DING);
alert(Downsignal," Price Crossing DOWN ",alert.BAR,sound.DING);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
472 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