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

MattATM

MattATM

Member
VIP
@MattATM Thanks a lot!! I was able to understand the basic math behind Newton's model. So for the model would f{x] be a trading signal, ie CCI crosses above 100, with the output being the a stat like expectancy or P/L over a certain time period? How would you find the derivative for that? I understand that you should change the weights depending on VOL. But to find the initial values for the weighting do we derive them from the Newton model?

My experience with signal weighting is some real basic Fuzzy Logic I did by hand.

I mentioned python because I use it and AlphaVantage's free API to backtest strategies. Also its a lot easier to work with data in python than in excel.
It would be crazy difficult to find the derivative for every move of every ticker going back to 2008 it would take a team, machine learning, and serious funding!
But not to worry! The Slope of the Line is ALWAYS the derivative :D ALWAYS ALWAYS ALWAYS!!!! So don't worry the derivative is already handed to us... But we need to minimize the unknowns before we start guessing or I will have a grey beard before it gives the answer...
So you want to standardize around volatility?
Minimize Loss ::: 2ndGuessWeight=1stGuessWeight+([email protected]/[email protected])
then 3rd Guess Weight = ....
.
.
.
100,000,000thGuessWeight=...


Looks difficult but it will solve overnight... What is impossible for a man is easy for a computer. Like when I drove a crane for the Army funny story, I started moving concrete supports by segments by hand. I didn't know I had a 50 ft crane... That could be remote operated. 🤣

What program in Python???
 
MattATM

MattATM

Member
VIP
that's the Frema plotted in a lower study graph. what did you have in mind?
Can you share which Frema? Yes Frema knows on the left that those Bullish candles are really Bearish and Vice Versa... Do you like it in all timeframes? I haven't looked.

Right now I have Frema with the slope & adaptive moving averages...
I know all our lives are disrupted recently but I really was not well prepared. I thank everyone for your patience!
 
MattATM

MattATM

Member
VIP
So for the model would f{x] be a trading signal, ie CCI crosses above 100, with the output being the a stat like expectancy or P/L over a certain time period?
That would make this Way Way to hard to do...
My mistake I didn't explain... Profit / Loss ratio is a ratio so it has not units it is not read in $... If we say Minimize losses the computer will just never trade 🤣 your python will say 0 trades 0 losses bro
!
If we say Maximize Profits your computer will say ohhh ohhh go all in bear stocks and all in bull stocks because of these historic dates So we don't let it do that we just do the large cap stocks and do Buy @ Low Sell @ High!!!
We do NOT NEED to solve anything!!!! We do NOT NEED 100s of guys and a giant computer underground we just tell the computer to guess until it has the best P/L aaand we can just make Losses x 10 greater than Profits so that it really doesn't try to take risk but I would step up the importance of losses slowly.
Because you have so many trends I expect almost negligible losses at the 1st run...

Show me which Python and I will set it up... But first we need to finish the modules...
Thanks @Tostechnical
 
Last edited:
T

Tostechnical

Member
That would make this Way Way to hard to do...
My mistake I didn't explain... Profit / Loss ratio is a ratio so it has not units it is not read in $... If we say Minimize losses the computer will just never trade 🤣 your python will say 0 trades 0 losses bro
!
If we say Maximize Profits your computer will say ohhh ohhh go all in bear stocks and all in bull stocks because of these historic dates So we don't let it do that we just do the large cap stocks and do Buy @ Low Sell @ High!!!
We do NOT NEED to solve anything!!!! We do NOT NEED 100s of guys and a giant computer underground we just tell the computer to guess until it has the best P/L aaand we can just make Losses x 10 greater than Profits so that it really doesn't try to take risk but I would step up the importance of losses slowly.
Because you have so many trends I expect almost negligible losses at the 1st run...

Show me which Python and I will set it up... But first we need to finish the modules...
Thanks @Tostechnical

The program in python uses Alpha Vantage's API. They essentially provide daily and weekly price data going back 20 years along with some indicators. Alpha Vantage
I have some backtesting code for Laguerre filters/RSI I can send you if you want.

When you mean guess do you want the computer to run as many iterations of random buying and selling? So when you say guessvalue is that the price where the program would buy/sell? Im a bit confused there.
Im thinking of replacing Vix with Vixfix so it can be more attuned to the underlying.

Can't wait to work on this with you @MattATM always wanted to try something like this but never knew anyone with the knowledge to work with.

