CCI 0Trend Strategy (by Marcoweb) v1.0Hi guys,
I am trying to create a strategy that consists in the crossover/under of the 0 line of the Commodity Channel Index . Every time the price crosses over the 0 line in the CCI the strategy has to long getting short on the cross under and viceversa.
I have published here another script strategy (consists in a crossover/under of the Overbought/Oversold levels of the CCI) that works so I could have the opportunity to share with you the main idea that as per now is mistaken:
//@version=2
strategy(title="CCI 0Trend Strategy (by Marcoweb) v1.0", shorttitle="CCI_0T_Stra_v1.0", overlay=true)
///////////// CCI
length = input(20, minval=1)
src = input(close, title="Source")
ma = sma(src, length)
cci = (src - ma) / (0.015 * dev(src, length))
plot(cci, color=black)
band1 = hline(100, color=blue, linestyle=solid)
band0 = hline(-100, color=red, linestyle=solid)
bandl = hline(0, color=orange, linestyle=solid)
fill(band1, band0, color=olive)
p1 = plot(band0, color=red,title="-100")
p2 = plot(band1, color=blue,title="100")
p3 = plot(bandl, color=orange,title="0")
///////////// CCI 0Trend Strategy (by Marcoweb) v1.0 Strategy
if (not na(cci))
if (crossover(cci, bandl)
strategy.entry("CCI_L", strategy.long, stop=bandl, oca_type=strategy.oca.cancel, comment="CCI_L")
else
strategy.cancel(id="CCI_L")
if (crossunder(cci, bandl)
strategy.entry("CCI_S", strategy.short, stop=bandl, oca_type=strategy.oca.cancel, comment="CCI_S")
else
strategy.cancel(id="CCI_S")
//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)
With this coding I get the error : line 24 (if (crossover(cci, bandl): mismatched input '|E|' expecting RPAR
Hope you like the idea ;)
Komut dosyalarını "豪24配债" için ara
Forex session - Opening Range- Jayy fixed updatedOpening Range (OR) for Forex 24 hour regular session. This is not for regular market day sessions addressed in a separate script.
This script fixes four issues:
syntax error when code compiles
messed up opening range the day after a holiday Monday
flaky plotting of the opening range and targets that required page reloading
TradingView problems with starting forex session at 1700 hours EST/EDT when using certain securities eg FX_IDC currently (Jan 2017)
Additions in his code are more options for trading range
Time compensation option for some securities that incorrectly start sessions at 1200 hrs instead of 1700 hrs NY time
- this glitch is likely temporary but present when this script update was created
More opening range time period choices
Opening Range Targets:
Opening Range Targets as per Leaf_West
Targets are set at 127% , 162%, 200 %, 262 %, 362%, 423%, 685%, 1109% and 1794% and this can be traded intraday using methods described here charts-by-leaf.com I also have some Leaf West PDFs that describe how the targets are set and how they are traded. There are others that use opening range.
The Time Session Glitch and the Fix:
The script will correctly default to 1700 hrs to 1700hrs EDT/EST session for FXCM.
Strangely some securities appear to erroneously start their session at 1200 hrs ie. My guess is that they are somehow tied to GMT+0 instead of New York time (GMT+5). See this for yourself by selecting EURUSD using the FXCM exchange (FX:EURUSD) and then EURUSD from the IDC exchange (FX_IDC:EURUSD). The FX-IDC session opening range starts 5 hours
before it actually should at 1700 hrs EDT/EST. To correct for this I have implemented an automatic fix (default) and a user selected "5 hour time shift adjust. ment needed on some securities".
There is also a 4 hour time shift button which might be necessary when New York reverts from Eastern Standard Time
to Eastern Daylight Time (1 hour difference) in March (and then back again in November). In the default auto adjust mode you will need to select the 1 hour time shift. That is if this glitch still exists at that time.
I have looked at other scripts, other than my own and where the script is available, that need to use information about the opening bar and all have the same time shift issue
What are the choices for Opening Range?
The dialogue box offers the standard TradingView options.
Also where you see Pick Opening Range 1 to 12 hours , SET TO 0 To USE LINE ABOVE TO DETERMINE OR LENGTH
As the note says a number other than 0 will override the standard options from the line above
The dialogue box below in offers choices by hours 1 to 12. A number greater than 12 will still only give
720 minutes (12 hours) for the length of Opening Range.
What sessions within the FOREX time-frame are available?
The default is 1700 hours to 1700 hours EST/EDT
Check any one (only one) of the time periods to change the opening range period to suit.
New York opens at 8:00 am to 5:00 pm EST (EDT)
Tokyo opens at 7:00 pm to 4:00 am EST (EDT)
Sydney opens at 5:00 pm to 2:00 am EST (EDT)
London opens at 3:00 am to 12:00 noon EST (EDT)
There is a build your own session (click the button to select)
The two lines for inputting session times are almost identical except that the second line starts the be the same as each other.
The default for the build your own session is 2200 hours to 2200 hours. As of the time of publishing this plots EURUSD FX-IDC just right. The GMT+5 and GMT+4 do not apply to this selection.
See my comments above on this strange aberration.
The script originated from work done by Chris Moody. It has changed significantly but there are remnants of that script lurking within.
Script is free to all - that way you can see what is inside
Cheers Jayy
VWAP forex Yesterday Hi/Low update fix This script is an updte fix of an earlier script that stopped functioning when TradingView updated Pine script. This script plots Forex (24 hour session) VWAP, yesterday's high, low, open and close (HLOC),
the day before's HLOC -
Also plots higher timeframe 20 emas
1 minute 5, 15, 60 period 20 ema
5 minute 15, 60 period 20 ema
15 minute 60, 120 , 240 period 20 ema
60 minute 120, 240 period 20 ema
120 minute 240, D period 20 ema
240 minute D period 20 ema
Also signals inside bars (high is less than or equal to the previous bar's high and the low is greater than or equal to the previous low) the : true inside bars have a maroon triangle below the bar as well as a ">" above the bar.
If subsequest bars are inside the last bar before the last true inside bar they also are marked with an ">"
This is probably a slight variation from the way Leaf_West plots the inside bars.
It appears that he marks all bars that are inside the original bar until one a bar has a high or low
outside the original bar. But I would need to see an example on his charts.
The Time Session Glitch and the Fix FX_IDC, COINBASE and BITSTAMP:
The script will correctly default to 1700 hrs to 1700hrs EDT/EST session for FXCM.
Strangely some securities appear to erroneously start their session at 1200 hrs ie. My guess is that they are somehow tied to GMT+0 instead of New York time (GMT+5). See this for yourself by selecting EURUSD using the FXCM exchange (FX:EURUSD) and then EURUSD from the IDC exchange (FX_IDC:EURUSD). The FX-IDC session opening range starts 5 hours before it actually should at 1700 hrs EDT/EST. To correct for this I have implemented an automatic fix (default) and a user selected "5 hour time shift adjust. ment needed on some securities".
There is also a 4 hour time shift button which might be necessary when New York reverts from Eastern Standard Time to Eastern Daylight Time (1 hour difference) in March (and then back again in November). In the default auto adjust mode you will need to select the 1 hour time shift. That is if this glitch still exists at that time.
I have looked at other scripts, other than my own and where the script is available, that need to use information about the opening bar and all have the same time shift issue
COINBASE and BITSTAMP open at 0000 hours GMT. Since I use lines instead of circles or crosses I had to make a small adjustment to plot the lines correctly.
If it needs work let me know.
Jayy
RSD Fractal Dimension Moving AverageHere is a Fractal Dimension Moving Average , that include a trend follow/divergence based on RSI , Stoch ,and ADX. Combineted this algo with the FDMA algo , we have a MA reactive without following the yo-yo during high volatility period. Can set the range from a min and max bars you want to have your MA , the value are powered , so the min can set 1 to 10 that s is 1 to 60 bars and the Max 13 to 24 range 100 to 300. Period length and RSD len-0.37% are use to calculate Fractal Dimen and Trend parameter
If you need more info how to set go here
etfhq.com
Bullish Harami blue, Bullish Engulfinger black, Hammer yellow Copyright by HPotter v1.0 24/03/2014
// This is a bullish reversal pattern formed by two candlesticks in which a small
// real body is contained within the prior session's unusually large real body.
// Usually the second real body is the opposite color of the first real body.
// The Harami pattern is the reverse of the Engulfing pattern.
// Bullish Engulfinger, Hammer by KtL
2 Pip Scalp to nearly double your accountUntested indicator that I wrote and that I will be testing. The idea consists of going for 2 pips a day for the purpose of making a 90% yearly return.
Risks: no stoploss = Possibility of being margin called
Benefits= takes 5 seconds to enter the trade once a day
Indicator shows that if you had bought at daily close, you would have been profitable 88 out of 90 days within 24 hours for the past 3 months. The other 2 days would have been in drawdown but would have eventually profited.
Wish me luck.
PhiMACDHere is a modified moving average which uses phi as the scaling interval between moving average periods. Each MACD line is derived by determining EMAs for 8 period frames, each of which is related to the other proportionally by phi, and calculating each line by comparing it against its immediate predecessor. Actual period values are 9 15 24 39 63 102 165 and 267
Breakdown OscillatorThis is an indicator I made, based on the observation that the longer the price action hugs the bottom bollinger band, the greater the danger of a breakdown occurring (price decline). Essentially its a moving average of the difference between close price and the bottom bollinger band, divided by the bottom bollinger band; I like to use 1.5 standard deviations for the 20 day bollinger band. When it crosses below zero there is increased danger of a breakdown, although of course it could turn right around and go up again. In fact if it does turn around sharply from near zero it can be a good time to buy in the context of a pullback within an uptrend. I also have included the 'slope factor' which makes the indicator more negative based on the rate of downward movement of the bollinger moving average (set to 0 to omit this modification). The indicator can be used just for exits or can be used for entry signals when crossing over the green bar if desired. In the example chart you can see the price hitting the lower band or crossing below the 50dMA plenty of times on the way up while the indicator says to hold tight. When the breakdown comes its after a prolonged period of low volatility (band squeeze) on the lower side of the moving average so the signal comes quickly - they won't all be this good of course. This indicator can also be used to help spot potential shorting candidates.
This indicator also works well on weekly charts; I like the 1 standard deviation with 16 to 24 week long period, 6 to 10 week short period and 30 buy level. Your mileage may vary, please do your own research.
TheLark: Directional Movement Index StochasticThere is a nice writeup about a system that uses DMISTO here, which includes decent statistics:
traderedge.net
I have not yet done any back testing on the system as a whole myself, but thought the DMISTO was an interesting indicator, so ported it over for those who might want to play with it and create their own systems. I added dots that denote signals similar to the system described above, which can be turned off if desired.
BTC HistoricMerged Bitstamp and Mt Gox precrash data.
To use you will need to use any chart with a start time before 7/2010. You will need this to see all the data otherwise it will get cut off. Publishing ideas using this indicator will spam some other symbol so I would not recommend doing so (sorry XAUUSD).
Click the "eye" button next to the primary security to hide it.
Make sure the indicator scale is set to "Right".
Right click on the right axis, and uncheck "Scale Series Only"
Note: Since this is going to be overlayed onto another chart it will likely be missing weekend data. If anyone knows of a current chart that is 24/7 that has data prior to July 2011 please leave a comment.
You can tweak the price weight between Gox and Stamp and the point when the data starts to blend to the time when Gox went off a cliff.
- Key date values:
1377 is Jan-6-2014
1385 is Jan-15-2014 (default)
1337 is about the ATH (coincidentally)
1192 is July-5-2013
--- Custom indicators for historic data:
I updated to the latest versions
- BTC Historic RSI
pastebin.com
created by @debani (www.tradingview.com)
original here:
- BTC Histroric Willy
pastebin.com
original indicator by @CRInvestor (www.tradingview.com)
created by @flibbr (www.tradingview.com)
original here:
- BTC Historic Ichimoku
pastebin.com
thanks to @flibbr, @debani for the indicators
Let me know if you have questions, comments.
3 new Indicators - PGO / RAVI / TIIMy "to-publish" list is getting too big, so decided to push out 3 indicators in the same chart
Feel free to "make mine" and use :) Leave a comment on what you think.
Pretty Good Oscillator
----------------------------------------
This indicator, by Mark Johnson, measures the distance of the current close from its N-day simple moving average, expressed in terms of an average true range (see Average True Range) over a similar period. So for instance a PGO value of +2.5 would mean the current close is 2.5 average days' range above the SMA.
Johnson's approach was to use it as a breakout system for longer term trades. If the PGO rises above 3.0 then go long, or below -3.0 then go short, and in both cases exit on returning to zero (which is a close back at the SMA). Indicator marks all these areas (3/-3/0)
Rapid Adaptive Variance Indicator
---------------------------------------------------------
RAVI is a simple indicator, by Tushar Chande, to show whether a stock is trending or not. Unlike ADX, RAVI measures only the trend intensity, it doesn't distinguish which way the trend is going. Rising RAVI shows the beginning of a trend or an increase in trend intensity, a decreasing slope signifies decreasing intensity. Also, RAVI often reacts more quickly and exhibits a more pronounced curve than ADX.
The standard values for daily charts are 7 and 65. For hourly charts, the most common averaging periods are 12 and 72 or 24 and 120.
The signal lines suggested are from +/- 0.3% to +/-1%. I haven't added any markings as these signals are instrument-specific. I suggest doing some back testing and adding these accordingly.
Trend Intensity Index
--------------------------------------
TII, by M. H. Pee, measures the strength of a trend, by looking at what proportion of the past "n" days prices have been above or below the level of today's "x"-day simple moving average. You can configure "n" via options page. "x" is calculated as "2 times n".
TII moves between 0 and 100. A strong uptrend is indicated when TII is above 80. A strong downtrend is indicated when TII is below 20.
Pee recommended entering trades when levels of 80 on the upside or 20 on the downside are reached. Indicator marks these lines for easy reference.