Array SMACalcuating SMA on an Array
In this script i show you how to calculate SMA on an array.
Several values are plotted just for illustration.
Steps to follow:
- make sure you have an array with values (source array)
- create a blank array (pref. with the same size)
- call the function array_sma
This function fills the empty array with the SMA values of the source array.
Sma
A Useful MA Weighting Function For Controlling Lag & SmoothnessSo far the most widely used moving average with an adjustable weighting function is the Arnaud Legoux moving average (ALMA), who uses a Gaussian function as weighting function. Adjustable weighting functions are useful since they allow us to control characteristics of the moving average such as lag and smoothness.
The following moving average has a simple adjustable weighting function that allows the user to have control over the lag and smoothness of the moving average, we will see that it can also be used to get both an SMA and WMA.
A high-resolution gradient is also used to color the moving average, makes it fun to watch, the plot transition between 200 colors, would be tedious to make but everything was made possible using a custom R script, I only needed to copy and paste the R console output in the Pine editor.
Settings
length : Period of the moving average
-Lag : Setting decreasing the lag of the moving average
+Lag : Setting increasing the lag of the moving average
Estimating Existing Moving Averages
The weighting function of this moving average is derived from the calculation of the beta distribution, advantages of such distribution is that unlike a lot of PDF, the beta distribution is defined within a specific range of values (0,1). Parameters alpha and beta controls the shape of the distribution, with alpha introducing negative skewness and beta introducing positive skewness, while higher values of alpha and beta increase kurtosis.
Here -Lag is directly associated to beta while +Lag is associated with alpha . When alpha = beta = 1 the distribution is uniform, and as such can be used to compute a simple moving average.
Moving average with -Lag = +Lag = 1 , its impulse response is shown below.
It is also possible to get a WMA by increasing -Lag , thus having -Lag = 2 and +Lag = 1 .
Using values of -Lag and +Lag equal to each other allows us to get a symmetrical impulse response, increasing these two values controls the heaviness of the tails of the impulse response.
Here -Lag = +Lag = 3 , note that when the impulse response of a moving average is symmetrical its lag is equal to (length-1)/2 .
As for the gradient, the color is determined by the value of an RSI using the moving average as input.
I don't promise anything but I will try to respond to your comments
Bollinger Band+ Multi EMA, SMAHello Everyone.
I make Bollinger band , 3 ema and 3 sma combined.
I think this indicator can use all timeframe.
--------------------------------------------------------------
Indicator will show you
1. Trend follow
2. Pullback catch
2. Market bounce.
1. Trend Follow
- Trend Follow for I used 3 terms. They are short, Mid and Long Trend.
2. Pullback Catch
- EMA for Save, take care, alert Zones.
- Mid Term Trend can be catch also.
3. Market Bounce
- Bollinger Band will show you market re-bounce point.
Final Notes
Indicator will show Trend, Pullback, Market bounce and some support and resistant level.
London breakout GBPUSD daytradeHello,
First I want to WARN THAT YOU NEED A MINIMUM OF 30X LEVERAGE FOR THIS STRATEGY IN ORDER TO WORK.
THE REASON IS THAT THE SIZE IS CALCULATED BASED ON A VERY SHORT STOP LOSS LEVEL IN PIPS
UTILIZE IT AT YOUR OWN RISK
This is a daytrading strategy, that's suited for GBPUSD 1H timechart.
It a very simple strategy that utilizes 2 moving averages : a very fast one and a very slow one.
It will always enter only at the beginning candle of London session, and it will always exit at the candle at the finish of London session.
So the rules are simple :
If its 8 am GMT and the candle close or high cross the slow moving average and we are above at the same over the slow moving average we make a long movement. The oposite condition is applied for short.
At the same time we always use a very small stop loss = 50-100 points ( 5-10 pips).
We dont have a take profit, in our case the trade ends always at the end of London session. In this case at 15h GMT
It might work on other currencies aswell, but it has to be tested first.
For any questions or suggestions, please let me know.
BB21_MA200_StrategyThis strategy follows the trend and keeps you in the trend until it breaks SMA 200
SMA setting is 200
BB setting is 21
BUY
====
when BB is (lower band and upper band) above SMA 200 and price crossing above BB middle line
Partial Exit
==========
When Lower BB crossing down SMA200 , exit 30%
Total Exit
=========
When BB middle band crosses down SMA200 , exit ALL
Stop Loss
======
default is set to 5%
Risk Management
================
This is new parameter I have introduced in my strategies. Default value is 10% . That means , if your capital is 10000 , you are willing to risk 10% of it ... i.e 1000.
It doesnot mean that you are buying shares/units for 1000 only. It is different ...see below
Your trade size is calculated based on Risk% .... capital x risk 5 / stop Loss units
for further explanation you can check Alexander Elder's risk management rule. He mentioned 2% rule for 100K account. But most of us dont have 100K accounts .. . so I have defaulted 10% on 10K account. You can change this values and see the results. It wont change the number of trades or profit factor. It will increase the net profit.
Warning
=======
For educational purposes only
4 Moving Exponential Average (EMA) indiactorWith this you can add four different EMA in single indicator.
You can also add different time frame EMA on different time frame charts.
This will help you to check EMA crossovers.
Pip RaidPIP RAID is another form of a macd Most indicator use close as their primary source which is good but side effect of it is the lag in 1-2 candles
I created in the past the VPT indicator which is a volume indicator similar to OBV and I tranform it to be ised as a source insted of close . the reason for it since it a volume based indicator it faster and can help in the lag issue
when you see a cross or plus sign appear it means that emas are touching not crossing so its sign of a potential move
when you see the highlighted red or green background appear it means that the emas have crossed
you can also see trend change , check columns if GOLD/RED if gold above 0 its a uptrend if it below its starting down trend ....
Easy System 420In this strategy, 15 indicators are used, each giving its results as a numerical value, which then is added or subtracted from the total points, gathered from all 15 indicators.
Many thanks to RafaelZioni for his great work making the EasySys1 script which i modified to create this script.
Onchart is drawn some of the indicators, but not all, a info panel is drawn showing the value each indicator has calculated. The info panel can be turned on or off.
Many of the indicator settings can be changed by user, and this is recommended, to tune the strategy to users chosen pair/timeframe.
Therefore any pair or timeframe can be used, the strategy tester results showing possible results, remember to set commission to match your broker. example chart settings here have common crypto exchange commission value: 0.25%
indicator list : SAR + STT + ZigZag + ROC + DMI + CCI + Weis + SMA + AO + MOM + Hist + BB + Ichimoku + HMA
SMAs (20,20,20) by Ankitthis script is a combination of 3SMA"s of 20 period. it works very good in low time frame, the breakout candle will confirm the trade n also sl Will be sMall.
WMA DynamicDemonstration of a new feature that allows to change lookback period dynamically, used with WMAs. Rather than WMA any one can be used here (SMA, Alma,...) as long as its second argument supports dynamic change. If not, you have to use your own implementation of MA.
HM systemBlank line is RSI (9 days) line
Green line is EMA (3 days) line
Red line is WMA (21 days) line
when RSI EMA line above 50 & WMA is below both ,it is buy signal
when RSI EMA line below 50 & WMA is above both ,it is sell signal
MA Cross - Multi-Timeframe The MA cross is probably one of my favourite strategies because of its simplicity but it often gets overlooked for more complex strategies.
The original author of this script is ChartArt, I have just added some extra controls and functions which are outlined below. I would just like to add that this is my first published script, everything I have learned about coding has been from studying and tinkering with many of the publicly available scripts on TV so I would like thank all the authors who give out this knowledge so freely!
Updates
- Converted to v4
- Made some graphical changes and provided more control over plots
- Added RMA and VWMA
- Added alerts
Original script can be found here
HL MAsMain features of this script are:
* To show always highest and lowest value from given Moving Averages of certain intervals (30min, 1h, 2h, 4h. 6h, 12h, 1D, 3D, 1W to choose from, multiple choices are possible and desired).
* It also draws the middle line made of highest and lowest MA lines.
* If you would like to see all the MAs to see how its working you can turn them on from the scripts options ("Show all MAs").
* You may switch between SMA and EMA.
* You may set the length of which MAs on all set intervals will be calculated.
* The plus of using this is also that no matter what interval you have on chart, you will always see MAs from set up intervals, so lines will be always in the same places on chart.
ps. This script is invite-only for the members of our trading group (info in signature, group is free of charge).
Golden Triangle StrategyGolden Triangle strategy setup is a variation of the buy-the-dip strategy, by Charlotte Hudgin.
You can find the detailed explanation here by Thomas N. Bulkowski thepatternsite.com
BUY
===
1. price should be trading above sma50
2. when it touches sma50 first time , check the starting rallypoint of where it initiated
3. from the above point to current close , see if you have white space , then draw the triangle
4. then check for volume confirmation ( current volume should be greater than last 4 ) --- I have slightly changed this to fit into hourly strategy by adding condition close>vwap
EXIT
====
1. Exit when close crossing down sma50 with at least 2% profit (slightly modified original condition)
StopLoss
========
2. stop loss is set to 6%
Warning
=======
For the use of educational purposes only
CC - Candle Momentum IndicatorA simple VWAP and SMA smoothing on the candles along with some momentum coloring. Basically, if the "slider" is slid all the way up and it turns red, moving down or losing volume t's probably going down. If it's all the way down and starts turning green, getting bigger and seeing volume, it's probably going up. this is a prototype indicator that I plan to extend using arrays and averages if it is seen as something useful.
GMS: The OscillatorThis is my version of an RSI. Basically treat it the same way, but needless to say there's a few more things going into it than just the closing price.
The color of the line is based on my HAMA JAMMA indicator so they could be used in conjunction to help pick potential trend reversals in either direction, overbought and oversold levels will turn the line yellow.
The "Make that a combo?" selection will change the curve and make it more sensitive to sharper price movements.
This works on any time frame as well as any bar type, although for certain bar types you'll probably have to tweak the settings to see what works.
I hope it helps,
Andre
Every single moving average (ALMA, EMA, HMA, KAMA, RMA, SMA...)So you may be looking at the graph and thinking "this is a mess", and I agree.
The purpose of this script is to plot in the same graph every single type of moving average that I could think of, so you can find the ones that are better for your timeframe and for your asset. Once you add it, disable those types that doesn't seem to serve your purpose, until you can select one you like.
The average types are: ALMA, EMA, HMA, KAMA, RMA, SMA, SWMA, VIDYA, VWAP, VWMA, and WMA. Each one is ploted two times (except SWMA and VWAP), one with a short period, and another with a long, both of which you can configure.
7 EMA 3 SMA with nameplatesScript provides 7 EMA (5 20 50 100 200 500 1000), 3 SMA (200 500 1000) with built-in nameplates for easier navigation. Different colors and widths from the start just to make your initial tuning a bit easier.
Based on Bubsan and Silkheat multicombo, heavily modified, but still huge kudos to guys for the base code.
Modifications: lengths adjusted, on-chart nameplates added, 2 EMA's added, SMA's reduced, static SMA's deleted.
GMS: HAMA JAMMAThis is my version of HAMA candles, I just wanted more out of the original indicator. So now with this one you'll be able to pick which MA you want as well as it's length.
MA's included are: SMA, EMA, WMA, HMA, VWMA, & Linear Regression.
The line at the bottom represents a slightly firmer grasp of the trend relative to the HAMA candle colors. Basically it will help to filter out potentially weak signals. *It is not price support*
Tip: Be sure to turn off the border color in the settings, it will help the colors to pop.
Hope this helps,
Andre
Simple SMA Strategy Backtest Part 5Simple SMA strategy
In this stream, we will create an intraday trade cap.
WARNING:
- For purpose educate only
- This script to change bars colors
Stream:
www.tradingview.com
WR Robo Level 1FCPO trading robot alert is based on one of the popular WR Level 1 Technique strategy.
This alert is suitable to used by personal who are understand WR Level 1 Technique.
The script will identify candle that is touch SMA line and trend candle (in direction of Long or Short) to determine either to go with Long or Short entry.
Once entry is confirm, script will popup one label with detail of Long Entry Condition or Short Entry Condition.
This is an example of Long Entry Condition :
This is an example of Short Entry Condition :
Recommended Chart Settings:
Asset Class: FCPO Active Contract
Time Frame: 15 Minute
Long Entry Conditions:
a) Green Label with information of Buy Stop value, Take Profit Value and Stop Loss Value
b) Buy Stop value will be plot with Black Circle symbol on the chart
b) Take Profit value will be plot with Orange Cross symbol on the chart
b) Stop Loss value will be plot with Red Cross symbol on the chart
Short Entry Conditions:
a) Red Label with information of Sell Stop value, Take Profit Value and Stop Loss Value
b) Sell Stop value will be plot with Black Circle symbol on the chart
b) Take Profit value will be plot with Orange Cross symbol on the chart
b) Stop Loss value will be plot with Red Cross symbol on the chart
The entry label will appear once WR Level 1 Technique is valid.
Exit Conditions:
a) Stop loss level is hit
b) Take profit level is hit
c) Last candle at the end of the day (at 17:59:45 or earlier)
Default Robot Settings:
Simple Moving Average ( SMA ) : 50
Disclaimer:
This is a FCPO trading strategy that involves high risk of equity loss, You agree to use this script at your own risk.
If you have any suggestions, comments or interested to use this script, kindly PM us to obtain an access.
PT TMA BandsVersion 1.0 of our TMA Bands is a visual of areas of interest. The purpose of this indicator is to determine where the price will likely bounce or reject. When an asset is ranging, it very well respects the neutral (middle) zone. The highest RR trade setups are when the price goes from one end of the bands to another.
The bands included are of an ATR multiplier based on multiple moving averages. Each moving average has a unique feature that offers a high probability reaction when price gravitates towards it. We have color-coordinated the bands into three zones. The Main zone being the middle area where the asset tends to play ping pong & range, Top zone, which offers the best RR for shorts & the bottom zone, which provides the best RR for longs.
Strategy:
When scalping or swinging, always look for shorts close to the red zone as possible with a stop loss above the red band. When longing, always look for longs close to the green zone area with a stop loss below the green band. Anything in orange is a neutral zone, which will confirm the asset is more than likely ranging. I don’t advise taking trades in that zone unless you have solid risk management. When playing the macros, H12+ always look for price to find support at the orange (middle) band before deciding on a shift in trend. If the asset breaks down from the orange (middle) band, you usually get a retest of that band before further downside. Also, something to consider, if you punt longs at the green zone, you want to target the orange (middle) band. If you punt shorts at the red zone, you want to target the orange (middle) band. I usually take 70% off at the middle band & let the rest run if ultimately end up in the opposite zone.
This Oscillator is best with the buy/sell signals we provide. It offers extra confluence with stop loss & targets. I enjoy using it on all time frames for swinging & scalping. It is included as part of the library. Just message us for access!
TEMA, DEMA and SMA with crosses with alert functionality
Just a crude but functioning ma indicator with bullish and bearish crosses and alert functionality.