TradingView
ragnarok628
28. Sept. 2020 20:24

Ichimoku Cloud LONG and SHORT indicators 

Entegris, Inc.NASDAQ

Beschreibung

This simple script uses 4 rules from Ichimoku Cloud indicator to marks position entry points.

The idea is that by entering a long position just when these 4 criteria are met, you can capture a 2-3% plus move within the next few days:
1. The conversion line is above the base line
2. The price is above the clouds
3. The lagging span is above the clouds
4. The rightmost cloud is green

The same 4 criteria but inverted will indicate a short entry.

In order to avoid 'stale' entries which can lead to chasing, we want the price and conversion line crossovers to be recent, within the past few days. Ideally we want to enter before close on the day the entry signal is given so that we can capture any potential gap up (or down if short). Often the price will make a nice move the next day or day after. If any of the criteria become invalidated, or if after 4-5 days there hasn't been significant movement, then it was a false alarm.

This script will show the basic Ichimoku Cloud indicators, plus labels for bearish and bullish price and conversion line crossovers as well as LONG and SHOT indicators to show when the entry criteria have been met.

Versionshinweise

This update makes the indicators respect any changes in the displacement value in the Inputs.

Versionshinweise

Pretty significant update:

added visual indicators to facilitate an exit strategy described below
removed price/cloud crossover labels as they are not very useful and this chart has more than enough clutter as is

the exit strategy is also documented in the code, but here it is:

1: set STOP LOSS at 1 std. dev. below close (RED DASHED LINE)
2: activate TRAILING STOP when price hits 1/2 std. dev. above close (BLUE DASHED LINE)
3: use 1/4 std. dev. as the TRAILING STOP value (GREEN DASHED LINE shows minimum expected profit in cases where blue line is reached)
4: after 5 more bars, exit trade if price is still between red and blue lines (no visual indicator for this at this time)

Versionshinweise

The main point of this update is to fix an edge case caused by the crossover function counting touches as crossovers.

I've also removed the SHORT callouts until such time as I have enough data to indicate this is a viable strategy.

Additionally I've updated the default plotting styles to reflect my preferences.

Versionshinweise

Some incremental improvements:
*updated initial defaults to reflect current strategy
*added ability to limit signals to long only
*added ability to display the standard deviation over the selected number of periods as a percentage of current price

Versionshinweise

now considering touches as crosses for determining entry eligibility for the cloud and the conversion/base pair

Versionshinweise

using ATR instead of stdDev, tweaking initial paramaters, tweaking colors for better visibiliity
Kommentare
Dream2025
Hi, thanks for this great script , wondering where you are checking this point " 3. The lagging span is above the clouds" . How i can convert this into strategy ? I would like to conversion line crossover baseline and lagging span is higher than current close price, conversion line,base line and the cloud . Could you pls help me writing on this .
ragnarok628
@Dream2025, sorry, this site keeps eating my replies... not sure whats up, trying one more time:

last phrase of line 66 is the lagging span over cloud check; lagging span price is same as close price but timeshifted back 26 periods, and the leadingLines that define the cloud are timeshifted ahead 26 periods. So comparing current close to cloud from 52 periods ago is comparing the lagging span to the cloud at the tip of the lagging span.

To make a strategy, just modify longCondition and shortCondition to whatever you want your entry criteria to be, then drop something like this at the bottom:

if (longCondition)
strategy.entry("long", strategy.long)
if (shortCondition)
strategy.entry("short", strategy.short)

this will keep you long until it signals short, and vice versa so unless that's what you want, you'll also need to set strategy.exit() for "long" and "short".

hope that helps!
Dream2025
@ragnarok628, Thanks for the quick reply , i will try to setup the strategy condtion
MichSXM
@Dream2025, Lagginspan is always the same as current price, just offset by -26 periods, to indicate whether or not there is a trent up or down. Hence your strategy has 1 condition that can never be met. (the latter)
NicTheMajestic
Thank You !
MarMix
Nice one Thank you !!
MachineMatrix
Great script thank you @ragnarok628 much appreciated. I may have a play with code as struggling to read labels :)
MachineMatrix
@ragnarok628 I have seen some really good past back test results with this.
I was just wondering is it possible to have the long and short alert when all criteria is met as that is the most important
ragnarok628
@IamDobby, If I understand what you're asking, you want the long/short to trigger just on having the 4 conditions met currently, disregarding how recently that came to be? That's easily doable but it would turn this into more of a "go/no go" indicator than something that identifies good entries. Currently it's picky about labeling long and short entries in that it wants the conversion crossover and cloudbreak to have happened recently (while also respecting the other two conditions but not being concerned with recency for those); this avoids having it signal in situations such as in the midst of a long bullish run, where the price action has been over the cloud and the cloud has been green for a long time, but you get a brief conversion/base crossunder and then crossover. I think that should arguably be more of an exit signal as the run might be out of gas soon, and in either case that wouldn't fit the strategy i'm going for. The strategy I'm using this for is about catching the pop that I expect to happen when the price breaking cloud and conversion/baseline crossover happen close together in time.

all that said though, if ppl would find it useful to have a version of this indicator that just throws up 'bullish', 'bearish', or 'neutral' on the chart, it's simple enough that i wouldn't mind cranking that out real quick.
Mehr