RicardoSantos

[RS]JR Moving Average System V1.a

added Ichimoku Cloud as a filter
Remove from Favorite Scripts Add to Favorite Scripts
study(title="[RS]JR Moving Average System V1.a", shorttitle="[RS]JR.MAS.V1a", overlay=true)
hide_sl_lines = input(true)
ma0 = sma(hl2, input(1))


tp = input(8)
ma1 = wma(open, tp)
ma2 = ema(open, tp)

//---   2nd pass
tf = input(2)
ma3 = wma(open, tf)
ma4 = ema(open, tf)
//---   2nd pass plot output not required.

plot(ma0, color=black)
plot(ma1, color=gray)
plot(ma2, color=silver)

condition = ma0 >= ma1 and ma1 >= ma2 ? (close >= open ? lime : green) :
        ma0 <= ma1 and ma1 <= ma2 ? (close >= open ? red : maroon) :
        ma0 >= ma3 and ma3 >= ma4 ? (close >= open ? lime : green) :
        ma0 <= ma3 and ma3 <= ma4 ? (close >= open ? red : maroon) : (close >= open ? silver : gray)

barcolor(condition)

//  ||---   3rd pass Ichimoku cloud, blatantly copyed from Hpotter :p
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 23/05/2014
//  Ichimoku
////////////////////////////////////////////////////////////
hidecloud = input(true)
cloudfilter = input(true)

middleDonchian(Length) =>
    lower = lowest(Length)
    upper = highest(Length)
    avg(upper, lower)

conversionPeriods = tp
basePeriods = tf
laggingSpan2Periods = tp
displacement = tf

Tenkan = middleDonchian(conversionPeriods)
Kijun =  middleDonchian(basePeriods)
xChikou = close
SenkouA = middleDonchian(laggingSpan2Periods)
SenkouB = (Tenkan[basePeriods] + Kijun[basePeriods]) / 2
//plot(Tenkan, color=red, title="Tenkan")
//plot(Kijun, color=blue, title="Kijun")
//plot(xChikou, color= teal , title="Chikou", offset = -displacement)
A = plot(hidecloud ? na : SenkouA[displacement], color=purple, title="SenkouA")
B = plot(hidecloud ? na : SenkouB, color=green, title="SenkouB")
fill(A, B, color=green)

abovecloud = cloudfilter ? ( close >= max(SenkouA[displacement], SenkouB) ? true : false ) : true
undercloud = cloudfilter ? ( close <= min(SenkouA[displacement], SenkouB) ? true : false ) : true
//----------------------------------------------------------------------------------------------------------

//  ||---   Crossovers
buyx1 = cross(ma0,ma1) and ma0 >= ma0[1] and abovecloud ? true : false
sellx1 = cross(ma0,ma1) and ma0 <= ma0[1]  and undercloud ? true : false
plotshape(buyx1, style=shape.arrowup, color=green, location=location.belowbar)
plotshape(sellx1, style=shape.arrowdown, color=maroon, location=location.abovebar)

//  ||---   SL lines
sltop = highest(max(max(high,ma0),max(ma1,ma2)), tp)
slbot = lowest(min(min(low,ma0),min(ma1,ma2)), tp)

tcol = sltop != sltop[1] ? na : silver
bcol = slbot != slbot[1] ? na : silver
plot(hide_sl_lines ? na : sltop, color=tcol, style=line)
plot(hide_sl_lines ? na : slbot, color=bcol, style=line)


Improving ichimoku is a pretty challenging task...The tenkan/kijun crosses themselves are very reliable.
I'll give this one a try.
+1 Reply
im really not versed on ichimoku :p , just trying to filter out some signals, anyway this is just a tentative version to see how it behaves.
+1 Reply
IvanLabrie PRO RicardoSantos
Oh, well I think it's the ultimate trend following indicator...haven't seen a single indicator do so well...only thing better is raw bar chart reading skill. :)
+1 Reply
If it's the ultimate trend following indicator, then Ichimoku would make a great signal indicator for auto trading.
Reply
snapshot


Nobody likes anyone to mess with there cloud. However, we are going to better this old Japanese technical indicator
+1 Reply
IvanLabrie PRO QuantitativeExhaustion
The cloud support is just spot on. I'm grabbing my pop corn :p
Reply
If you've got some suggestions, will take them.
Reply
IvanLabrie PRO QuantitativeExhaustion
I've had a hard time figuring out an indicator combo for this purpose...best I've found is time at mode, and ichimoku gives similar clues about support and resistance, so that's very good.
I use a combination of things to take my trades, and I haven't found a single indicator that can replace that.
+1 Reply
snapshot


Good for longer trends , bad for chops. However, it's never going to get you in that much trouble in the choppy areas.
+1 Reply
IvanLabrie PRO QuantitativeExhaustion
Pretty good, definitely. Chop isn't too cloud friendly. But then again, what is?
+1 Reply
snapshot