OMG that crane story. You must have been frustrated as hell.
 
D

diazlaz

Well-known member
2019 Donor
VIP
Can you share which Frema? Yes Frema knows on the left that those Bullish candles are really Bearish and Vice Versa... Do you like it in all timeframes? I haven't looked.

Right now I have Frema with the slope & adaptive moving averages...
I know all our lives are disrupted recently but I really was not well prepared. I thank everyone for your patience!
thanks @MattATM - what would it take to do a quick and minimal proof of concept? let's punch out some steps and requirements, and we will help you.
 
MattATM

MattATM

Member
VIP
@diazlaz @HighBredCloud I think you will like the solution to the sharp edges of the sharp geometry of the Schaff Wave - Shaff Trend rectangles, you can keep the standard time intervals recognized the world over for MACD just use this code you were already using here. https://usethinkscript.com/threads/price-trend-indicator-for-thinkorswim.13/page-3
Code:
input SWCA_fastlengthwave = 12;
input SWCA_slowlengthwave = 26;
Without being thrown off in odd time increments...
The solution is to use multiple Schaff time frames. Maybe 13 like the lower in this photo?
input SWCA_fastlengthwave = 12;
input SWCA_slowlengthwave = 26;
https://usethinkscript.com/threads/...swim.13/page-2#lg=_xfUid-1-1586461542&slide=0Does anyone have the code to this lower with the 13 moving averages?
Now I might have to do the subtraction step in the Schaff indicator multiple times but that shouldn't be resource intensive..
@vvcv does anybody have the code to this lower? If not I can figure it out but I would not present it in those bright neon lights I would just have a soft cloud behind the candlesticks and green & red for Bull Bear, AND yellow for narrowing & Black for close trade...
That is what I will do and then I will use some of there for prerequisites to see if bars should be colored at all or left black!
I think this will be popular. I think also require certain ADX minimum too
 
Last edited:
H

HighBredCloud

Active member
VIP
@MattATM...not sure if this is the code you were looking for. I modified it slightly by including the DSS line...
Code:
#STSW = Schaff Trend Line and Schaff Wave Line
#Schaff Trend Line = Used for quick up/down trend declaration
#Schaff Wave Line = Trade Wave in the direction of trend as
#declared by Trend Line.
#Schaff Wave Line can be used alone to enter trend
#declared by the MACD.
#Schaff Wave can be used with the EMA for signals

declare lower;

input fastLengthTrend = 48;
input slowLengthTrend = 104;
input KPeriodTrend = 36;
input DPeriodTrend = 8;
input averageTypeTrend = AverageType.EXPONENTIAL;
input fastLengthWave = 12;
input slowLengthWave = 26;
input KPeriodWave = 9;
input DPeriodWave = 2;
input over_bought = 75;
input over_sold = 25;
input averageTypeWave = AverageType.EXPONENTIAL;

def macdTrend = MovingAverage(averageTypeTrend, close, fastLengthTrend) - MovingAverage(averageTypeTrend, close, slowLengthTrend);
def macdWave = MovingAverage(averageTypeWave, close, fastLengthWave) - MovingAverage(averageTypeWave, close, slowLengthWave);
def fastK1Trend = FastKCustom(macdTrend, KPeriodTrend);
def fastK1Wave = FastKCustom(macdWave, KPeriodWave);
def fastD1Trend = MovingAverage(averageTypeTrend, fastK1Trend, DPeriodTrend);
def fastD1Wave = MovingAverage(averageTypeWave, fastK1Wave, DPeriodWave);
def fastK2Trend = FastKCustom(fastD1Trend, KPeriodTrend);
def fastK2Wave = FastKCustom(fastD1Wave, KPeriodWave);
plot STCTrend = MovingAverage(averageTypeTrend, fastK2Trend, DPeriodTrend);
plot STCWave = MovingAverage(averageTypeWave, fastK2Wave, DPeriodWave);
plot OverBought = over_bought;
plot OverSold = over_sold;

STCTrend.SetDefaultColor(GetColor(8));
STCWave.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(7));
OverSold.SetDefaultColor(GetColor(7));

#plot Fifty_Line = 50;
#fifty_line.SetDefaultColor(GetColor(8));
#fifty_line.HideTitle();
#fifty_line.SetStyle(Curve.SHORT_DASH);

