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
Remove from Favorite Scripts Add to Favorite Scripts
//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)
United States
United Kingdom
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out