MACD controlled risk strategy exampleUsing a basic MACD as a signal this code is an example of how to base strategies around stops and calculated risk per trade rather than the more common approach of 'equity flipping' long and short for every trade and using an arbitrary %age stop which can leave you a bit exposed, lead to excessive drawdown and miss out on bigger sized positions for more profits.
Осцилляторы
scalping against trapped countertrendAbstract
This script attempts to find the end of countertrend.
This script uses oscillators to measure long term and short period trends. When the long term trend keeps positive and clear short term period is over, this script provides a buy signal.
This script does not contain pullback, cut loss and re-enter. You need to add it manually.
Introduction
Many traders want to buy when long term trend is bullish and short term pullback is over.
This is because we can take advantage to the emotion of countertrend traders.
Countertrend traders realizes their profit is finite and therefore want to protect their profit well and limit their loss.
This script is inspired by a searchable trading strategy video.
The video mentioned 4 points.
(1) long term trend. The video did not spend much ink on this point. You can use any method to observe.
(2) clear pullback bar (at least 50% body)
(3) weak bar after clear pullback
(4) entry trigger buy stop
This script attempts to quantize these points to determine trading direction.
This script is originally designed for timeframes lower than examples in the video but you can apply it on any timeframe.
Computing and Adjusting
(1) long term trend
This script uses smoothed stochastic.
(2) clear pullback bar
Since this script is originally designed for timeframes lower than examples in the video, so the condition becomes:
RSI is low enough
(3) weak bar after clear pullback
RSI goes back from low level.
(4) entry trigger buy stop
This script does not include this condition.
You can decide enter when buy stop or pullback.
Parameters
x_src : the value for computing oscillators
x_len_a : how many bars for measuring short term trend
x_len_b : how many bars for measuring long term trend
x_k_b : smooth long term trend, the average value of stochastic values
x_changk = check if clear short term pullback appears recently. 1 means do not use, larger numbers means how long of periods to check.
x_rsi_ct : threshold of short term pullback clear
x_rsi_ft : threshold of short term pullback end
Reading numbers in Strategy Tester
Most possible loss :
(1) to find rational pullback. Generally 1/3 to 2/3 atr.
(2) to find cut loss distance. Generally 1 to 2 atr.
Most possible profit :
to find if trading the opposite direction against this script is profitable.
Conclusion
This script can suggest us trading direction.
Waiting for pullback can reduce risk, compared to buy stop.
This script does not provide good signals in sideways markets.
Reference
A searchable trading strategy video
Self-Optimising MACD (Experimental)Hi guys, just thought I'd share a small part of an idea i've been working on.
One of the biggest problems with algo trading is optimisation and finding a way to constantly adapt to the market conditions as time unfolds.
First of all... You should NEVER EVER trade just using a MACD, including this study, and I only produced this script in a small amount of time, so make sure you backtest it properly before using it. When backtesting, it is my advice that your sample size should be at least 5000 trades, but I recommend 10000 in order to get sufficient statistical significance.
Also, I am not a financial advisor, and any trading based decisions are your sole responsibility.
Anyways...
This script is simple... it simply uses 4 different MACD's and tracks their profit/loss and automatically uses the one with the most historical profit at any given time to execute a trade. The type of MACD will obviously change as market states fluctuate.
Included are : Hull MACD, Ema MACD, Sma MACD and VWMA Macd.
You can adjust all four of their settings to your desire.
The trade execution is simple and definitely flawed... it simply tracks the MACD when it has a crossover for long, and then the opposite for short.
The green line represents the performance of the top MACD for Longs at any given time. This line refreshes once a year, and where it is in relation to price, reflects how profitable it has been I.e - the higher it is the better.
The Red line represents the performance on the Short side, and again, it reflects profit/loss, but this time the LOWER the line is in relation to price the better.
There is no exit strategy in place! This is why I do NOT recommend trading off this script alone, but to use it as a tool to help optimise your choice of MACD.
However, your exit strategy could change your optimal choice of MACD, so keep that in mind.
The lookback period represents how far the script will track the performance at any given time. This will change your results. The longer the period, the more it will show long term success and vice versa.
This optimisation process could be done with different indicators, moving averages, or even multiple strategies to find the most statistically viable option at any given time... if you wish to have this process coded into your strategies or indicators, message me.
Enjoy.
Combo Backtest 123 Reversal & Line Regression Intercept This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
Linear Regression Intercept is one of the indicators calculated by using the
Linear Regression technique. Linear regression indicates the value of the Y
(generally the price) when the value of X (the time series) is 0. Linear
Regression Intercept is used along with the Linear Regression Slope to create
the Linear Regression Line. The Linear Regression Intercept along with the Slope
creates the Regression line.
WARNING:
- For purpose educate only
- This script to change bars colors.
TradingView Alerts to MT4 MT5 - Forex, indices, commoditiesHowdy Algo-Traders! This example script has been created for educational purposes - to present how to use and automatically execute TradingView Alerts on real markets.
I'm posting this script today for a reason. TradingView has just released a new feature of the PineScript language - ALERT() function. Why is it important? It is finally possible to set alerts inside PineScript strategy-type script, without the need to convert the script into study-type. You may say triggering alerts straight from strategies was possible in PineScript before (since June 2020), but it had its limitations. Starting today you can attach alert to any custom event you might want to include in your PineScript code.
With the new feature, it is easier not only to execute strategies, but to maintain codebase - having to update 2 versions of the code with each single modification was... ahem... inconvenient. Moreover, the need to convert strategy into study also meant it was required to rip the code from all strategy...() calls, which carried a lot of useful information, like entry price, position size, and more, definitely influencing results calculated by strategy backtest. So the strategy without these features very likely produced different results than with them. While it was possible to convert these features into study with some advanced "coding gymnastics", it was also quite difficult to test whether those gymnastics didn't introduce serious, bankrupting bugs.
//////
How does this new feature work? It is really simple. On your custom events in the code like "GoLong" or "GoShort", create a string variable containing all the values you need inside your alert and this string variable will be your alert's message. Then, invoke brand new alert() function and that's it (see lines 67 onwards in the script). Set it up in CreateAlert popup and enjoy. Alerts will trigger on candle close as freq= parameter specifies. Detailed specification of the new alert() function can be found in TradingView's PineScript Reference (www.tradingview.com), but there's nothing more than message= and freq= parameters. Nothing else is needed, it is very simple. Yet powerful :)
//////
Alert syntax in this script is prepared to work with TradingConnector. Strategy here is not too complex, but also not the most basic one: it includes full exits, partial exits, stop-losses and it also utilizes dynamic variables calculated by the code (such as stop-loss price). This is only an example use case, because you could handle variety of other functionalities as well: conditional entries, pending entries, pyramiding, hedging, moving stop-loss to break-even, delivering alerts to multiple brokers and more.
//////
This script is a spin-off from my previous work, posted over a year ago here: Some comments on strategy parameters have been discussed there, but let me copy-paste most important points:
* Commission is taken into consideration.
* Slippage is intentionally left at 0. Due to shorter than 1 second delivery time of TradingConnector, slippage is practically non-existing.
* This strategy is NON-REPAINTING and uses NO TRAILING-STOP or any other feature known to be causing problems.
* The strategy was backtested on EURUSD 6h timeframe, will perform differently on other markets and timeframes.
Despite the fact this strategy seems to be still profitable, it is not guaranteed it will continue to perform well in the future. Remember the no.1 rule of backtesting - no matter how profitable and good looking a script is, it only tells about the past. There is zero guarantee the same strategy will get similar results in the future.
Full specs of TradingView alerts and how to set them up can be found here: www.tradingview.com
MomentumInvest TrendFollower [@TradersVenue]VSA CheatSheet - Have kept the chart clean and clear not by putting each signal pattern name. What matters is identifying the real price action than the pattern name. To keep the charts clutter free, haven't put the signal name under/above the candle.
Rejection or reversal patterns
Green Circle - Typical SellingClimax, Stopping Volume and Bag Holding signal patterns as per VSA. Strong price volume action but price rejection at lower level.
Red Circle - Typical Buying Climax, End Of Rising, Supply Overcoming Demand signal patterns as per VSA. Strong price volume action but price rejection at higher level.
Green Square - Typical bullish TrendReversal candle as per VSA. Bullish breakout bar immediately after a bearish breakout bar and engulfing the previous one or cover max part of it.
Red Square - Typical bearish TrendReversal candle as per VSA. Bearish breakout bar immediately after a bullish breakout bar and engulfing the previous one or cover max part of it.
Momentum breakout patterns
Blue/Green Star - Bullish breakouts. Downthrust bars with significant price volume action. Green if smaller low weak otherwise blue.
Red/Pink Star - Bearish breakouts. Downthrust bars with significant price volume action. Red if low higher weak else pink.
Candle Color
Green - Bullish with strong price action. Good to enter long towards close with SL of day low. System suggests quantity as per 2% trading rule. One can play with risk defined option strategies or cash segment as per quantity suggested.
Red - Bearish with strong price action. Good to enter short towards close with SL of day high. System suggests quantity as per 2% trading rule. One can play with risk defined option strategies like bear put spread or bear call spreads or go for hedged shorts.
Pink - Bearish with muted price action. Trail SL. Better to avoid trading these candles.
Light blue - Bullish with muted price action. Trail SL. Better to avoid trading these candles.
Plotted EMA Ribbon gives a sense of the strength of momentum. When each MA is placed with wide gaps momentum is strong. When there is EMA confluence, chances of trend strength are weakening. Background color of the chart green indicates bullishness in the underlying and red indicates that bearish pressure in the scrip. If the background color is green and you see one Blue/Green star candle it's good to go long. If the background color is red and you see one Red/Pink star candle it's good to go short.
A word of caution: Trading breakouts is very good. But you need to prepare for breakout failures. Here the system picks wide range bars for going long or short that means SL is wide probably 3% and above. Also if you notice after a strong PV breakout if price sustains below that it can see long unwinding pressure and simillary after a strong PV breakdown, if price sustains above the breakdown candle, chances of short covering is higher. Here money management and risk management becomes very important. Same has been included as part of the indicator to give you an optimal quantity for trade to keep the drawdowns lower. If you enable (1) RECO message and (2) Show Strategy (Else Study)? options then it shows a RECO box with quantity calculated as per 2% loss per trade rule. Lot of risk management, scale up/down for compounding is also available. You may try out those options one by one.
This indicator needs to be used along with the “VSA + Volume Oscillator ”, because this setup relies on VSA (Volume Spread Analysis). The overall usage will be provided through a demo to the subscribing users. In order to gain access to this indicator you may contact me using the below signature.
cRSI + Waves Strategy with VWMA overlayStrategy based on my cRSI with motive/corrective wave indicator. Please note that it is far from perfect. I use it mostly to help me identify good entry and exit points when combined with my other technical analysis. It misses some obvious points, but on average it does pretty well. The challenge often is indicating when you have sufficient change in the cRSI to know that the trend has changed, that means sometimes it can be a little early or late. It definitely helps take a lot of the guess work out of things. It works better on some equities than others and better on some time frames than others. You just have to play with it. At the minimum, it is a good template to learn how to write your own.
POW EdgeHello fellow Trading View member,
Eventually our rebranded update with some extra features for our exclusive 'Edge' Strategy Script.
In this description I will run through;
The strategy itself, what is it?
What does it do?
How does it work?
How can it help you?
How good is it?
What is it.....
The Edge Strategy itself is based upon 5 indicators lining up in total confluence to enter a position in line with a trending move. Adding them together adds more confluence and probability to each individual trade outcome over the longer term. The individual strategies used are based on Trend strategies all used in combination.
The uniqueness to this is how they are combined. Indicators can work to a point individually of course, but combining them together and only trading when all are in a line was our concept, whilst reviewing how each individual indicator can be optimised to work with the others.
Also the motivation was to be the right side of the market in a trending move and capitalising on as much as that move as possible.
The first part is to ensure the candle close is above or below our moving average, we can then check the state and validity of each of the other 4 indicators. Once this confluence is in alignment a trade is valid for entry - this has to be valid at the same time - but not all valid on the same candle - they will come into alignment in different stages. But once they are, our trade is valid.
I will not reveal the other individual 3 indicators but the other is also an ADX function to add a threshold into the strategy to identify a trend - usually above 20/25. This has upsides and downsides as any user can visualise and see in the testing.
We also add to the script to look for a Buy then Sell, Sell then Buy - we found this had more profitable results overall and next phase was to review the money management; where and how we placed our SL and when and why we exited the trade.
Example - for a BUY trade to be valid, all 5 indictors must meet their own criteria before a BUY is printed on the chart. Absolutely no technical analysis is needed to trade this strategy and the data we have is based on using the strategy in isolation - how you wish to use this either independently or supporting your own trading is of course, up to you.
The SL and TP's are based on ATR Multipliers thus ensuring we are factoring in market volatility at that time. We also have a FT (Follow Trend) option, which is a worthy addition for capitalising on big trending moves.
This strategy will work on all markets and timeframes.
We understand and accept that all pairs and markets are different thus we have optimised certain pairs and timeframes with different parameters to provide increased returns, these are hard coded (H1 Timeframe) and also provided for your review.
Profitability is easily viewable in the ‘Strategy Tester’ - this is a great tool. This is where you can see historic / live data for the strategy.
Data like;
The Net Profit
Number of trades
Win Percentage
Every trade taken
Average Win
Average Loss
Maximal DD , etc.
We have individually optimised each pair to ensure this is the case and hard coded these parameters into the strategy. All you need to do is flick between the pairs - the strategy will then identify the pair you are on and change the parameters to suit in the background.
Whilst a trade is open, the strategy will convert all candles to the relevant colour - Green for an uptrend and Red for a downtrend (all customisable).
We find this is helpful for traders psychology - not getting 'spooked' by other candle colours, affecting your decision making.
When a new signal is valid, 'POW BUY' or 'POW SELL' will be displayed on the first candle open for entry. As well as this, you will also have the trade label print which will display the following;
- EP – Entry price
- SL – Stop loss
- TP – Take Profit
- Lot size
The trade information printed will also tell you the pip values of your stop loss and take profit based on how far away they are from the trade entry price.
The lot size printed is customisable and unique to your account- within the strategy settings you can simply input your account balance, currency and risk approach which includes a fixed risk amount, fixed lot size or a fixed percentage.
This removes the need for 3rd party apps or websites to quickly calculate your specific risk on your trade. Thus saving you time and making sure you aren't 'guessing' with your lot size.
No one likes losing more than they thought.
The progress and initial challenges....
To start, our first version simply showed the buy and sell arrows when a trade was valid. However, this caused subjectivity with where we would place our stop loss and how we would manage the exit of the trade once we were in it. So, we identified a solid strategy for this was incorporating the Average True Range (ATR) for SL and TP options.
I was especially keen to add the SL and exit management so I could obtain solid back testing data to support my thoughts that 'this works'. Every trader requires confidence and belief in their strategy, without it you simply won't succeed or be disciplined in your execution.
The other challenge we all face is calculating the lot sizes of our trades right? So, it was important that we incorporated a lot size calculator - its all about making it easy when a trade is valid to enter without trying to calculate this accurately.
Lastly, when pairs are stuck in a range - this can be a testing period of 'chop' for a trend strategy, so we also incorporated the ADX function to enable us to set a threshold level to identify when the instrument is more likely to be trending.
What does it do?
Ultimately, tells you when to buy and sell - where to place your SL and when to exit. Whilst also ensuring your risk management is on point, by displaying your trading lot size. Also providing you with live back tested data at your finger tips thank you to the strategy tester.
How does it work?
This will be visible on your trading view charts once you get access. And will work across all your devices, the trading view website or the app on your phone for example.
You can also use Trading View alerts, so you won't miss a trade and can go about your day as normal without watching the screen. This will work on the Free version of TV, however, in order to benefit from more alerts and templates it makes sense to upgrade to a higher package.
How can it help you?
This will help give you a mechanical approach to your trading. This means, less decision making on your part, with the instant benefit of seeing the data you have at your fingertips thanks to the 'Strategy Tester' TV Function.
It will save you time, you don't need to be in front of your screen or completing any subjective analysis.
Integrated lot size calculator can ensure you are always accurate with your risk - either in percentage or a fixed amount of risk - whichever you prefer.
Understand Probability - this is the key one for me. Losing runs happen in any trading strategy. The great benefit here, is you can see them. How long were the losing runs? How can I prepare and plan my risk management around them are all fundamental keys to managing your emotions and being detached from your trades. No one wants to feel stressed or anxious when trading.
Customisable exit strategies - A specific TP for a 1:1 RR or 1:10 RR for example can be adjusted and you can see instantly how this affects the profitability.
The exit strategy options are shown below;
TP 1/2/3
FT - Follow Trend (no stop loss and follow's from Buys to Sells, Sell to Buy, etc.
SL + FT - SL present, but trade is held until a reverse signal is presented.
How good is it?
We have some really positive back testing data across a range of pairs and markets - equities and indices too.
Drop me a DM to see these and I'll be happy to share.
Below let me show you a screen shot of how this can work for you.
How do you access this?
Please visit our website for signup / purchase information in the first instance (the link is on our trading view signature) or send us a private message on here - its impossible to keep track of comments on our posts so to ensure we don't miss you, a private DM will be great please.
The Back test shown on this example is based on the Trading View mid price and also a realistic starting Capital of £10,000. This test result is also based on a 0.1% risk per trade, with a 5 tick spread and a commission of
Regards
Darren
Disclaimer alert.
Please remember past performance is exactly that - how our strategy performed over those dates tested, it is not obviously a guarantee of future performance. Most of our H1 data is valid from Jan 2017 to now - so 4+ years and data on 650+ trades per pair.
Combo Backtest 123 Reversal & Laguerre-based RSI This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
This is RSI indicator which is more sesitive to price changes.
It is based upon a modern math tool - Laguerre transform filter.
With help of Laguerre filter one becomes able to create superior
indicators using very short data lengths as well. The use of shorter
data lengths means you can make the indicators more responsive to
changes in the price.
WARNING:
- For purpose educate only
- This script to change bars colors.
Combo Backtest 123 Reversal & Signal To Noise This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
The signal-to-noise (S/N) ratio.
And Simple Moving Average.
WARNING:
- For purpose educate only
- This script to change bars colors.
XAU/USD RSI EMA 1hour strategyThis is a strategy made for gold 1h.
Its made of RSI and EMA .
The rules are simple we are above ema and the rsi > oversold area we enter long. For short we are belowe ema and rsi < oversold area
IF you have any questions private message me !
Strategy- Double Decker RSIThis Strategy was LIVE coded during a webinar conducted by the author on 16-Jan-21 titled Backtesting in Tradingview. The system is named " Double Decker RSI ".
The rules of this strategy are:
LONG - RSI(5)>70 and RSI(14)>50 -- EXIT: RSI(5)<55
SHORT - RSI(5)<40 and RSI(14)<50 -- EXIT: RSI(5)>45
Instrument - BANKNIFTY - 1 HR Chart
The code is open source for you to edit and make changes as needed. For details on the strategy and webinar, you can refer to the website in signature of this strategy.
Renovation-10 (Including 10 Traditional Indicators)This idea is not rare. It is just a combination of 10 most well know and traditional Indicators to form one renovated indicator. There are Moving Average (MA), Volume (V), Bollinger Band (BB), Relative Strength Index ( RSI ), Stochastic RSI, Modified Stochastic RSI, Moving Average Convergence Divergence ( MACD ), Average directional index ( ADX ), Average True Range (ATR) and Parabolic Stop and Reverse (PSAR). These indicators most I found was just showing entering position strategic alone. I just want to know how well them work together when combination. I modified many times and thinking for the strategic enter and exist position with the choice of these 10 indicators to maximize the profitability which shows in strategic tester in every stock and conditions.
THEORY:
Fluctuation of price is like a Wave which I categorized it into four period. They are Sideway, Breakout Positive and Negative, Retracement and Consolidation. Breakout is rare to happen, either go up or go down. After a breakout usually will have small retracement, then trend will go for sideway. After long period of sideway, the wave is starting to run out of energy and there will be consolidation period.
STRATEGIC OPTION:
S: Sideway Period
B: Breakout Period
R: Retracement Period
(+): Buy
(-): Sell
PROBLEM:
1. Not performing very well at very penny stock which the graph looks like barcode.
Suggesting can change daily graph to weekly graph to avoid.
2. Be careful with Sideway entry signal because sometimes price may continue go down. You will stuck at middle if you enter without confirmation.
Confirm the price is stable at support by current low is higher or equal to past three to five day low before entry.
3.Always remember Breakout is rare, do not push for luck
Always make profit at Sideway and Retracement trend. Can Sell half only at BB when breakout buying signal is available, to avoid losing chance of chasing breakout.
4. Breakout selling signal 2 may delay
After breakout, make sure sell all when 2-3 red candle appeared or When BB is squeezing.
5. Other tools may required to confirm entry position.
These combination strategic is more to personal experiences and knowledges, it hard to adjust in coding for strategic position.
This is my first publication and I just do it for fun, having fun in reading the script and creating own ideas.
Information provided is only educational and sharing , should not be used to take action in the markets.
B1rd's Bitcoin Dominance OscillatorA Bitcoin Dominance Oscillator.
*OPTIMAL SETTINGS HAVE YET TO BE DISCOVERED"
Best used on BTC pairs.
The moving line is called the initiator line
Usage is simple: When line turns green you buy alts with bitcoin, When the line turns red you sell alts for bitcoin.
Functions:
Select a wide range of MA's for your Bitcoin dominance source and your initiator line.
Seperately set your MA length's.
A customizable noise filter (Value 0 = off)
Full description:
This indicator calculates the difference between the BTC.D and the selected moving average of BTC.D.
The units on the right represent the % of the BTC.D it moves above or below the MA.
For the purpose of trading alts I have swapped the positive and negative values. So when BTC.D starts moving up, the initiator line should point down in the negative. When BTC.D starts moving down, the initiator line will point up in the positive.
JFRewards Indi Channel <Heikin> v4.0<>
SOP guidelines only given to JF members .
The ideas are:
1) Finding where to enter position of buying and sell.
2) Finding where is the realistic take profit target within 24 hours with maximum profits.
3) Finding Trailing STOP LOSS, Trailing Take Profit, Take Profit, STOP LOSS.
Fully tested with @Binance Exchanger with numerous of stablecoins and altcoins as well as BTC , ETH.
Performance cannot be shown due to non standard chart of Heikin Ashi.
Ultimate Oscillator [Long] StrategyAfter I published Short Selling strategy with RSIofUO , I have been working for Long side strategy with same indicator.
but for Long strategy , I have used only the Ultimate Oscillator ... (Not the RSI of UO)
Logic behind this is , when UO goes below oversold level , high chance of possible reversal from there ...
Ultimate Oscialltor values , I have used are 5, 10 and 15
Signal Line 9
Above values are best/defaulted based on testing the strategy multiple symbols
BUY
when UO crossing up buyLine and close > open ( if the cross over is already done , it will wait for 3 candles to see a green bar i.e close>open )
Note when the bar color changes to orange , that means startegy is ready to take LONG position on next bar. But dont jump here , waith for the startegy take the Long Position :-)
Add
Signal appears when there is divergence (marked in yellow color ) ... strategy doesnt add the position , it is ony indicating you could add to existing OR if you missed the BUY signal you could enter here
Partial Exit
when UO crossing down partial exit level
Exit
When UO crossing down sell line
StopLoss
stop loss defaulted to 3%
Please note , I have slightly modified stop loss exit in this strategy.
Even though price hits 3% stoploss , strategy wont wind up the position ...
First , it will check if RSIofUO is above 30 , then it will hold on to the Long position.
Very reason behind this is , price is falling down and UO is going up ... That means there is bullish divergence here .. so it might turn this losing position to profitable one or will exit you with less than 3% loss.
Tested with SPY , QQQ , TSLA on 30mins to 4hrs. Though winning rate is average , net profit is exponential ...
Best working on 30 mins and 1 HR chart for QQQ
Warning
For the eductional purposes only ...
This is not a financial advise , before taking trading decission please do your own research
scalping low lag tema etalCredit for original idea goes to 1 min forex scalping by mikegoryunov
Changes include several lower lag filters (See line 3 for a list)
and values for profit, loss, and trail_points (See lines 48:53)
a, b, & c represent fast, medium, and slow filters. Basic idea is to monitor
crossovers of the three filters to determine buy/sells. Exits occur quickly within
the next time interval.
Note that this may be used for stocks and forex. The time interval can vary widely.
I have concerns about how to incorporate transaction costs with so many transactions.
Momentum Strategy (BTC/USDT; 30m) - STOCH RSI (with source code)Here's a strategy for low time frames (30min suggested) for BTC , based on momentum Analysis using Stochastic RSI
By default the strategy will use the 50% of the specified capital for each trade; if "Gamble Sizing" is enabled, it will add the specified amount of capital (25% by default, until reaching the 100% limit or lower) for the next trade after having detected a loss in the previous trade; if the next trade is successful, the size for the next trade comes back to 50%
• Trend Filter LONG: If the fast exponential moving average is UNDER the slow exponential moving average , it won't open LONG positions
• Trend Filter SHORT: If the fast exponential moving average is ABOVE the slow exponential moving average , it won't open SHORT positions
• Bars delay: the strategy will wait the specified amount of bars before closing the current position; the counter is triggered as soon as the closing trade condition is verified
BY MAKING USE OF THIS STRATEGY, YOU ACKNOWLEDGE AND AGREE THAT: (1) YOU ARE AWARE OF THE RISKS ASSOCIATED WITH TRANSACTIONS OF DIGITAL CURRENCIES AND THEIR DERIVATIVES; (2) YOU SHALL ASSUME ALL RISKS RELATED TO THE USE OF THIS STRATEGY AND TRANSACTIONS OF DIGITAL CURRENCIES AND THEIR DERIVATIVES; AND (3) I SHALL NOT BE LIABLE FOR ANY SUCH RISKS OR ADVERSE OUTCOMES.
SOURCE CODE BELOW
Backtest Signal To Noise This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
© HPotter 05/01/2021
The signal-to-noise (S/N) ratio.
And Simple Moving Average.
Thank you for idea BlockchainYahoo
WARNING:
- For purpose educate only
- This script to change bars colors.
RSI EMA SMA StratThis script looks at the RSI EMA and RSI SMA crossovers when above a certain price EMA
It was mainly written for swingtrading and only for long positions on a daily timeframe for BTC and ETH. They idea is to have a script that indicates when to convert your BTC /ETC to a stable coin and when to buy in again.
You could try to use it for other positions (short, long, etc..) and other coins but I didn't test these.
When the RSI EMA & SMA hover around 50 for a few days in flat lines and you get a buy signal it may be best to wait a few days longer to see what direction they take.
The default values for RSI EMA , RSI SMA and price EMA gave the best return (start out with an amount of x coins in 2015 and end up with the biggest possible amount of coins today). Again, this was only tested on daily. Feel free to tweak these when using other timeframes or other coins
CHOP Zone Entry Strategy + DMI/PSAR ExitThis is a Strategy with associated visual indicators and Long/Short and Reverse/Close Position Alerts for the Choppiness Index (CHOP) . It is used to determine if the market is choppy (trading sideways) or not choppy (trading within a trend in either direction). CHOP is not directional, so a DMI script was ported into this strategy to allow for trend confirmation and direction determination; it consists of an Average Directional Index (ADX) , Plus Directional Indicator (+DI) and Minus Directional Indicator (-DI) . In addition, a Parabolic SAR is also included to act as a trailing stop during any strong trends.
Development Notes
---------------------------
This indicator, and most of the descriptions below, were derived largely from the TradingView reference manual. Feedback and suggestions for improvement are more than welcome, as well are recommended Input settings and best practices for use.
www.tradingview.com
www.tradingview.com
www.tradingview.com
Recommend using the below DMI and PSAR indicators in conjunction with this script to fully visualize and understand how entry and exit conditions are chosen. Variable inputs should correlate between the scripts for uniformity and visual compatibility.
THANKS to LazyBear and his Momentum Squeeze script for helping me quickly develop a momentum state model for coloring the Chop line by trend.
Strategy Description
---------------------------
CHOP produces values that determine whether the market is choppy or trending . The closer the value is to 100 , the higher the choppiness levels , while the closer it is to 0 , the stronger the market is trending . Territories for both levels, and their associated upper and lower thresholds, are popularly defined using the Fibonacci Retracements, 61.8 and 38.2.
Basic Use
---------------------------
CHOP is often used to confirm the market condition to help you stay out of sideways markets and only enter when there is movement or imminent explosions. When readings are above the upper threshold, continued sideways movement may be expected, while readings below the lower threshold are typically indicative of a continuing trend. It is also used to anticipate upcoming trendiness changes, with the general belief that extended periods of consolidation (sideways movement) are followed by extended periods of strong, trending, directional movement, and vice versa.
One limitation in this index is that you must be cautious in deciding whether the range or trend will likely continue, or if it will reverse.
Confidence in price action and trend is higher when two or more indicators are in agreement -- while this strategy combines CHOP with both DMI and PSAR, we would still recommend pairing with other indicators to determine entry or exit trade opportunities.
Recommend also choosing 'Once Per Bar Close' when creating alerts.
Inputs
---------------------------
Strategy Direction - an option to only trade Short, Long, Both, or only in the direction of the Trend (Follow Trend is the Default).
Sensitivity - an incremental variable to test whether the past n candles are in the same trend state before triggering a delayed long or short alert (1 is the Default). Can help filter out noise and reduces active alerts.
Show Chop Index - two visual styles are provided for user preference, a visible Chop line with a background overlay, or a compact column and label only view.
Chop Lookback Period - the time period to be used in calculating CHOP (14 is the Default).
Chop Offset - changing this number will move the CHOP either forwards or backwards relative to the current market (0 is the Default).
Smooth Chop Line and Length - if enabled, the entered time period will be used in calculating a smooth average of the index (Enabled and 4 are the Defaults).
Color Line to Trend Direction - toggles whether the index line is colored to visually depict the current trend direction (Enabled is the Default).
Color Background - toggles the visibility of a background color based on the index state (Enabled is the Default).
Enable DMI Option - if enabled, then entry will be confirmed by and dependent on the ADX Key Level, with any close or reversal confirmed by both ADX and +/-DI to determine whether there is a strong trend present or not (Enabled is the Default).
ADX Smoothing - the time period to be used in calculating the ADX which has a smoothing component (14 is the Default).
DI Length - the time period to be used in calculating the DI (14 is the Default).
ADX Key Level - any trade with the ADX above the key level is a strong indicator that it is trending (23 to 25 is the suggested setting).
Enable PSAR Option - enables trailing stop loss orders (Enabled is the Default).
PSAR Start - the starting value for the Acceleration Force (0.015 is our chosen Default, 0.02 is more common).
PSAR Increment - the increment in which the Acceleration Force will move (0.001 is our chosen Default, 0.02 is more common).
PSAR Max Value - the maximum value of the Acceleration Factor (0.2 is the Default).
Color Candles Option - an option to transpose the CHOP condition levels to the main candle bars. Note that the outer red and green border will still be distinguished by whether each individual candle is bearish or bullish during the specified timeframe.
Note too that if both DMI and PSAR are deselected, then close determinations will default to a CHOP reversal strategy (e.g., close long when below 38.2 and close short when above 61.8). Though if either DMI or PSAR are enabled, then the CHOP reversal for close determination will automatically be disabled.
Indicator Visuals
---------------------------
For the candle colors, black indicates tight chop (45 to 55), yellow is loose chop (38.2 to 45 and 55 to 61.8), dark purple is trending down (< 38.2), and dark blue is trending up (> 61.8).
The background color has additional shades to differentiate a wider range of more levels…
• < 30 is dark purple
• 30 to 38.2 is purple
• 38.2 to 45 is light purple
• 45 to 55 is black
• 55 to 61.8 is light blue
• 61.8 to 70 is blue
• > 70 is dark blue
Long, Short, Close, and Reverse labels are plotted on the Chop line, which itself can be colored based on the trend. The chop line can also be hidden for a clean and compact, columnar view, which is my preferred option (see example image below).
Visual cues are intended to improve analysis and decrease interpretation time during trading, as well as to aid in understanding the purpose of this strategy and how its inclusion can benefit a comprehensive trading plan.
DMI and Trend Strength
---------------------------
To analyze trend strength, the focus should be on the ADX line and not the +DI or -DI lines. An ADX reading above 25 indicates a strong trend , while a reading below 20 indicates a weak or non-existent trend . A reading between those two values would be considered indeterminable. Though what is truly a strong trend or a weak trend depends on the financial instrument being examined; historical analysis can assist in determining appropriate values.
DMI exits trade when ADX is below the user selected key level (e.g., default is 25) and when the +/- DI lines cross (e.g., -DI > +DI exits long position and +DI > -DI exits short position).
PSAR and Trailing Stop
---------------------------
PSAR is a time and price based indicator that excels at measuring direction and duration, though not the actual strength of a trend, which is why we use this in conjunction with DMI. It is also included in this script as a trailing stop option to maximize gains during strong trends and to mitigate any false ADX strengthening signals.
This creates a parabola that is located below the candle during a Bullish trend and above during a Bearish trend. A buy or reversal is signaled when the price crosses above or below the Parabolic SAR.
Long/Short Entry
---------------------------
1. CHOP must be over 61.8 (long) or under 38.2 (short).
2. If DMI is enabled, then the ADX signal line must be above the user selected Key Level (default is 25).
3. If Sensitivity is selected, then that past candle must meet the criteria in step 1, as well as all the intermediate candles in between.
4. If "Follow Trend" is selected and PSAR is enabled, then a long position can only open when the momentum and PSAR are in an uptrend, or short when both are in a downtrend, to include all intermediate candles if the Sensitivity option is set on a past candle.
Close/Reverse
---------------------------
1. If DMI is enabled, then a close flag will be raised when the ADX signal drops below the Key Level (of 25), and -DI crosses over +DI (if long), or +DI crosses over -DI (if short).
2. If PSAR is enabled, then a close flag will be raised when the current trend state is opposite the last state.
3. If both DMI and PSAR are disabled, then a close flag will be raised if the Chop line drops under 38.2 (if long) or goes over 61.8 (if short).
4. If a Long or Short Entry is triggered on the same candle as any of the above close flags, then the position will be reversed, else the position will be closed.
Strategy Alerts
---------------------------
1. Long Entry
2. Short Entry
3. Reverse
4. Close
The provided backtest result is based on a position sizing of 10% equity with 100k initial capital. When testing SPX, disabling the DMI performed the best, but EURUSD performed poorly without it enabled, and TSLA had a small reduction in net profit. Timeframe likewise differed between commodities with TSLA performing best at 30M, SPX at 15M, and EURUSD at 4H. I do not plan on using this as a standalone strategy, but I also was expecting better results with the inclusion of EMI and PSAR to compliment the CHOP. Key elements of this script will likely be included in future, more holistic strategies.
Disclaimer
---------------------------
Past performance may not be indicative of future results. Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting. This post and the script are not intended to provide any financial advice. Trade at your own risk.
No known repainting, though there may be if an offset is introduced in the Inputs. I did my best not to code any other variables that repaint, but cannot fully attest to this fact.
EURUSD DinhChienFX's signal V4.0Risk/reward: 1/1.3 | Entry by: Upper/Lower | Keltner crossing: 2 | Candle not entry: 80% | Stochastic: 70/15 | Adx: 31/9/9 | Notrade friday
Max risk: 3% - Risk / reward: 1 / 1.3.
1. Trend identification:
... Keltner: Price Through Upper / Lower 1 gives 1 point. 2 points are eligible for entry.
... Stochastic:
...... k> 70: Uptrend. k <15: Down trend.
... ADX: 31 provides strong trend following signal.
2. Entry point:
... Price corrects to Upper / Lower when 3 conditions Keltner , Stochastic & ADX indicator meet.
3. Not trade friday.
-------------
"Use the link below to obtain access to this indicator" or "PM us to obtain access"
Maximized Moving Average Crossing (by Coinrule)Using the crossings of two Moving Averages to trade in a trading strategy is a Trend-Following approach. As the name would suggest, to be successful, it requires the asset to be on-trend.
The general limit of a common strategy based on Moving Averages is that they underperform when the market is less volatile or trading sideways. When volatility compresses, the indicators get very close one to another, crossing each other very often. That's exactly the condition when trend-following strategies underperform.
To improve this strategy, it's useful to filter the buy signal using the RSI. When the RSI is close to overbought conditions, that means that the coin is likely trading in an uptrend. Strong uptrends usually come with RSI values that stay overbought for long periods, creating interesting opportunities.
Setup
Buy condition: the MA9 crosses above the MA50, and at the same time, the RSI has a value greater than 55.
Sell condition: the MA9 crosses below the MA50.
The strategy is optimized to provide better results on the 1-hr time frame, but it could work well also on higher time frames, such as the 4-hrs.
The strategy assumes each order to trade 30% of the available capital and opens a trade at a time. A trading fee of 0.1% is taken into account.