CCI+EMA Strategy with Percentage or ATR TP/SL [Alifer]This is a momentum strategy based on the Commodity Channel Index (CCI), with the aim of entering long trades in oversold conditions and short trades in overbought conditions.
Optionally, you can enable an Exponential Moving Average (EMA) to only allow trading in the direction of the larger trend. Please note that the strategy will not plot the EMA. If you want, for visual confirmation, you can add to the chart an Exponential Moving Average as a second indicator, with the same settings used in the strategy’s built-in EMA.
The strategy also allows you to set internal Stop Loss and Take Profit levels, with the option to choose between Percentage-based TP/SL or ATR-based TP/SL.
The strategy can be adapted to multiple assets and timeframes:
Pick an asset and a timeframe
Zoom back as far as possible to identify meaningful positive and negative peaks of the CCI
Set Overbought and Oversold at a rough average of the peaks you identified
Adjust TP/SL according to your risk management strategy
Like the strategy? Give it a boost!
Have any questions? Leave a comment or drop me a message.
CAUTIONARY WARNING
Please note that this is a complex trading strategy that involves several inputs and conditions. Before using it in live trading, it is highly recommended to thoroughly test it on historical data and use risk management techniques to safeguard your capital. After backtesting, it's also highly recommended to perform a first live test with a small amount. Additionally, it's essential to have a good understanding of the strategy's behavior and potential risks. Only risk what you can afford to lose .
USED INDICATORS
1 — COMMODITY CHANNEL INDEX (CCI)
The Commodity Channel Index (CCI) is a technical analysis indicator used to measure the momentum of an asset. It was developed by Donald Lambert and first published in Commodities magazine (now Futures) in 1980. Despite its name, the CCI can be used in any market and is not just for commodities. The CCI compares current price to average price over a specific time period. The indicator fluctuates above or below zero, moving into positive or negative territory. While most values, approximately 75%, fall between -100 and +100, about 25% of the values fall outside this range, indicating a lot of weakness or strength in the price movement.
The CCI was originally developed to spot long-term trend changes but has been adapted by traders for use on all markets or timeframes. Trading with multiple timeframes provides more buy or sell signals for active traders. Traders often use the CCI on the longer-term chart to establish the dominant trend and on the shorter-term chart to isolate pullbacks and generate trade signals.
CCI is calculated with the following formula:
(Typical Price - Simple Moving Average) / (0.015 x Mean Deviation)
Some trading strategies based on CCI can produce multiple false signals or losing trades when conditions turn choppy. Implementing a stop-loss strategy can help cap risk, and testing the CCI strategy for profitability on your market and timeframe is a worthy first step before initiating trades.
2 — AVERAGE TRUE RANGE (ATR)
The Average True Range (ATR) is a technical analysis indicator that measures market volatility by calculating the average range of price movements in a financial asset over a specific period of time. The ATR was developed by J. Welles Wilder Jr. and introduced in his book “New Concepts in Technical Trading Systems” in 1978.
The ATR is calculated by taking the average of the true range over a specified period. The true range is the greatest of the following:
The difference between the current high and the current low.
The difference between the previous close and the current high.
The difference between the previous close and the current low.
The ATR can be used to set stop-loss orders. One way to use ATR for stop-loss orders is to multiply the ATR by a factor (such as 2 or 3) and subtract it from the entry price for long positions or add it to the entry price for short positions. This can help traders set stop-loss orders that are more adaptive to market volatility.
3 — EXPONENTIAL MOVING AVERAGE (EMA)
The Exponential Moving Average (EMA) is a type of moving average (MA) that places a greater weight and significance on the most recent data points.
The EMA is calculated by taking the average of the true range over a specified period. The true range is the greatest of the following:
The difference between the current high and the current low.
The difference between the previous close and the current high.
The difference between the previous close and the current low.
The EMA can be used by traders to produce buy and sell signals based on crossovers and divergences from the historical average. Traders often use several different EMA lengths, such as 10-day, 50-day, and 200-day moving averages.
The formula for calculating EMA is as follows:
Compute the Simple Moving Average (SMA).
Calculate the multiplier for weighting the EMA.
Calculate the current EMA using the following formula:
EMA = Closing price x multiplier + EMA (previous day) x (1-multiplier)
STRATEGY EXPLANATION
1 — INPUTS AND PARAMETERS
The strategy uses the Commodity Channel Index (CCI) with additional options for an Exponential Moving Average (EMA), Take Profit (TP) and Stop Loss (SL).
length : The period length for the CCI calculation.
overbought : The overbought level for the CCI. When CCI crosses above this level, it may signal a potential short entry.
oversold : The oversold level for the CCI. When CCI crosses below this level, it may signal a potential long entry.
useEMA : A boolean input to enable or disable the use of Exponential Moving Average (EMA) as a filter for long and short entries.
emaLength : The period length for the EMA if it is used.
2 — CCI CALCULATION
The CCI indicator is calculated using the following formula:
(src - ma) / (0.015 * ta.dev(src, length))
src is the typical price (average of high, low, and close) and ma is the Simple Moving Average (SMA) of src over the specified length.
3 — EMA CALCULATION
If the useEMA option is enabled, an EMA is calculated with the given emaLength .
4 — TAKE PROFIT AND STOP LOSS METHODS
The strategy offers two methods for TP and SL calculations: percentage-based and ATR-based.
tpSlMethod_percentage : A boolean input to choose the percentage-based method.
tpSlMethod_atr : A boolean input to choose the ATR-based method.
5 — PERCENTAGE-BASED TP AND SL
If tpSlMethod_percentage is chosen, the strategy calculates the TP and SL levels based on a percentage of the average entry price.
tp_percentage : The percentage value for Take Profit.
sl_percentage : The percentage value for Stop Loss.
6 — ATR-BASED TP AND SL
If tpSlMethod_atr is chosen, the strategy calculates the TP and SL levels based on Average True Range (ATR).
atrLength : The period length for the ATR calculation.
atrMultiplier : A multiplier applied to the ATR to set the SL level.
riskRewardRatio : The risk-reward ratio used to calculate the TP level.
7 — ENTRY CONDITIONS
The strategy defines two conditions for entering long and short positions based on CCI and, optionally, EMA.
Long Entry: CCI crosses below the oversold level, and if useEMA is enabled, the closing price should be above the EMA.
Short Entry: CCI crosses above the overbought level, and if useEMA is enabled, the closing price should be below the EMA.
8 — TP AND SL LEVELS
The strategy calculates the TP and SL levels based on the chosen method and updates them dynamically.
For the percentage-based method, the TP and SL levels are calculated as a percentage of the average entry price.
For the ATR-based method, the TP and SL levels are calculated using the ATR value and the specified multipliers.
9 — EXIT CONDITIONS
The strategy defines exit conditions for both long and short positions.
If there is a long position, it will be closed either at TP or SL levels based on the chosen method.
If there is a short position, it will be closed either at TP or SL levels based on the chosen method.
Additionally, positions will be closed if CCI crosses back above oversold in long positions or below overbought in short positions.
10 — PLOTTING
The script plots the CCI line along with overbought and oversold levels as horizontal lines.
The CCI line is colored red when above the overbought level, green when below the oversold level, and white otherwise.
The shaded region between the overbought and oversold levels is plotted as well.
Tp
Pip CrosshairsThis is a simple tool designed to help you visualize your stop loss and take profit levels before entering a trade. The tool plots two lines on the chart - a green dotted line for take profit and a red dotted line for stop loss (similar to the price line) - with a simulated default spread of one pip factored in. The indicator has the option to toggle between long and short positions.
Please note that the spread used in the tool is not based on your actual spread and should be adjusted accordingly. As, to the best of my knowledge Pine Script does not have the ability to automatically include spread in an indicator, so you will need to input your spread manually. (if you can please let me know cause that would be a game changer).
Overall, should help save you a bit of time by not having to manually measure stop loss and take profit levels for each trade.
Happy hunting :)
LevelsManagerLibrary "LevelsManager"
TODO: Track up to 6 TakeProfits and 1 StopLoss achievement for one or many of your buy/sell conditions.
manageTrade(bool, bool, bool, string, string, float, float, bool, bool, bool, bool, bool, bool, float, float, float, float, float, float, float)
Track TakeProfits and StopLoss achievement for one or many of your buy/sell conditions. CHECK the commented section: "Function @manageTrade" for Description
Parameters:
bool : useSignal.
bool : b_gameOVer.
bool : b_gameOVer.
string : bName.
string : sName.
float : buyEntrySource.
float : sellEntrySource.
bool : useTp1.
bool : useTp2.
bool : useTp3.
bool : useTp4.
bool : useTp5.
bool : useTp6.
float : tp1x.
float : tp2x.
float : tp3x.
float : tp4x.
float : tp5x.
float : tp6x.
float : slx.
Returns: check commented section: "Function @manageTrade".
showOnlyFirstOccurence(booleanInput)
Single out the occurence of a bool series between to 2 bool series.
Parameters:
booleanInput : to activate or deactivate occurences filtering.
Returns: filterred or not bool series.
ATR MultiplierOVERVIEW
The Average True Range Multiplier (ATRX) is a simple technical indicator that takes the value of the ATR indicator and multiplies it by a user-specified amount.
CONCEPTS
This indicator is primarily used to set key levels based on historical volatility. The ATR indicator alone measures the historical volatility of the selected instrument, this indicator just multiplies that value to save the hassle of doing that yourself.
BTCUSDTPERP MEGABOT 60min [ALERTS VERSION]BINANCE:BTCUSDTPERP
Hello, this is my alerts version of BTCUSDTPERP MEGABOT 60min
THIS BOT IS ONLY FOR BTCUSDTPERP ON BINANCEFUTURES !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
This configs are only for this pair on this market,
It depends of volume , and others indicator
Bot is making amazing results at configs
TP - 4.5%
SL - 7%
Strategy using 4 indicators :
ADX
RSI
VOLUME
MACD
ADX - makes a solid view to trend without any scam wick :
Long only on green bars
Shorts only on red bars
That's helps my strategy to define a right trend
there is also a orange option for unidentified trends
RSI - value helps strategy to stop trade in right time
When RSI is overbought strategy don't open new longs
also when RSI is oversold strategy don't open new shorts
Volume - volume is the most important indicator for the strategy,
to avoid open trades on flat chart, new trades are open after a strong volume
wicks
MACD - this indicator is for define the trend
So the way this bot is working is simple
when every arguments are confirmed , then strategy open trades
Enjoy !!!
SEMA-XSEMA-X (sema cross)
It's a simple EMA cross strategy
Rules of strategy
1. 2 EMA crossing
2. Long (Golden Cross), Short (Dead Cross)
3. Target profit, stop loss setting
You can also get big trend gains if you set a long target price.
* * *
SEMA-X (세마크로스)
간단한 EMA 교차 전략 입니다.
전략의 규칙
1. 2개의 EMA 교차
2. 매수(골든 크로스), 매도(데드 크로스)
3. 목표가, 손절가 설정
목표가를 길게 설정하면 큰 추세 이익도 얻을 수 있습니다.
Investment Protector - A Rule of Thumb V1The Flash Crash of September 8 showed once more how many are falling to greed. On top of it one also add leverage to long positions. It's just insane the risk people are taking. Anyhow, for all my noobies and friends here is a very very simple indicator that shows when NOT to buy nor increase positions and when there is window of opportunities.
A few remarks:
This script does NOT provide trading signals
Merely points out windows of opportunities - candles with green background. You still need to find the entry in this area yourself. Apply geomeric Technical Analysis, use indicators or divergences.
Windows of opportunities can still go south, use the stop-loss! (and check for bearish divergence)
The script urges you NOT to trade below ema200 of the 4h timeframe, which is marked with a red background (the most smooh timeframe there is).
Push yourself to take profits. It is marked with on the cancles to support you. Yes, it could always go higher, but try to avoid to be in a crash (and again, use a stop-loss at all time. You can make it a generous one if you want, fine. As long as you have one.).
TA speaking:
The scripts uses EMA and RSI only.
Bearish divergence will be added in V2.
disclaimer: yes, not financial advise. It's educational.
Scalping using RSI 2 indicator with TP and TSLThis study implements a simply scalping using the RSI (calculated on two periods), the slopes of two MAs (EMA or SMA) having different lengths (by default, I use 50 and 200).
A take profit (%) and a trailing stop loss (%) are used.
Entry conditions:
.) Fast MA > Slow MA and Price > Slow MA and RSI < Oversold Threshold ------> go Long
.) Fast MA < Slow MA and Price < Slow MA and RSI > Overbought Threshold ------> go Short
Exit conditions:
.) Long entry condition is true and (close >= TP or close <= TSL) ----> close short position
.) Short entry condition is true and (close <= TP or close >= TSL) ----> close long position
The strategy performed best on Bitcoin and the most liquid and capitalized Altcoins but works excellent on volatile assets, mainly if they often go trending.
Works best on 3h - 4h time frame.
There's also an optional Volatility filter, which opens the position only if the difference between the two slopes is more than a specific value, which can be set in the study inputs. The purpose is not opening positions if the price goes sideways and the noise is way > than the signal.
Note:
.) the RSI length is 2;
.) the oversold Threshold is 90%;
.) the overbought Threshold is 10%;
.) by default, the take profit per cent is 0.5%;
.) by default, the trailing stop loss per cent is 0.5%;
.) by default, the fast MA length is 50;
.) by default, the slow MA length is 200;
.) by default, the MA used is EMA.
Cheers.
Koala System EURUSD 15minToday I bring you one of the best systems I have found for 15min chart for EURUSD, can be adapted to other pairs aswell I suppose.
Its made of 4 SMA 3 6 9 50 and EMA 200.
It only makes 1 trade per day, in this case we have a risk % of our total eqquity, being the min 0.1 lots , can be changed tho .
We target TP/SL the same 1:1 rr, in this case I use 30 pips for both., that means I risk maximum 30$ out of a total of 1000 equity , per each trade , with 3%
Entry is simple : price is below all movings averages for sell or above for buy. At the same time we check that the ma's are in ascending or descending order.
The key here is patience, never make more than one trade per day.
System always close the trade at the end of london session. Also it only works, during the london session.
Enjoy it.
Simple and efficient 1h strategyThis strategy is made from a crossover of 2 ema : 4 and 8 in this case, together with a RSI of lenght 10 applied to hl2
The strategy is simple : we enter when we have a cross between the 2 ma's and rsi at the same time is in ascending or descending position crossing the middle line of 50.
For exit we have : at the end of a session( we trade only between london and newyork in this case, so we exit newyork), or through a tp/sl pip point system.
Hope you enjoy it.
Daytrade strategy RSI CCI EMA 4/8This strategy is designed for daytrade charts.
Its made from
EMA 4 / EMA 8 to check for crosses
RSI levels for overbough/oversold
CCI levels
For entry, we check first if the ema 4 crossed ema 8
Secondly we confirm by checking the level of RSI level
Finally we confirm with CCI level
If all of them are on the same page we enter.
For exit we have a fixed pip points system for TP/SL
MA * Fibo levels (canal)Some updates to the scrypt "MA * Fibo levels (auto)"
In the previous scrypt we drew lines using either highs or lows of the candles due to the positiveness or negativeness of given percentages.
But, after some research it seems easier to use CANALS to buy or sell rather than LINES. So these canals are the intervals between SMA(highs) and SMA(lows) multiplied by FIBO coefficients. However, lines can be also used as stop-losses if the price goes out of the canal, and wait until the price reaches the other canal.
Good luck in trading!
If the scrypt was useful let me know!
Any feedbacks and ideas are welcomed!
Percent Trailing Stop (%) - For Study Scripts===========
Percent Trailing Stop (%) - { FOR STUDY SCRIPTS }
===========
Wow - this is an example of how to implement Alerts relating to a Trailing Stop (%) within your Study Script. It's taken a bit of effort to get this working but I think we got there!
Alerts include Open Long/Short, Trailing Stop Hit, and (the most important one) Movement of Trailing Stop! <- this is actually really quite good, by the way! :)
You can ignore the actual entry/exit orders - they're based on a simple MA cross and are therefore NOT relevant, NOT profitable and NOT recommended!
You should be using this code as a way of adding a Trailing Stop to your own scripts - hope it helps!
Set your "Open Long/Short" Alert to "Once per Bar Close" - Set your "Trailing Stop Hit" Alert to "Once per Bar" - Set your "Move TSL" Alert to "Once per Bar Close". - You're all done! Enjoy.
-----------
Good Luck and Happy Trading!
MA * Fibo levels (auto)A few updates to the previous post.
In order to catch more exact points of TP and SL, the scrypt takes "high" as the source of SMA if the percentage is greater than 0 ( > 0), and "low" as the source when the given percentage is less than 0 ( < 0).
So there are two basic SMA line ( one with "high", the other one with "low"), and the other lines would be results of multiplying either the higher base or the lower one.
Good luck in trading!
If the scrypt was useful let me know!
Any feedbacks and ideas are welcomed!
Fixed Percent Stop Loss & Take Profit %===========
Fixed Percent Stop Loss & Take Profit %
===========
A neat example of how to set up Fixed Stops and Take Profit as a percent of the entry price.
Yup, that's about it!
You can ignore the actual entry/exit orders - they're based on a simple MA cross and are therefore NOT relevant, NOT really profitable and NOT recommended!
You should be using this code as a way of adding Stops and Takes to your own scripts - hope it helps!
-----------
Good Luck and Happy Trading!