MACD Multi-MA StrategyThis script applies the average of each major MA (SMA, RMA, EMA, WVMA, WMA) to the MACD formula.
The logic is simple. When all 5 MA's are in agreement in direction, then then script will notify users of change.
I posted this as a strategy to help show how logic does in back test. If you use my simple yet effective solution to find take profit locations, you can blow this back testing out of the water!!!
To set alerts simply turn script into study
//@version=2
study(title="MACD Multi-MA Study", overlay=false)
src = close
len1 = input(8, "FAST LOOKBACK")
len2 = input(144, "SLOW LOOKBACK")
/////////////////////////////////////////////
length = len2-len1
ma = vwma(src, length)
plot(ma, title="VWMA", color=lime)
length1 = len2-len1
ma1 = rma(src, length1)
plot(ma1, title="RMA", color=purple)
length2 = len2-len1
ma2 = sma(src, length2)
plot(ma2, title="SMA", color=red)
length3 = len2-len1
ma3 = wma(src, length3)
plot(ma3, title="WMA", color=orange)
length4 = len2-len1
ma4 = ema(src, length4)
plot(ma4, title="EMA", color=yellow)
long = ma > ma and ma1 > ma1 and ma2 > ma2 and ma3 > ma3 and ma4 > ma4
short = ma < ma and ma1 < ma1 and ma2 < ma2 and ma3 < ma3 and ma4 < ma4
alertcondition(long == true, title='MACD LONG SIGNAL', message='MACD LONG!')
alertcondition(short == true, title='MACD SHORT SIGNAL', message='MACD SHORT!')
Moving Averages
SMA_Cross + RSI1. long
a. RSI does not open an order when it is overbought, until the RSI falls below a certain threshold, and then open a position
b. There are already many positions. If the RSI is overbought, it will be profitable. When the RSI falls below a certain threshold, open a long position again until the moving average crossover signal turns short.
2. Short
a. RSI does not open an order when it is oversold, and then opens a position after RSI rises to a certain threshold
b. There are already short positions. If the RSI is oversold, it will be profitable to close the short position. When the RSI rises above a certain threshold, open the short position again until there is a reversal of the moving average crossing signal.
1. 做多
a. RSI在超买区间时不开单,直到RSI回落到某个阈值之下,再开仓
b. 已经有多仓,如果RSI超买,则平多获利,当RSI回落到某个阈值之下后,再次开多,直到有均线交叉信号反转做空
2. 做空
a. RSI在超卖区间时不开单,直到RSI上升到某个阈值之后,再开仓
b. 已经有空仓,如果RSI超卖,则平空获利,当RSI上升到某个阈值之上后,再次开空,直到有均线交叉信号反转做多
Noro's CrossMASimple strategy. Price and moving average crossing. There is a choice of type of moving average.
Moving average types
SMA = Simple Moving Average
EMA = Exponential Moving Average
VWMA = Volume-Weighted Moving Average
DEMA = Double Exponential Moving Average
TEMA = Triple Exponential Moving Average
KAMA = Kaufman's Adaptive Moving Average
PCMA = Central line of price channel (Donchian channel)
MarketCipher B Backtest (FOR TESTING ONLY, NOT SAFE TO TRADE)A script to backtest the strategy outlined. This is not a final version of the script and is therefore not safe to trade. If you choose to ignore this warning, trade at your own risk.
HULLMiguel 2019/ Strategy v3This script make BUY and SELL orders accordingly with the direction of EMA. (positive BUY and Negative SELL). It can help on a Daily or 4h chart. Check the Strategy Tester and adapt the Time Frame and the EMA to a especific Coin. If you have any ideas to create a new strategy or improve the hesisting one, please contact me.
EVWMA VWAP Cross Strategy [QuantNomad]Continue to experiement with VWAP and EVWMA.
It seems that just simple crosses between VWAP and EVWMA can be pretty good signals. VWAP is a bit choppy so you can use VWAP smoothing input to smoth it a bit.
Here are few other strategies based on EVWMA:
EVWMA VWAP MACD Strategy
QuantNomad - EVWMA MACD Strategy
EVWMA VWAP MACD Strategy [QuantNomad]Based on comment of @coondawg71 I tried to compare VWAP and EVWMA.
Both are sort of moving averages so I decided to create a MACD based on these 2 indicators.
In parameters you can set EVWMA Length and 2 smoothing lengths for "macd" and "signal".
Strategy seems to work pretty good at 2h-8h timeframes for crypto.
What do you thing about it?
Simple Price Momentum - How To Create A Simple Trading StrategyThis script was built using a logical approach to trading systems. All the details can be found in a step by step guide below. I hope you enjoy it. I am really glad to be part of this community. Thank you all. I hope you not only succeed on your trading career but also enjoy it.
docs.google.com
Scripting Tutorial B - TManyMA - Commission/FeesThis script is for a triple moving average strategy where the user can select from different types of moving averages, price sources, lookback periods and resolutions.
Features:
- 3 Moving Averages with variable MA types, periods, price sources, resolutions and the ability to disable each individually.
- Crossovers are plotted on the chart with detailed information regarding the crossover (Ex: 50 SMA crossed over 200 SMA )
- Forecasting available for all three MAs. MA values are forecasted 5 values out and plotted as if a continuation to the MA.
- Forecast bias also applies to all forecasting. Bias means we can forecast based on an anticipated bullish , bearish or neutral direction in the market.
- To understand bias, please read the source code, or if you can't read the code just send me a message on here or Twitter . Twitter should be linked to my profile.
- Ribbons added and on by default. Optional setting to disable the ribbons. 5 ribbons between MA1 and MA2 and another 5 between MA2 and MA3.
- Ribbons are alpha-color coded based on their relation to their default MAs.
- Ribbons are only visible between MAs if the MAs being compared share the same Type, Resolution, and Source because there is no way to consolidate those three in a simple manner.
- Ribbon values are calculated based on calculated MA Periods between the MAs.
- Converted the existing study into a strategy.
- Strategy only enters long positions with a market order when MA crossovers occur.
- Strategy exits positions when crossunders occur.
- Trades 100% of the equity with one order/position by default.
- Ability to disable trading certain crosses with input checks.
- Ability to exit trades with a take profit or stop loss.
- User input to allow quick changes to the take profit or stop loss percentages.
- Strategy now calculates on every tick
- Strategy also includes fixed commission values based on Coinbase standard order fees
This script is meant as an educational script with well-formatted styling, and references for specific functions.
*** PLEASE NOTE - THIS STRATEGY IS MEANT FOR LEARNING PURPOSES. DEPENDING ON IT'S CONFIGURATION IT MAY OR MAY NOT BE USEFUL FOR ACTUAL TRADING. THE STRATEGY IS NOT FINANCIAL ADVICE ***
QQE Cross v6.0 by JustUncleL-Long-Short by sscogin BACKTESTAllows for back test of the "QQE Cross v6.0 by JustUncleL-Long-Short Alerts by sscogin" indicator/strategy.
Provides the ability to test this strategy on long/short trades with the added option to select a %stop loss or %take profit signals.
Easy to adjust settings to long only, short only, or continuous long and short, and to immediately analyze profit % differences for different settings.
Backtesting on Non-Standard Charts: Caution! - PineCoders FAQMuch confusion exists in the TradingView community about backtesting on non-standard charts. This script tries to shed some light on the subject in the hope that traders make better use of those chart types.
Non-standard charts are:
Heikin Ashi (HA)
Renko
Kagi
Point & Figure
Range
These chart types are called non-standard because they all transform market prices into synthetic views of price action. Some focus on price movement and disregard time. Others like HA use the same division of bars into fixed time intervals but calculate artificial open, high, low and close (OHLC) values.
Non-standard chart types can provide traders with alternative ways of interpreting price action, but they are not designed to test strategies or run automated traded systems where results depend on the ability to enter and exit trades at precise price levels at specific times, whether orders are issued manually or algorithmically. Ironically, the same characteristics that make non-standard chart types interesting from an analytical point of view also make them ill-suited to trade execution. Why? Because of the dislocation that a synthetic view of price action creates between its non-standard chart prices and real market prices at any given point in time. Switching from a non-standard chart price point into the market always entails a translation of time/price dimensions that results in uncertainty—and uncertainty concerning the level or the time at which orders are executed is detrimental to all strategies.
The delta between the chart’s price when an order is issued (which is assumed to be the expected price) and the price at which that order is filled is called slippage . When working from normal chart types, slippage can be caused by one or more of the following conditions:
• Time delay between order submission and execution. During this delay the market may move normally or be subject to large orders from other traders that will cause large moves of the bid/ask levels.
• Lack of bids for a market sell or lack of asks for a market buy at the current price level.
• Spread taken by middlemen in the order execution process.
• Any other event that changes the expected fill price.
When a market order is submitted, matching engines attempt to fill at the best possible price at the exchange. TradingView strategies usually fill market orders at the opening price of the next candle. A non-standard chart type can produce misleading results because the open of the next candle may or may not correspond to the real market price at that time. This creates artificial and often beneficial slippage that would not exist on standard charts.
Consider an HA chart. The open for each candle is the average of the previous HA bar’s open and close prices. The open of the HA candle is a synthetic value, but the real market open at the time the new HA candle begins on the chart is the unrelated, regular open at the chart interval. The HA open will often be lower on long entries and higher on short entries, resulting in unrealistically advantageous fills.
Another example is a Renko chart. A Renko chart is a type of chart that only measures price movement. The purpose of a Renko chart is to cluster price action into regular intervals, which consequently removes the time element. Because Trading View does not provide tick data as a price source, it relies on chart interval close values to construct Renko bricks. As a consequence, a new brick is constructed only when the interval close penetrates one or more brick thresholds. When a new brick starts on the chart, it is because the previous interval’s close was above or below the next brick threshold. The open price of the next brick will likely not represent the current price at the time this new brick begins, so correctly simulating an order is impossible.
Some traders have argued with us that backtesting and trading off HA charts and other non-standard charts is useful, and so we have written this script to show traders what happens when order fills from backtesting on non-standard charts are compared to real-world fills at market prices.
Let’s review how TV backtesting works. TV backtesting uses a broker emulator to execute orders. When an order is executed by the broker emulator on historical bars, the price used for the fill is either the close of the order’s submission bar or, more often, the open of the next. The broker emulator only has access to the chart’s prices, and so it uses those prices to fill orders. When backtesting is run on a non-standard chart type, orders are filled at non-standard prices, and so backtesting results are non-standard—i.e., as unrealistic as the prices appearing on non-standard charts. This is not a bug; where else is the broker emulator going to fetch prices than from the chart?
This script is a strategy that you can run on either standard or non-standard chart types. It is meant to help traders understand the differences between backtests run on both types of charts. For every backtest, a label at the end of the chart shows two global net profit results for the strategy:
• The net profits (in currency) calculated by TV backtesting with orders filled at the chart’s prices.
• The net profits (in currency) calculated from the same orders, but filled at market prices (fetched through security() calls from the underlying real market prices) instead of the chart’s prices.
If you run the script on a non-standard chart, the top result in the label will be the result you would normally get from the TV backtesting results window. The bottom result will show you a more realistic result because it is calculated from real market fills.
If you run the script on a normal chart type (bars, candles, hollow candles, line, area or baseline) you will see the same result for both net profit numbers since both are run on the same real market prices. You will sometimes see slight discrepancies due to occasional differences between chart prices and the corresponding information fetched through security() calls.
Features
• Results shown in the Data Window (third icon from the top right of your chart) are:
— Cumulative results
— For each order execution bar on the chart, the chart and market previous and current fills, and the trade results calculated from both chart and market fills.
• You can choose between 2 different strategies, both elementary.
• You can use HA prices for the calculations determining entry/exit conditions. You can use this to see how a strategy calculated from HA values can run on a normal chart. You will notice that such strategies will not produce the same results as the real market results generated from HA charts. This is due to the different environment backtesting is running on where for example, position sizes for entries on the same bar will be calculated differently because HA and standard chart close prices differ.
• You can choose repainting/non-repainting signals.
• You can show MAs, entry/exit markers and market fill levels.
• You can show candles built from the underlying market prices.
• You can color the background for occurrences where an order is filled at a different real market price than the chart’s price.
Notes
• On some non-standard chart types you will not obtain any results. This is sometimes due to how certain types of non-standard types work, and sometimes because the script will not emit orders if no underlying market information is detected.
• The script illustrates how those who want to use HA values to calculate conditions can do so from a standard chart. They will then be getting orders emitted on HA conditions but filled at more realistic prices because their strategy can run on a standard chart.
• On some non-standard chart types you will see market results surpass chart results. While this may seem interesting, our way of looking at it is that it points to how unreliable non-standard chart backtesting is, and why it should be avoided.
• In order not to extend an already long description, we do not discuss the particulars of executing orders on the realtime bar when using non-standard charts. Unless you understand the minute details of what’s going on in the realtime bar on a particular non-standard chart type, we recommend staying away from this.
• Some traders ask us: Why does TradingView allow backtesting on non-standard chart types if it produces unrealistic results? That’s somewhat like asking a hammer manufacturer why it makes hammers if hammers can hurt you. We believe it’s a trader’s responsibility to understand the tools he is using.
Takeaways
• Non-standard charts are not bad per se, but they can be badly used.
• TV backtesting on non-standard charts is not broken and doesn’t require fixing. Traders asking for a fix are in dire need of learning more about trading. We recommend they stop trading until they understand why.
• Stay away from—even better, report—any vendor presenting you with strategies running on non-standard charts and implying they are showing reliable results.
• If you don’t understand everything we discussed, don’t use non-standard charts at all.
• Study carefully how non-standard charts are built and the inevitable compromises used in calculating them so you can understand their limitations.
Thanks to @allanster and @mortdiggiddy for their help in editing this description.
Look first. Then leap.
Kirk65 UTBot Strategy FixedCredits to @HPotter for the orginal code.
Credits to @Yo_adriiiiaan for recently publishing the UT Bot study based on the original code.
Credits to @TradersAITradingPlans for making UT Bot strategy.
Strategy fixed with time period by Kirk65.
UT Bot works great with 2 hour time frame with Heikin Ashi, but riskier. Use "Once per bar" In alerts with 1.5% stoploss. If the price goes against Alerts, stoploss will save your assets. Wait until next Alert.
4 hour time frame is less risky and less profitable.
Happy trading..
Kirk65
NoNonsense Forex - high timeframe trading absurd NON-REPAINTINGSome time ago I bumped into NoNonsense Forex - pretty good-looking course with well-designed videos, reasonable rules, etc. Nice explanatory videos, not selling anything, building indicators-only strategy. But there was one thing that really annoyed me - it was supposed to work only on Daily timeframe. What is the point in trading such high timeframe, if decisions changing market direction are playing out within 1 minute? What is the point in evaluating trades from 1994 if we are 25 years later?
Anyway, I have developed this strategy, which is:
- non-repainting
- not using trailing-stop
- not using any other known TradingView backtest bugs
And I'm showing it as an example of OVERFITTING. Backtesting results look absurd: 100% profitable. But if you change any of the many parameters in the Settings popup, they will turn into disaster. It means, the rules of this strategy are very fragile. Don't trade this! Remember about backtesting rule #1: past results do not guarantee success in the future.
I'm giving this strategy out with the source code. Feel free to do anything you want with it. But if you find parameters or modifications on, which allow profitable trading on lower timeframes, don't be shy, let me know :)
*********
Forex / Indices / Commodities traders who want to start AUTO-TRADING might want to take a look at "TradingConnector", which allows no-latency trades execution from TradingView to MT4/MT5.
QuantNomad - EVWMA MACD StrategyPretty simple EVWMA (Elastic Volume Weighted Moving Average ) MACD Strategy.
EVWMA is a quite interesting moving average where the period of the MA is defined from the volume itself.
It incorporates volume information in a natural and logical way. The EVWMA can be looked at as an approximation to the average price paid per share.
As a volume period, you can use sum of the last x bars volumes.
Here are other EVWMA indicators/strategies:
EVWMA indicator:
EVWMA Cross strategy:
Scripting Tutorial A - TManyMA - StopsThis script is for a triple moving average strategy where the user can select from different types of moving averages, price sources, lookback periods and resolutions.
Features:
- 3 Moving Averages with variable MA types, periods, price sources, resolutions and the ability to disable each individually.
- Crossovers are plotted on the chart with detailed information regarding the crossover (Ex: 50 SMA crossed over 200 SMA )
- Forecasting available for all three MAs. MA values are forecasted 5 values out and plotted as if a continuation to the MA.
- Forecast bias also applies to all forecasting. Bias means we can forecast based on an anticipated bullish, bearish or neutral direction in the market.
- To understand bias, please read the source code, or if you can't read the code just send me a message on here or Twitter. Twitter should be linked to my profile.
- Ribbons added and on by default. Optional setting to disable the ribbons. 5 ribbons between MA1 and MA2 and another 5 between MA2 and MA3.
- Ribbons are alpha-color coded based on their relation to their default MAs.
- Ribbons are only visible between MAs if the MAs being compared share the same Type, Resolution, and Source because there is no way to consolidate those three in a simple manner.
- Ribbon values are calculated based on calculated MA Periods between the MAs.
- Converted the existing study into a strategy.
- Strategy only enters long positions with a market order when MA crossovers occur.
- Strategy exits positions when crossunders occur.
- Trades 100% of the equity with one order/position by default.
- Ability to disable trading certain crosses with input checks.
- Ability to exit trades with a take profit or stop loss.
- User input to allow quick changes to the take profit or stop loss percentages.
This script is meant as an educational script with well-formatted styling, and references for specific functions.
*** PLEASE NOTE - THIS STRATEGY IS MEANT FOR LEARNING PURPOSES. DEPENDING ON IT'S CONFIGURATION IT MAY OR MAY NOT BE USEFUL FOR ACTUAL TRADING. THE STRATEGY IS NOT FINANCIAL ADVICE ***
First time coding - a 5min forex Scalping strategy This is my first attempt at producing a strategy in Pine Script.
I am NOT a professional coder. I'm not even a good coder at that. I've only started Pine Script coding since September 2019. I am teaching myself.
This script is far from finished. I need to tweak a number of things about this script. Namely:
Add a validity window to the 'trigger bar' condition. Ie, I want to shut down the condition when the price closes above EMA21
Change the order entry so they are stop orders, using the stop entry price derived from the signals
Make changes to lot sizing
Add a trailing stop condition
Comments welcome, but do not expect me to reply to any questions or requests. In fact, don't expect any replies from me. I consider myself notoriously bad at replies.
I do welcome any feedback from any seasoned coders out there, as I am still a novice coder, and have so much to learn!
As to anyone who wants to criticise me - constructive and helpful criticism are most welcome, criticism to make yourself feel superior to me - you kind can eat a dk.
For the strategy rules, google the user ForexSignals TV account and look for the video "SIMPLE and PROFITABLE Forex Scalping Strategy".
Share, learn, prosper
Peace to y'all
Serialhenry
6/11/19
QuantNomad - EVWMA Cross StrategyPretty simple EVWMA (Elastic Volume Weighted Moving Average) Cross Strategy. Long on bullish cross, Short on Bearish Crosss.
EVWMA is a quite interesting moving average where period of the MA is defined from volume itself.
It incorporates volume information in a natural and logical way. The eVWMA can be looked at as an approximation to the average price paid per share.
As a volume period you can use sum of the last x bars volumes.
Here is EVWMA as an indicator:
VRSI-MARSI StrategyI wanted to create an indicator which resembles price movement, aside to volume movement.
The "yellow-blue" line is the MA(5) of the RSI (9) of closing price.
The "orange" line is the MA(5) of the RSI (9) of Volume .
(Default plot of RSI and VRSI is not visible but can be made visible ("Settings" > "Style" > set "Opacity" of "RSI & VRSI"))
The Long (Buy) condition is triggered when the MA(5) of the RSI (9, close) goes up.
The Short (Sell) condition is triggered when the MA(5) of the RSI (9, close) goes down.
Comparing the price movement with the "orange" Volume line helps to spot a possible trend change,
for example when price goes up and an ascending Volume line starts to flatten or starts descending,
this could be a sign that the Bullish trend is weakening, predicting a possible trend change.
Or, when for example a downwards price movement is accompanied with a rising Volume line, this can be a sign of large Bearish power.
Because it still is a RSI indicator, the midline (50), and Oversold/Overbought area's (20-30 & 70-80) are important to watch, especially the MARSI!
A second strategy is made (VRSI-MARSI Strategy 2) where the Long/Short condition is triggered when "MA RSI (close) - MA RSI ( Volume )" crosses.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The Long & Short entries, as well as the Entry Close are visible 1 bar after the trigger.
When the blue line changes in a yellow line (and vice versa) it will show a candle earlier (see yellow dashed lines = (1)).
Also, the condition is fulfilled when the candle closes (2), but the order doesn't take place in the same bar, but the next (3).
Because this is a strategy the "actual Order" will not take place at the "Close" of the candle (2), but at the "Open" at the NEXT candle (3).
I also have this strategy as a study (A+B), where the "Buy" & "Sell" shows a candle earlier.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The entries are default 5% of equity, without pyramiding, which already gives large profits.
A large part of the profit is because of the Entry Close of the Long & Short entries.
You can easily turn these off (Settings > Inputs) to see what profit the strategy gives without Entry Close.
Here they are disabled:
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
More information available in the script ;-)
[XC] Adaptive Strategy V3 - Ratio OCHL Averager no repaintHere is an update with PS4 and a no repaint version.
As an trading example I have chosen XBTUSD on a 1 min time frame.
I think it works pretty well on the first glance.
But to know if it works a check over a longer time is necessary.
Thanks to alexgrover for the "Ratio OCHL Averager" script.
35EMA Cross BuyAndSell Strategy + RIBBON [d3nv3r]This strategy allow the user to move the EMA which control the Buy&Sell Strategy and show the EMA ribbon that can be found in the Template area.
Buy showing the ribbon and letting the user to adjust the EMA signaling the B&S strat the user can create an elaborated strategy for buyPoint and sellPoint.
The 35EMA Cross is choosen by default but I recommend to move it to find best Sell point and best Buy point as you would not react on the same EMA for a Buy signal and a Sell Signal..
It would be good to have buy signal on a EMA and the sell signal on another but that's for another Strategy to be shared.
Let me know by commenting what you would like for the next one !