Momentum Paint Candles

hockeycoachdoug

Active member
2019 Donor
VIP
----------------------------------------------------------------------------------------------------
mod note:
original can be found:
https://usethinkscript.com/threads/a-trend-momentum-and-cycle-trading-system-v3-0-csa.1596/

----------------------------------------------------------------------------------------------------
I watched a webinar awhile back that made the premise that combining a trend based indicator, a momentum based indicator and a cycle based indicator gives a good indication of directional bias. I would like to combine these 3 components into one paintbar type indicator and am hoping one of you coding pros might find value in this and be willing to code it here for the community.
For the trend indicator I want to use supertrend available here by Mobius. Here is the link SuperTrend by Mobius
For the momentum indicator I want to use True Momentum Oscillator (TMO). Here is the link TMO for TOS
For the cycle indicator I want to use TOP Cycle Trader. I am posting the code for this indicator here-

Code:
declare lower;
#plot Data = close;
input   FastCycleLength = 5;
input   SlowCycleLength = 8;
#def   CycleLineColor=DefineGlobalColor(Color.RED);
#input   CycleHistColor=Color.BLUE;
#input   ZeroLineColor1 = GetColor(1);
DefineGlobalColor("CycleLineColor", Color.RED);
DefineGlobalColor("CyclehistColor", Color.BLUE);
DefineGlobalColor("ZeroLineColor", Color.YELLOW);
def H = high;
def L = low;
#def FastVar(0),SlowVar(0),DiffVar(0);

def FastVar = ExpAverage((H + L) / 2, FastCycleLength);
def SlowVar = Average((H + L) / 2, SlowCycleLength);
def DiffVar = FastVar - SlowVar;

plot pDiffVar = DiffVar;
pDiffVar.SetDefaultColor(GlobalColor("CycleLineColor"));
plot pDiffVar2 = DiffVar;
pDiffVar2.SetDefaultColor(GlobalColor("CycleHistColor"));
plot pZeroLine = 0;
pZeroLine.SetDefaultColor(GlobalColor("ZeroLineColor"));
#Plot1(DiffVar,"Cycle",CycleLineColor);
#Plot2(DiffVar,"CycleHist",CycleHistColor);
#Plot3(0    ,"Zero",ZeroLineColor);

Here is how I envision the paintbar working-
When the supertrend indicator is long that would equal +1, when its short -1.
When the TMO is green that would equal +1. when its red its -1.
When the TOP Cycle Trader is above zero that would equal +1, when its below zero -1.
When all 3 indicators are equal to +1 making +3 total the price bars would paint green.
When all 3 indicators are equal to -1 making -3 total the price bars would paint red.
If the combination of all 3 indicators equals anything else, the price bars would paint gray meaning all 3 indicators were not in agreement.

I am open to any and all suggestions. I considered MACD for the momentum indicator but thought TMO was better. Considered Doncian channel for trend but thought supertrend was better. I am hoping one of you coders out there find this idea worthy of putting in the effort to code and share with us here.

I also want to create a scan/ watchlist using this where I can add a number of stock symbols to a watchlist and have the following columns showing symbol, color of bar on a daily basis (or long term) (red, green, or gray), color of bar on a 15 or 30 minute basis (short term)(red, green, or gray, and a column showing average volatility for some period of bars to use as a sort column to find the symbols that are moving.

I want to use this in 3 ways. First as a way to confirm directional bias of trade I am in ( I should be long if bars are green). second with the scanner portion, when both a long term (daily) and a short term (15 or 30 min) are both same color then enter a trade in that colors direction. Lastly as a portfolio management feature. Take a portion of money and break into 5-10 slots each represented by a sector ETF such as 50K broken into 5 trading slots of 10K committed to each ETF. When daily bars are green for a specific ETF, that slot is long all 10K, when its red that slot is in cash.
Thank you in advance.
 
Last edited by a moderator:
I have a free to all indicator that I want to convert to a paintbar study. All I want is for when the indicator value increases on the next bar it paints the bar green and when the indicator value goes down the next bar it paints the bar red. Doesn't matter if the indicator value is above or below the zero line. Just looking for the bars to paint green or red when the indicator value goes up or down. Here is the indicator-

Code:
declare lower;
#plot Data = close;
input   FastCycleLength = 5;
input   SlowCycleLength = 8;
#def   CycleLineColor=DefineGlobalColor(Color.RED);
#input   CycleHistColor=Color.BLUE;
#input   ZeroLineColor1 = GetColor(1);
DefineGlobalColor("CycleLineColor", Color.RED);
DefineGlobalColor("CyclehistColor", Color.BLUE);
DefineGlobalColor("ZeroLineColor", Color.YELLOW);
def H = high;
def L = low;
#def FastVar(0),SlowVar(0),DiffVar(0);

def FastVar = ExpAverage((H + L) / 2, FastCycleLength);
def SlowVar = Average((H + L) / 2, SlowCycleLength);
def DiffVar = FastVar - SlowVar;

plot pDiffVar = DiffVar;
pDiffVar.SetDefaultColor(GlobalColor("CycleLineColor"));
plot pDiffVar2 = DiffVar;
pDiffVar2.SetDefaultColor(GlobalColor("CycleHistColor"));
plot pZeroLine = 0;
pZeroLine.SetDefaultColor(GlobalColor("ZeroLineColor"));
#Plot1(DiffVar,"Cycle",CycleLineColor);
#Plot2(DiffVar,"CycleHist",CycleHistColor);
#Plot3(0    ,"Zero",ZeroLineColor);
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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