So this I consider a longer length Ichimoku, and it's probably 10 times faster then the default setting.
+1 Reply
IvanLabrie PRO QuantitativeExhaustion
The defaults were calculated by a lot of japanese students forced to do some serious math for ages...or so says the legend.
I've never seen the cloud support fail during a trend.
4h and daily cloud is very reliable for FX for instance.

snapshot
+1 Reply
Seems like the triggers are too late.
Reply
IvanLabrie PRO QuantitativeExhaustion
The trigger is in your mind...The cloud is mostly a dynamic s/r thing to me.
Have you read Manesh Patel's book on ichimoku?
+1 Reply
No I have not. i'm trying to use both for support/resistance and trigger in/out
+1 Reply
IvanLabrie PRO QuantitativeExhaustion
I don't think any indicator trigger will be faster than your own price action analysis, combined with fundamentals, but I could be wrong.
+1 Reply
End goal here is to build a Pine Script that is ready for auto trade. TradingView will be implementing this feature soon, where we will be able to use our scripts to trade.
+1 Reply
IvanLabrie PRO QuantitativeExhaustion
I see, I think some strategies would work very well with auto trading. Should be interesting to see what you guys come up with.
+1 Reply
QuantitativeExhaustion PRO QuantitativeExhaustion
NOTE: maybe need to rethink color fill of candles and outline. Price close above cloud = light green fill and Price close below = dark red candle fill
Reply
QuantitativeExhaustion PRO QuantitativeExhaustion
OK rules to consider Ichimuko 2, 8, 2, 1

Green

if upper lead is red and candle closes above bottom green lead = dark green candle with dark green arrow
or
if upper lead is red and candle closes above bottom green lead with conversion line and lagging span below cloud = gray candle green border

if upper lead is red and candle closes above top red lead = light green candle with light green arrow

if upper lead turns green from red lead and candles (close) remains above red lead with conversion line and lagging span above cloud = light green candle (all the way)
or
if upper lead turns green from red lead and candles (close) remains above red lead with one or the other conversion line - lagging span above cloud = dark green candle

Red

if candle closes below cloud when green is upper lead = light red arrow signal light red candle

if upper lead is green and candle closes above bottom red lead = light red candle with light red arrow
or
if upper lead is green and candle closes above bottom red lead with conversion line and lagging span above cloud = gray candle red border

if upper lead is green and candle closes above top green lead = dark red candle with dark red arrow

if upper lead turns red from green lead and candles (close) remains below green lead with conversion line and lagging span above cloud = dark red candle (all the way)
or
if upper lead turns red from green lead and candles (close) remains above green lead with one or the other conversion line - lagging span above cloud = light red candle


Did we miss any?
Reply
QuantitativeExhaustion PRO QuantitativeExhaustion
might need to add a few more rules
still have a gray red border candle and gray green border candle

also not so sure about length of conversion-base-lagging span periods and displacement/ could be tweaked.
Reply
jangseohee QuantitativeExhaustion
as long as the signal of the cloud is being made more accurate, it think it is ok :-)
+1 Reply
you bunch of marvelous guy over here
lets see the median line can provide support :-)
snapshot
+1 Reply
IvanLabrie PRO jangseohee
VWAP and medians are something many traders watch...I'd expect it to hold or at least slow any decline.
Ichimoku uses the median of each candle's range for the averages' calculation, probably related to its outstanding reliability as s/r.
+1 Reply
VWAP is another one to look at.
Reply
snapshot


Here is another idea with a much faster Ichimoku signal caller
+1 Reply
QuantitativeExhaustion PRO QuantitativeExhaustion
snapshot


Rare that we see a 60% move in such a short period. So it's a good ideas to add a fast trigger with weaker buy/sell signals. Perhaps to start without leverage until stronger signals from 8,2,2,2 Ichimoku than add leverage when both agree
+1 Reply
IvanLabrie PRO QuantitativeExhaustion
snapshot
+2 Reply
IvanLabrie PRO IvanLabrie
1-26-52
+1 Reply
IvanLabrie PRO IvanLabrie
snapshot
+2 Reply
IvanLabrie PRO IvanLabrie
snapshot


Thing scalps like nobody's business.
+2 Reply
at 23:30/11 price bottom we should have gotten a covered call signal. That way we would make up for the profits given up when trend changes and goes up quickly.
Reply
IvanLabrie PRO QuantitativeExhaustion
Have it trail stops after reaching OB/OS or seeing divergence.
+1 Reply
yes trailing stops would work also covered calls/covered puts
Reply
IvanLabrie PRO QuantitativeExhaustion
I know nothing about options...I leave that up to you.
+1 Reply
well you could implement both systems. Run a prop fund on these specs and you could turn $1,000 into a million in no time.
+1 Reply
IvanLabrie PRO QuantitativeExhaustion
I'm all for that...got my own account for now. Should compound over time, right? ;)
+1 Reply
Still don't have all the tools with Pine Script.

