Ichimoku Oscillator For ThinkOrSwim

apdusp

Active member
VIP
The author states:
Fans of the Ichimoku cloud indicator may enjoy this lower study version.

It's all the exact same representation but the cloud is converted to an oscillation in histogram or classic cloud fill formats.

All of the original lines, except Kumo cloud lines, are provided but adjusted to be positionally accurate to the oscillation values.

The oscillation value is calculated simply by absolute subtraction of span a and b lines and as such become an additional width detection mechanism in what I consider to be a slightly cleaner display.

S8FOSom.png

Please convert this TV indicator:
https://www.tradingview.com/script/B7TQ1acc-Ichimoku-Oscillator/
Of course, you can add your own insight on how to better use its signals
Thanks in advance
 
Last edited by a moderator:
Please convert this TV indicator:

https://www.tradingview.com/script/B7TQ1acc-Ichimoku-Oscillator/

Of course, you can add your own insight on how to better use its signals

Thanks in advance
check this also

https://usethinkscript.com/threads/...-chartprime-for-thinkorswim.16919/post-132711


and find the conversion below as requested:

CSS:
#// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © syntaxgeek
#indicator("Ichimoku Oscillator")
# Converted by Sam4Cok@Samer800    - 01/2024
declare lower;

input ConversionLineLength = 9;#, minval=1, title="Conversion Line Length")
input BaseLineLength = 26;#, minval=1, title="Base Line Length")
input LeadingSpanBLength = 52;#, minval=1, title="Leading Span B Length")
input LaggingSpan = 26;#, minval=1, title="Lagging Span")
input CloudFormat = { default "Histogram", "Filled (Classic)"}; # 'Cloud Format'


def na = Double.NaN;

def v_showHistoPlot = CloudFormat == CloudFormat."Histogram";
def v_showFillPlots = CloudFormat == CloudFormat."Filled (Classic)";

DefineGlobalColor("leadUp", Color.DARK_GREEN);#CreateColor(67, 160, 71));
DefineGlobalColor("leadDn", Color.DARK_RED);#CreateColor(244, 67, 54));
DefineGlobalColor("lag", Color.GREEN);
DefineGlobalColor("base", Color.RED);
DefineGlobalColor("conv", CreateColor(41,98,255));
DefineGlobalColor("price", Color.WHITE);

#// { funcs
script f_donchian {
    input len = 9;
    def hh = Highest(high, len);
    def ll = Lowest(low, len);
    def don = (hh + ll) / 2;
    plot out = don;
}

#// original ichimoku calculations
def v_conversionLine = f_donchian(ConversionLineLength);
def v_baseLine = f_donchian(BaseLineLength);
def v_leadLine1 = (v_conversionLine + v_baseLine) / 2;
def v_leadLine2 = f_donchian(LeadingSpanBLength);

#// calculate absolute difference between span a and b
def v_leadDiff = AbsValue(v_leadLine1 - v_leadLine2);

#// determine whether difference should be negative or positive depending on span a and b orientation
def v_leadDiffComparison = (if v_leadLine1[LaggingSpan - 1] > v_leadLine2[LaggingSpan - 1]
                           then v_leadDiff[LaggingSpan - 1] else -v_leadDiff[LaggingSpan - 1]);
#// adjust price line to scale with span difference
def v_close = close - v_leadLine1[LaggingSpan - 1] + v_leadDiffComparison;

#// adjust displaced price lagging line to scale with twice displaced span a and adjust for span twice displaced difference
def v_laggingSpan = close - v_leadLine1[(LaggingSpan * 2) - 1] + v_leadDiffComparison[LaggingSpan - 1];

#// adjust displaced base line to scale with displaced span a and adjust for span difference
def v_baseLineAdjusted = v_baseLine - v_leadLine1[LaggingSpan - 1] + v_leadDiffComparison;

#// adjust displaced conversion line to scale with displaced span a and adjust for span difference
def v_conversionLineAdjusted = v_conversionLine - v_leadLine1[LaggingSpan - 1] + v_leadDiffComparison;
#// } vars

#// { plots
def spanWidth = if v_leadLine1 > v_leadLine2 then v_leadDiff else -v_leadDiff;
def spanA = if !v_showFillPlots then na else if v_leadLine1 > v_leadLine2 then v_leadDiff else 0;
def spanB = if !v_showFillPlots then na else if v_leadLine1 < v_leadLine2 then -v_leadDiff else 0;

plot Lagging = v_laggingSpan[-(LaggingSpan) + 1];    # "Lagging Span"
plot BaseLine = v_baseLineAdjusted;                         # "Base Line"
plot ConvLine = v_conversionLineAdjusted;                   # "Conversion Line"
plot price = v_close;                                       # "Price"

Lagging.SetDefaultColor(GlobalColor("lag"));
BaseLine.SetDefaultColor(GlobalColor("base"));
ConvLine.SetDefaultColor(GlobalColor("conv"));
price.SetDefaultColor(GlobalColor("price"));

plot spanHist = if !v_showHistoPlot then na else spanWidth[LaggingSpan - 1];    # 'Leading Span Width'