STCTrend.DefineColor("Up", GetColor(1));
STCTrend.DefineColor("Down", GetColor(0));
STCTrend.AssignValueColor(if STCTrend > STCTrend[1] then STCTrend.Color("Up") else STCTrend.Color("Down"));

STCWave.AssignValueColor(if STCWave > STCWave[1] then Color.MAGENTA else Color.CYAN);
STCWave.SetPaintingStrategy(PaintingStrategy.Line_VS_POINTS);

input lengthWave = 10;
plot AvgExpWave = ExpAverage(STCWave, lengthWave);
AvgExpWave.SetDefaultColor(GetColor(1));
AvgExpWave.AssignValueColor(if AvgExpWave > AvgExpWave[1] then Color.YELLOW else Color.DARK_ORANGE);
AvgExpWave.SetPaintingStrategy(PaintingStrategy.Line);
#


# Slow Line
input N2_Period = 21;
input R2_Period = 5;

def Ln2 = Lowest(low, N2_Period);
def Hn2 = Highest(high, N2_Period);
def Y2 = ((close - Ln2)/(Hn2 - Ln2)) * 100;
def X2 = ExpAverage(Y2, R2_period);


def Lxn = Lowest(x2, n2_period);
def Hxn = Highest(x2, n2_period);
def DSS = ((X2 - Lxn)/(Hxn - Lxn)) * 100;


def DSSb = ExpAverage(Dss, R2_period);
#DSSb.setdefaultColor(Color.GREEN);
#DSSb.AssignValueColor(Color.GREEN);

plot DSSsignal = DSSb[1];
DSSsignal.AssignValueColor(if DSSb>DSSsignal then Color.Green else Color.Red);
DSSsignal.SetLineWeight(1);
DSSsignal.SetPaintingStrategy(PaintingStrategy.LINE);
 
MattATM

MattATM

Member
VIP
Would be good, I just got back on. I have some family staying with me cause Gates + CCP just had to have their sickness Tabletop game...
I think for direction between trends we need something like RSI Laguerre Fractal or something? I overhauled the existing indicators and it gives that warning may cause long loading times so I'm going to keep gutting it... One thing that helped was changing the adding Bullish and Bearish at the end. Instead of summing each indicator at the very end it's best to keep a rolling total. Saves on lines of code
 
H

HighBredCloud

Active member
VIP
Would be good, I just got back on. I have some family staying with me cause Gates + CCP just had to have their sickness Tabletop game...
I think for direction between trends we need something like RSI Laguerre Fractal or something? I overhauled the existing indicators and it gives that warning may cause long loading times so I'm going to keep gutting it... One thing that helped was changing the adding Bullish and Bearish at the end. Instead of summing each indicator at the very end it's best to keep a rolling total. Saves on lines of code
Before you spend a lot of time on this CSA...I think it would be more beneficial if you focused on the indicators I mentioned to you in my earlier post. With a CSA of this magnitude the right sets of indicators need to be chosen so that they react according to the timeframe...
 
MattATM

MattATM

Member
VIP
Before you spend a lot of time on this CSA...I think it would be more beneficial if you focused on the indicators I mentioned to you in my earlier post. With a CSA of this magnitude the right sets of indicators need to be chosen so that they react according to the timeframe...
@HighBredCloud @horserider @stayeduptolate @diazlaz Yes sir I have gone through those and even changed Balance of Power to make is work with the other indicators. Original versions had some typos but really nothing was wrong with any of the indicators just that indicators were based on discreet events like lines crossing over that may happen a little sooner or a little later than with the other indicators. As I have learned from you all and Mobius there is no "holy grail" indicator and so instead of choosing one over another I simply softened the ranges of BULL & BEAR.

I just noticed there are guys out there selling your indicators and it definitely isn't me.
Code Thief?

One question I'm wondering is what would you use for the buy sell arrows once everything is done? Do you guys want to use a Zero Lag moving average vs adaptive moving average crossover? Do you guys want to use a Chandelier Exit? What Up DOWN arrow indicator do you guys feel like trying assuming you want accurate and fast (10min or less) and assume I include a scanner that will drop you into the action so you are nopt afraid of your position being chopped up (Scanner has MOBO + ECI(Gaussian)
What did this guy who I think steals your code use? Should I buy it to see and try to return his indicator later?
 
B

bubz