You should suggest a trail stop over the 3 bar high to Ricardo. He might be able to get creative and implement this.
Reply
IvanLabrie PRO QuantitativeExhaustion
snapshot


This seems to work.
Trail after you leave the bands...11-22-44-100 for the vector bands.
+1 Reply
I have to play with that vector band MAS combo.. seems to good to be true
Reply
IvanLabrie PRO QuantitativeExhaustion
I'm sure you can fine tune the band/trailing thing. I like the almost default ichimoku filter, it's pretty powerful as is.
+1 Reply
Sell / buy signals are not triggering fast enough. That's my only complaint.
Reply
IvanLabrie PRO QuantitativeExhaustion
It's still profitable...those are almost ichimoku defaults.
If you want better than this, maybe adding a filter that finds cci or macd divergence in a bottom after a prolonged decline and high OS readings. Multi timeframe momentum works well when paired with this type of moving average system.
+1 Reply
Yes that's what I was mentioning ... at 23:30/11 price bottom we should have gotten a covered call signal. That way we would make up for the profits given up when trend changes and goes up quickly.

Divergence from CCI/MACD or RSI would have signaled a covered call on the leverage short position.
+1 Reply
IvanLabrie PRO QuantitativeExhaustion
Not to cover, but to trail stops over the 3 bar high.
Reply
jangseohee QuantitativeExhaustion
@JR, can this new cloud indicator, combine with Ricardo's divergence V2?
Reply
yes that is the next step, but we are waiting for Pine Script loops.
+1 Reply
btw Ivan, JR is one of my mentor
He likes to catch the exact TOP/Bottom to pinpoint accuracy :-)
+2 Reply
IvanLabrie PRO jangseohee
You're all crazy, but I like you guys.
+1 Reply
IvanLabrie PRO IvanLabrie
snapshot


11-22-44-100 for the vector band thing.
Trail stops after price leaves the boundaries of the channel.
+1 Reply
1-26-52, then add the open price levels v1, weekly.
If price above weekly open buy and trail stops after crossing under a weekly open.
Reverse if short.
snapshot
+1 Reply
snapshot


You are right. I was going down wrong path
Reply
IvanLabrie PRO QuantitativeExhaustion
No need to fight the cloud...it's a real badass. ;)
I really like this system btw, this and the Moody Gann one are very good.
If you can add trailing after crossing the weekly open it'd be a killer intraday trader in a 4h chart, for Forex at least.
+1 Reply
snapshot
Well this was first going to used specifically for leveraged ETFs for AutoTrading. Now I can see where I can turn x1 (light red) or (dark green) into gray candles = no trade. When candles are weak (light red) or (dark green) not touching vector wall = gray candle = no trade
Reply
snapshot


This will minimize trade commission and losses
+1 Reply
IvanLabrie PRO QuantitativeExhaustion
Looks good, so take short term trades will riding against the walls.
+1 Reply
candles riding against wall and strong candle signals.. (dark red and light green) not along wall.
Reply
IvanLabrie PRO QuantitativeExhaustion
https://www.youtube.com/watch?v=cIcqUokPiTw
+1 Reply
snapshot


So basically anything that is free floating that is not a strong candle indicator is a no trade
+1 Reply
jangseohee QuantitativeExhaustion
But JR, that is abit of hindsight, how can we be at least 70% sure that the candles ahead will have at least 3 or > big bars?
+1 Reply
IvanLabrie PRO jangseohee
Indeed, or how do you enter, because the last candle will repaint until the bar close.
That's always my issue with these type of systems...If you can fine tune that, then it'll be great.
Reply
Don't get all Barry Manilow cheezy on me
Reply
IvanLabrie PRO QuantitativeExhaustion
hahaha!
Seemed appropriate...looks very good JR. Now to the backtestmobile.
+1 Reply
snapshot


Inside / outside cloud is giving better scalping set ups as well as trades.
+1 Reply
RicardoSantos PRO QuantitativeExhaustion
guys if you dont mind (for simplicity's sake) mind doing a layered choice rule table? ex:.
layer 1 : price above ichimoku cloud ? bullish market, filter all sells while true.
layer 1 : price under ichimoku cloud ? bearish market, filter all buys while true.
layer 2: ....
layer 3: .... etc
were layer 1 has the highest priority, thx
+2 Reply
sounds like a plan
+1 Reply
Still also need to fine tune individual indicators before we start making a rules bases system using combinations of indicators/overslays.
+1 Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Brasil
Россия
Türkiye
日本
한국
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