spanHist.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
spanHist.AssignValueColor(if v_leadLine1[LaggingSpan - 1] > v_leadLine2[LaggingSpan - 1]
                        then GlobalColor("leadUp") else GlobalColor("leadDn"));


AddCloud(if !v_showFillPlots then na else spanWidth[LaggingSpan - 1], 0, GlobalColor("leadUp"), GlobalColor("leadDn"), yes);


#-- END of CODE
 
check this also

https://usethinkscript.com/threads/...-chartprime-for-thinkorswim.16919/post-132711


and find the conversion below as requested:

CSS:
#// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © syntaxgeek
#indicator("Ichimoku Oscillator")
# Converted by Sam4Cok@Samer800    - 01/2024
declare lower;

input ConversionLineLength = 9;#, minval=1, title="Conversion Line Length")
input BaseLineLength = 26;#, minval=1, title="Base Line Length")
input LeadingSpanBLength = 52;#, minval=1, title="Leading Span B Length")
input LaggingSpan = 26;#, minval=1, title="Lagging Span")
input CloudFormat = { default "Histogram", "Filled (Classic)"}; # 'Cloud Format'


def na = Double.NaN;

def v_showHistoPlot = CloudFormat == CloudFormat."Histogram";
def v_showFillPlots = CloudFormat == CloudFormat."Filled (Classic)";

DefineGlobalColor("leadUp", Color.DARK_GREEN);#CreateColor(67, 160, 71));
DefineGlobalColor("leadDn", Color.DARK_RED);#CreateColor(244, 67, 54));
DefineGlobalColor("lag", Color.GREEN);
DefineGlobalColor("base", Color.RED);
DefineGlobalColor("conv", CreateColor(41,98,255));
DefineGlobalColor("price", Color.WHITE);

#// { funcs
script f_donchian {
    input len = 9;
    def hh = Highest(high, len);
    def ll = Lowest(low, len);
    def don = (hh + ll) / 2;
    plot out = don;
}

#// original ichimoku calculations
def v_conversionLine = f_donchian(ConversionLineLength);
def v_baseLine = f_donchian(BaseLineLength);
def v_leadLine1 = (v_conversionLine + v_baseLine) / 2;
def v_leadLine2 = f_donchian(LeadingSpanBLength);

#// calculate absolute difference between span a and b
def v_leadDiff = AbsValue(v_leadLine1 - v_leadLine2);

#// determine whether difference should be negative or positive depending on span a and b orientation
def v_leadDiffComparison = (if v_leadLine1[LaggingSpan - 1] > v_leadLine2[LaggingSpan - 1]
                           then v_leadDiff[LaggingSpan - 1] else -v_leadDiff[LaggingSpan - 1]);
#// adjust price line to scale with span difference
def v_close = close - v_leadLine1[LaggingSpan - 1] + v_leadDiffComparison;

#// adjust displaced price lagging line to scale with twice displaced span a and adjust for span twice displaced difference
def v_laggingSpan = close - v_leadLine1[(LaggingSpan * 2) - 1] + v_leadDiffComparison[LaggingSpan - 1];

#// adjust displaced base line to scale with displaced span a and adjust for span difference
def v_baseLineAdjusted = v_baseLine - v_leadLine1[LaggingSpan - 1] + v_leadDiffComparison;

#// adjust displaced conversion line to scale with displaced span a and adjust for span difference
def v_conversionLineAdjusted = v_conversionLine - v_leadLine1[LaggingSpan - 1] + v_leadDiffComparison;
#// } vars

#// { plots
def spanWidth = if v_leadLine1 > v_leadLine2 then v_leadDiff else -v_leadDiff;
def spanA = if !v_showFillPlots then na else if v_leadLine1 > v_leadLine2 then v_leadDiff else 0;
def spanB = if !v_showFillPlots then na else if v_leadLine1 < v_leadLine2 then -v_leadDiff else 0;

plot Lagging = v_laggingSpan[-(LaggingSpan) + 1];    # "Lagging Span"
plot BaseLine = v_baseLineAdjusted;                         # "Base Line"
plot ConvLine = v_conversionLineAdjusted;                   # "Conversion Line"
plot price = v_close;                                       # "Price"

Lagging.SetDefaultColor(GlobalColor("lag"));
BaseLine.SetDefaultColor(GlobalColor("base"));
ConvLine.SetDefaultColor(GlobalColor("conv"));
price.SetDefaultColor(GlobalColor("price"));

plot spanHist = if !v_showHistoPlot then na else spanWidth[LaggingSpan - 1];    # 'Leading Span Width'

spanHist.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
spanHist.AssignValueColor(if v_leadLine1[LaggingSpan - 1] > v_leadLine2[LaggingSpan - 1]
                        then GlobalColor("leadUp") else GlobalColor("leadDn"));


AddCloud(if !v_showFillPlots then na else spanWidth[LaggingSpan - 1], 0, GlobalColor("leadUp"), GlobalColor("leadDn"), yes);


#-- END of CODE
@samer800 , once more, thank you, thank you !! Though I have to respect his wishes, I think the original author called it wrongly as an Oscillator just because like he used an histogram. To me it is just plotting price+ichimoku relations in a simplified way in the lower section of the chart with some whistles
 

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