New member
VIP
@HighBredCloud @horserider @stayeduptolate @diazlaz Yes sir I have gone through those and even changed Balance of Power to make is work with the other indicators. Original versions had some typos but really nothing was wrong with any of the indicators just that indicators were based on discreet events like lines crossing over that may happen a little sooner or a little later than with the other indicators. As I have learned from you all and Mobius there is no "holy grail" indicator and so instead of choosing one over another I simply softened the ranges of BULL & BEAR.

I just noticed there are guys out there selling your indicators and it definitely isn't me.
Code Thief?

One question I'm wondering is what would you use for the buy sell arrows once everything is done? Do you guys want to use a Zero Lag moving average vs adaptive moving average crossover? Do you guys want to use a Chandelier Exit? What Up DOWN arrow indicator do you guys feel like trying assuming you want accurate and fast (10min or less) and assume I include a scanner that will drop you into the action so you are nopt afraid of your position being chopped up (Scanner has MOBO + ECI(Gaussian)
What did this guy who I think steals your code use? Should I buy it to see and try to return his indicator later?
No Report him lol
 
YungTraderFromMontana

YungTraderFromMontana

Well-known member
@HighBredCloud @horserider @stayeduptolate @diazlaz Yes sir I have gone through those and even changed Balance of Power to make is work with the other indicators. Original versions had some typos but really nothing was wrong with any of the indicators just that indicators were based on discreet events like lines crossing over that may happen a little sooner or a little later than with the other indicators. As I have learned from you all and Mobius there is no "holy grail" indicator and so instead of choosing one over another I simply softened the ranges of BULL & BEAR.

I just noticed there are guys out there selling your indicators and it definitely isn't me.
Code Thief?

One question I'm wondering is what would you use for the buy sell arrows once everything is done? Do you guys want to use a Zero Lag moving average vs adaptive moving average crossover? Do you guys want to use a Chandelier Exit? What Up DOWN arrow indicator do you guys feel like trying assuming you want accurate and fast (10min or less) and assume I include a scanner that will drop you into the action so you are nopt afraid of your position being chopped up (Scanner has MOBO + ECI(Gaussian)
What did this guy who I think steals your code use? Should I buy it to see and try to return his indicator later?
Nice find, people like this are the scum of the earth. Site full of stolen code over $1,000 in sales and fake positive reviews on his page. I was contemplating botting his account with bad reviews but then who would be the better person. I guess one report will do.
 
H

HighBredCloud

Active member
VIP
@HighBredCloud @horserider @stayeduptolate @diazlaz Yes sir I have gone through those and even changed Balance of Power to make is work with the other indicators. Original versions had some typos but really nothing was wrong with any of the indicators just that indicators were based on discreet events like lines crossing over that may happen a little sooner or a little later than with the other indicators. As I have learned from you all and Mobius there is no "holy grail" indicator and so instead of choosing one over another I simply softened the ranges of BULL & BEAR.

I just noticed there are guys out there selling your indicators and it definitely isn't me.
Code Thief?

One question I'm wondering is what would you use for the buy sell arrows once everything is done? Do you guys want to use a Zero Lag moving average vs adaptive moving average crossover? Do you guys want to use a Chandelier Exit? What Up DOWN arrow indicator do you guys feel like trying assuming you want accurate and fast (10min or less) and assume I include a scanner that will drop you into the action so you are nopt afraid of your position being chopped up (Scanner has MOBO + ECI(Gaussian)
What did this guy who I think steals your code use? Should I buy it to see and try to return his indicator later?
@MattATM So what is your thoughts on the indicators that I listed in my previous post to you? Do you see a benefit to rank them from strongest to weakest? Also optimum timeframes for each indicator? How do you think those indicators would stack up against the indictors in this CSA?

In regards to the code thief...how do you know its the actual code from this CSA? I don't want to spend the $100 to find out either. Its just a shame that people come on this site and profit off other peoples hard work...But how do you stop this?
 
MattATM

MattATM

Member
VIP
In regards to the code thief...how do you know its the actual code from this CSA?
I really don't know for certain where all they stole the code but the same style of images seems to leave a trail that winds across Google searches. I don't think it would be wise of me to buy it just to look at for all I know he just uses 2 moving averages crossing over each other and cherry picked a good image.


