Premier Stochastic Oscillator

def Length1 = iff(Period < 0, 1, squareroot(Period));
def SmoothStoch1 = xaverage(xaverage(NormStoch, Length), Length);
def Premier1 = ( Exp( 1 * SmoothStoch ) - 1 ) / ( Exp( 1 * SmoothStoch ) + 1 );
 
I give up. You are not following any of the logic. Try this;

input agg1 = aggregationPeriod.DAY;
def oFastK1= 100 *( ( close(period = Agg1) - Lowest( low(period = Agg1), StochLength ) ) / ( Highest( high(period = Agg1), StochLength ) - Lowest( low(period = Agg1), StochLength ) ) );
def oFastD1 = Average( oFastK1, 1 );
def oSlowK1 = oFastD1;
def oSlowD1 = Average( oSlowK1, 3 );
def NormStoch1 = 0.1 * ( oSlowK1 - 50 );

def SmoothStoch1 = ExpAverage( ExpAverage( NormStoch1, Length ), Length );

plot Premier1 = ( Exp( 1 * SmoothStoch1 ) - 1 ) / ( Exp( 1 * SmoothStoch1 ) + 1 );

Premier1.SetLineWeight(3);
Premier1.DefineColor("Positive and Up", Color.GREEN);
Premier1.DefineColor("Positive and Down", Color.DARK_GREEN);
Premier1.DefineColor("Negative and Down", Color.RED);
Premier1.DefineColor("Negative and Up", Color.DARK_RED);
Premier1.AssignValueColor(if Premier1 >= 0 then if Premier1 >Premier1[1] then Premier1.color("Positive and Up") else Premier1.color("Positive and Down") else if Premier1 < Premier1[1] then Premier1.color("Negative and Down") else Premier1.color("Negative and Up"));
 
@Trading51 Sorry, just had no more time then to keep at it. Do you have an idea now how it works? Did you get the study to work?

Thanks for taking the time to help, Not sure if its working properly it has two lines on the chart, smaller time frame and the larger, i think its suppose to have just the larger

Any thoughts on how to remove the smaller time frame and leave the larger? and how would i put a border on the outline of the histogram?
 
@Trading51 If you added the agg code to the original study it will draw a plot for the chart time frame and also a plot of the agg time frame.
Now you can see both and know what the higher time frame is doing in relation to the chart time frame,

Do a line chart. Then you can see the diffrence.

If you want the histogram change the colors of one.
 
Sorry spent way too much time on this. You will need to figure it out. I gave you the MTF solution. Maybe someone else will help.
 
Hello may i get some help to make this mtf

Code:
# // ==========================
# // PREMIER STOCHASTIC
# // Indicator
# // ==========================
#
# Technical Analysis of Stocks & Commodities
# August, 2008
# Premier Stochastic Oscillator by Lee Leibfarth
# pp 30 - 36
# ported by R Houser
#  Changed to histogram display by Horserider 10/11/219

declare lower;  

# inputs:
input Line1 = 0.9;
input Line2 = 0.2;
input StochLength = 8;
input Period = 25;


# variables:
# oFastK(0),
# oFastD(0),
# oSlowK(0),
# oSlowD(0),
# Length(0),
# NormStoch(0),
# SmoothStoch(0),
# Premier(0);


# Value1 = Stochastic( h, l, c, StochLength, 1, 3, 1, oFastK, oFastD, oSlowK, oSlowD);
def oFastK = 100 * ( ( close - Lowest( low, StochLength ) ) / ( Highest( high, StochLength ) - Lowest( low, StochLength ) ) );
def oFastD = Average( oFastK, 1 );
def oSlowK = oFastD;
def oSlowD = Average( oSlowK, 3 );


# Length = iff(Period < 0, 1, squareroot(Period));
def Length = if Period < 0 then 1 else Sqrt( Period );


# NormStoch = .1 * (oslowK - 50);
def NormStoch = 0.1 * ( oSlowK - 50 );


# SmoothStoch = xaverage(xaverage(NormStoch, Length), Length);
def SmoothStoch = ExpAverage( ExpAverage( NormStoch, Length ), Length );


plot Premier = ( Exp( 1 * SmoothStoch ) - 1 ) / ( Exp( 1 * SmoothStoch ) + 1 );
     

plot pLine1 = Line1;
        pLine1.SetDefaultColor( Color.BLACK );
plot pLine2 = Line2;
        pLine2.SetDefaultColor( Color.GRAY );
plot nLine1 = -1 * Line1;
        nLine1.SetDefaultColor( Color.BLACK );
plot nLine2 = -1 * Line2;
        nLine2.SetDefaultColor( Color.GRAY );

#Premier.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Premier.SetLineWeight(3);
Premier.DefineColor("Positive and Up", Color.GREEN);
Premier.DefineColor("Positive and Down", Color.DARK_GREEN);
Premier.DefineColor("Negative and Down", Color.RED);
Premier.DefineColor("Negative and Up", Color.DARK_RED);
Premier.AssignValueColor(if Premier >= .8 then if Premier >Premier[1] then Premier.color("Positive and Up") else Premier.color("Positive and Down") else if Premier < Premier[1] then Premier.color("Negative and Down") else Premier.color("Negative and Up"));
 
@Piper2808t Add the following snippet right below declare lower;

Code:
input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def close = close(period = aggregationPeriod);

By default, the higher timeframe is the Daily chart. You can adjust this in the indicator's settings.
 

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
338 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