Ichimoku-Hausky Trading system

This is a indicator with some parts of the ichimoku and EMA. It's my first script so i have used other peoples script (Chris Moody and DavidR) as reference cause I really have no idea myself on how to script with pinescript.
Hope that is okay!

I use 20M timeframe but it should work with any timeframe! I have not tested this system much so I would really appreciate feedback and tips for better entries, settings etc..

Tenken-sen: green line
Kijun-sen: blue line
EMA: Purple


IF price crosses or bounce above Kijun-sen
THEN see if market has closed above EMA
IF Market has closed above EMA
THEN see if EMA is above Kijun-sen
IF EMA is above Kijun-sen
THEN buy and set trailing stop 5 pips below EMA

IF price crosses or bounce below Kijun-sen
THEN see if market has closed below EMA
IF Market has closed below EMA
THEN see if EMA is below Kijun-sen
IF EMA is below Kijun-sen
THEN sell and set trailing stop 5 pips above EMA

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//Created By User Hausky

study(title="Hausky100", shorttitle="Hausky100", overlay=true)
turningPeriods = input(50, minval=1, title="Tenkan-Sen")
standardPeriods = input(100, minval=1, title="Kinjun-Sen")
sts = input(true, title="Show Tenkan-Sen (50 Period)?")
sks = input(true, title="Show Kinjun-Sen (100 Period)?")

//Definitions for Tenkan-Sen (50 Period), Kinjun-Sen (100 Period)
donchian(len) => avg(lowest(len), highest(len))
turning = donchian(turningPeriods)
standard = donchian(standardPeriods)

//Plot Kijun-sen and Tenkan-sen
plot(sts and turning ? turning : na, title = 'Tenkan-Sen (50 Period)', linewidth=2, color=green)
plot(sks and standard ? standard : na, title = 'Kinjun-Sen (100 Period)', linewidth=2, color=blue)

//Definitions for EMA
src = close
EMA  = input(45, minval=1, title="EMA")
fPivot = ((high + low + close)/3)
fEMA    = ema(fPivot, EMA)

//Plot EMA
plot(fEMA, color=fuchsia, title="EMA", linewidth=2)