So what is your thoughts on the indicators that I listed in my previous post to you?
Yes so I went back to the original Balance of Power not the one in CSA just because it can have bad luck and land poorly in several cases.
Originally all of the indicators were +100 if Bullish and -100 if Bearish so I replaced the sBullish & SBearish lines of code with a direct +/- scoring and now you can use a sliding scale of bullish & bearish. I increased the slimlines "Yellow Bar" point weight from +/-10 to +/-50... It would be easy to have the normalized strength of bullish and bearish to range continuously from -100 to 0 to 100 with the strenght of each indicator instead of just dumb binary switches...

On @HighBredCloud list of indicators the problem I have is I did NOT account for divergences... Remember since we want to simplify and look at less rather than more I should do something with Bullish divergence and Bearish divergence...

I do not have an opinion about what indicators should be preferred over others I am not even a professional trader at all. I could just linerregression all indicators and then have the fraction grow but problem with that is timing.

Where I am now is confused as to what the code thief used to put his UP and DOWN bubbles? I note some signals like the Chandelier are a little slow but very certain and other things are fast but certain. The negative side to these things are they are right for a short time but then the user gets chopped up with constant ups and downs... I am not scared at all of being chopped up because of our scanners.

So
1.) What do you want done with your indicators?
2.) What do you want to use for the arrows in the grey sections without it turning into Hi-Lo Zig-Zag SPAM???
 
MattATM

MattATM

Member
VIP
Nice find, people like this are the scum of the earth. Site full of stolen code over $1,000 in sales and fake positive reviews on his page.
I guess they have been around since 2016 and then they would have sold way more than $1000, the reviews might not have been fake if people on there don't know about you guys or Mobius??? Do you think we should buy it to see what is inside? Would we be able to open the thinkscript or would that be locked? If these thinkscripts were stolen could we complain or ask for refund?
We can open scripts unless they are copyrighted right? So I doubt it is Mobius the rightful owner over there right 🤣🤣🤣???
 
T

ThinkDan

New member
I am a total newb to ThinkScript and this seems like excellent work. I have been testing it with my trading this morning. I like it on a 3 minute chart. I hope that isn't misusing it in some way. Any comments on how I can turn this into a strategy to backtest it a bit? It looks like it doesn't fair all that well for overnight hold, but that's just from an eyeball test. I figure it would just be adding a couple lines of code. I dont even know enough to understand why addorder when bullish or bearish doesn't work. Thanks for any help! Really really excellent work.
 
T

ThinkDan

New member
I am a total newb to ThinkScript and this seems like excellent work. I have been testing it with my trading this morning. I like it on a 3 minute chart. I hope that isn't misusing it in some way. Any comments on how I can turn this into a strategy to backtest it a bit? It looks like it doesn't fair all that well for overnight hold, but that's just from an eyeball test. I figure it would just be adding a couple lines of code. I dont even know enough to understand why addorder when bullish or bearish doesn't work. Thanks for any help! Really really excellent work.
Okay, I don't deserve help if I cant do this myself. Could not be more simple:
AddOrder(OrderType.SELL_AUTO, bearish , tickcolor = COLOR.RED , arrowcolor = COLOR.RED, name = "Sell");
AddOrder(OrderType.BUY_AUTO, bullish , tickcolor = COLOR.GREEN, arrowcolor = COLOR.GREEN , name = "Buy");

Which I had come up with, but then you need to go to properties in the other menu and enable orders.

Oh, and I guess you have to have it in strategies.
 
wtf_dude

wtf_dude

Active member
I am a total newb to ThinkScript and this seems like excellent work. I have been testing it with my trading this morning. I like it on a 3 minute chart. I hope that isn't misusing it in some way. Any comments on how I can turn this into a strategy to backtest it a bit? It looks like it doesn't fair all that well for overnight hold, but that's just from an eyeball test. I figure it would just be adding a couple lines of code. I dont even know enough to understand why addorder when bullish or bearish doesn't work. Thanks for any help! Really really excellent work.
Every box you see at the top that turns green or red is either an indicator or a set of indicators themselves. Supertrend, for example, could be a strategy in itself between going green and red. Your best bet is to go over the list of what each indicator is/does and see which ones you like. Then you can turn off all the other indicators and THEN start figuring out your strategy ie when all 3 trendboxes you choose turn green then buy, etc
 
MattATM

MattATM

Member
VIP
@ThinkDan You are good my friend. This is a very long ongoing thing I think I will just put out a super short proofread version that you can use right away soon. I think I am doing what beginners do and falling into a pit of more and more reading not just this but all the topics.
 
Top