JerrySmart EMA AlgoThis strategy i hope to use it long term and make me money. It is used based on ema and volume it was created using AI i do not know if it will work but it looks promising. Lets see what happens
Göstergeler ve stratejiler
Trend-Following Strategy for NIFTY or BANK NIFTY//@version=5
strategy("Trend-Following Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=5)
// Input Parameters
macd_fast_length = input(12, title="MACD Fast Length")
macd_slow_length = input(26, title="MACD Slow Length")
macd_signal_length = input(9, title="MACD Signal Length")
sma_length = input(200, title="SMA Length")
atr_length = input(14, title="ATR Length")
atr_multiplier = input(1.5, title="ATR Stop Loss Multiplier")
// Calculate Indicators
= ta.macd(close, macd_fast_length, macd_slow_length, macd_signal_length)
sma = ta.sma(close, sma_length)
atr = ta.atr(atr_length)
// Define Conditions
longCondition = ta.crossover(macdLine, signalLine) and close > sma
shortCondition = ta.crossunder(macdLine, signalLine) and close < sma
// Stop Loss and Take Profit
longStopLoss = close - atr * atr_multiplier
shortStopLoss = close + atr * atr_multiplier
// Execute Trades
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Long Exit", from_entry="Long", stop=longStopLoss)
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Short Exit", from_entry="Short", stop=shortStopLoss)
// Plot Indicators
plot(sma, color=color.blue, linewidth=2, title="200 SMA")
hline(0, "Zero Line", color=color.gray)
plot(macdLine, color=color.green, title="MACD Line")
plot(signalLine, color=color.red, title="Signal Line")
OBV Crossover SignalsPlacing a 20 EMA on the on balance volume indicator and adding arrows. When OBV crosses above the 20 EMA adds a green bullish candle to the indicator. When OBV crosses below the 20 EMA this adds a red bearish candle to the indicator. I use this in conjunction with another indicator I've programmed to add arrows to the price chart when price closes above or below the 20 EMA. When you have bullish arrows on both indicators, this is when to take bullish swing trades. When you have bearish arrows on both indicators, either stay away (if you're a bull) or its a time to take a bearish swing trade.
Swing Strategy - XAUUSD (50-Point Stop Loss)a strategy in which you enter in change in trend with a stoploss of 50 points and targets of 200-400 points. that means 4:1 to 8:1 strategy.
Bollinger Bands StrategyTrading anhand der Bollinger Bänder:
Pine Skript erstellt und eingefügt:
Kaufbedingung: Wenn der Preis das untere Band von unten nach oben kreuzt.
Verkaufbedingung: Wenn der Preis das obere Band von oben nach unten kreuzt.
My strategy{ "secret": "eyJhbGciOiJIUzI1NiJ9.eyJzaWduYWxzX3NvdXJjZV9pZCI6MTA1NTM1fQ.LjhZON_V472svSJ-DYbE8zFstu01THnQ5pOiaFixEEY", "max_lag": "300", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "action": "{{strategy.order.action}}", "bot_uuid": "1eb94d98-de6e-4a1c-810c-edfc0a713306", "strategy_info": { "market_position": "{{strategy.market_position}}", "market_position_size": "{{strategy.market_position_size}}", "prev_market_position": "{{strategy.prev_market_position}}", "prev_market_position_size": "{{strategy.prev_market_position_size}}" }, "order": { "amount": "{{strategy.order.contracts}}", "currency_type": "base" }}
Mean Reversion Strategy//@version=5
strategy("Mean Reversion Strategy", overlay=true)
// User Inputs
length = input.int(20, title="SMA Length") // Moving Average length
stdDev = input.float(2.0, title="Standard Deviation Multiplier") // Bollinger Band deviation
rsiLength = input.int(14, title="RSI Length") // RSI calculation length
rsiOverbought = input.int(70, title="RSI Overbought Level") // RSI overbought threshold
rsiOversold = input.int(30, title="RSI Oversold Level") // RSI oversold threshold
// Bollinger Bands
sma = ta.sma(close, length) // Calculate the SMA
stdDevValue = ta.stdev(close, length) // Calculate Standard Deviation
upperBand = sma + stdDev * stdDevValue // Upper Bollinger Band
lowerBand = sma - stdDev * stdDevValue // Lower Bollinger Band
// RSI
rsi = ta.rsi(close, rsiLength) // Calculate RSI
// Plot Bollinger Bands
plot(sma, color=color.orange, title="SMA") // Plot SMA
plot(upperBand, color=color.red, title="Upper Bollinger Band") // Plot Upper Band
plot(lowerBand, color=color.green, title="Lower Bollinger Band") // Plot Lower Band
// Plot RSI Levels (Optional)
hline(rsiOverbought, "Overbought Level", color=color.red, linestyle=hline.style_dotted)
hline(rsiOversold, "Oversold Level", color=color.green, linestyle=hline.style_dotted)
// Buy and Sell Conditions
buyCondition = (close < lowerBand) and (rsi < rsiOversold) // Price below Lower Band and RSI Oversold
sellCondition = (close > upperBand) and (rsi > rsiOverbought) // Price above Upper Band and RSI Overbought
// Execute Strategy
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.entry("Sell", strategy.short)
// Optional: Plot Buy/Sell Signals
plotshape(series=buyCondition, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal")
plotshape(series=sellCondition, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal")
Adaptive VWAP Bands with Garman Klass VolatilityThis strategy utilizes the volume weighted average price, adjusted by volatility. Standard deviation bands are applied to the MA, if price closes above 1STD this indicates a bullish trend and the strategy goes long. If a close below 1STD the long is closed.
The standard deviation bands are adjusted by volatility using the Garman-Klass volatility formula: portfolioslab.com
The assumption is the more volatile an asset the less price is being accepted in a certain price range and thus the threshold to go long or close a long increases. In the inverse, the less volatile an asset is the more it's being accepted, then the threshold for a bullish breakout is lowered.
cá nhân//@version=5
strategy("Demo GPT - Supertrend", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, slippage=3)
// Inputs
Periods = input.int(10, title="ATR Period")
src = input.source(hl2, title="Source")
Multiplier = input.float(3.0, title="ATR Multiplier", step=0.1)
changeATR = input.bool(true, title="Change ATR Calculation Method ?")
showSignals = input.bool(true, title="Show Signals ?")
highlighting = input.bool(true, title="Highlighter On/Off ?")
emaPeriod = input.int(50, title="EMA Period")
bbLength = input.int(20, title="Bollinger Bands Length")
bbMultiplier = input.float(2.0, title="Bollinger Bands Multiplier")
// ATR Calculation
atr2 = ta.sma(ta.tr, Periods)
atr = changeATR ? ta.atr(Periods) : atr2
// Supertrend Calculation
up = src - (Multiplier * atr)
up1 = nz(up , up)
up := close > up1 ? math.max(up, up1) : up
dn = src + (Multiplier * atr)
dn1 = nz(dn , dn)
dn := close < dn1 ? math.min(dn, dn1) : dn
trend = 1
trend := nz(trend , trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
// Bollinger Bands Calculation
basis = ta.sma(close, bbLength)
deviation = ta.stdev(close, bbLength)
upperBand = basis + (bbMultiplier * deviation)
lowerBand = basis - (bbMultiplier * deviation)
// Plot Supertrend and Bollinger Bands
upPlot = plot(trend == 1 ? up : na, title="Up Trend", style=plot.style_line, linewidth=2, color=color.green)
dnPlot = plot(trend == 1 ? na : dn, title="Down Trend", style=plot.style_line, linewidth=2, color=color.red)
plot(upperBand, title="Upper Band", color=color.blue, linewidth=1)
plot(lowerBand, title="Lower Band", color=color.blue, linewidth=1)
plot(basis, title="BB Basis", color=color.gray, linewidth=1)
// Buy and Sell Signals
buySignal = close > upperBand
sellSignal = close < lowerBand
if (buySignal and showSignals)
strategy.entry("Buy", strategy.long)
if (sellSignal and showSignals)
strategy.close("Buy")
// Highlighting
mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0)
longFillColor = highlighting ? (trend == 1 ? color.new(color.green, 90) : na) : na
shortFillColor = highlighting ? (trend == -1 ? color.new(color.red, 90) : na) : na
fill(mPlot, upPlot, title="UpTrend Highlighter", color=longFillColor)
fill(mPlot, dnPlot, title="DownTrend Highlighter", color=shortFillColor)
// Date Range Filter
startDate = input.time(timestamp("2018-01-01 00:00"), title="Start Date")
endDate = input.time(timestamp("2069-12-31 23:59"), title="End Date")
inDateRange = (time >= startDate and time <= endDate)
if not inDateRange
strategy.close_all()
Hold Time With Percentage Drop Catastrophic ExitStrategy Name: Volatile Market Minimum-Hold & Catastrophic Drop Exit Strategy
Description:
This is a strategy designed to operate effectively within volatile trading environments, with specific rules that balance patience with protection from risk. It looks to capitalize on breakout conditions but provides a failsafe in the event of a sudden severe price decline.
Key Features:
Volatility-Based Entry Criteria:
This strategy is based on Bollinger Bands, ATR, VWAP, and MACD in trying to find breakout opportunities with increased volatility in the markets. It demands that the price go over the upper Bollinger Band when ATR indicates increased turbulence and that MACD signals upward momentum. In this way, it selects trades with high follow-through likelihoods, especially under trending conditions.
Minimum Holding Period:
Once a long position is initiated, the strategy imposes a strict "no-sell" period in bars. This means that, under normal circumstances, it will not close the position. This encourages the trade to mature, reducing the likelihood of premature exits caused by minor pullbacks or intraday noise.
Volume Confirmation:
A relative volume filter ensures that breakouts aren't occurring in low-liquidity conditions. In doing so, the strategy is only looking to enter when market participation is well above average, thereby increasing the odds of price moves being legitimate and sustainable.
Catastrophic Drop Exit:
The strategy includes a "catastrophic drop" mechanism to help mitigate severe, unexpected losses. If the price falls below a user-defined percentage of the entry price—sufficiently large to indicate a major market breakdown—it will override the minimum hold rule and immediately close the position. This helps protect capital if the market suddenly turns sharply negative.
User Configuration:
All the key parameters, which include the minimum hold duration, catastrophic drop percentage, Bollinger Band settings, MACD lengths, and ATR-based stop/target multiples, are user-editable. Traders can adjust the aggressiveness, holding time, and risk controls of the strategy to fit their specific risk tolerance, trading style, and the volatility profile of the markets in which they're participating.
Intended Use Case:
This strategy is more suitable for traders operating in more volatile markets, with frequent whipsaws and fast price moves. It tries to capture the upside of a volatile breakout while minimizing the downside from a sudden price collapse by balancing a forced hold period against the flexibility of a catastrophic drop exit.
Note:
This approach is in line with all automated or rules-based approaches: extensive backtesting and parameter optimization, followed by thorough forward-testing on paper, is very strongly advised before going into live market conditions. Also, adjust parameters to better suit your instrument of choice, timeframe, and your criteria of personal risk management.
Three Moving Averages Strategythis is three moving averages strategy is good for day time frame best for swing trading , probability vary for 60 to 80 to increase the probability add other indictors . you can rsi or macd.
Bitcoin Exponential Profit Strategy### Strategy Description:
The **Bitcoin Trading Strategy** is an **Exponential Moving Average (EMA) crossover strategy** designed to identify bullish trends for Bitcoin.
1. **Indicators**:
- **Fast EMA (default 9 periods)**: Represents the short-term trend.
- **Slow EMA (default 21 periods)**: Represents the longer-term trend.
2. **Entry Condition**:
- A **bullish crossover** occurs when the Fast EMA crosses above the Slow EMA.
- The strategy enters a **long position** with a user-defined order size (default 0.01 BTC).
3. **Exit Conditions**:
- **Take Profit**: Closes the position when the profit target is reached (default $100).
- **Stop Loss**: Closes the position when the price drops below the stop loss level (default $50).
- **Bearish Crossunder**: Closes the position when the Fast EMA crosses below the Slow EMA.
4. **Visual Signals**:
- **BUY signals**: Displayed when a bullish crossover occurs.
- **SELL signals**: Displayed when a bearish crossunder occurs.
This strategy is optimized for trend-following behavior, ensuring positions are aligned with upward-moving trends while managing risk through clear stop-loss and take-profit levels.
Refined SMA/EMA Crossover with Ichimoku and 200 SMA FilterYour **Refined SMA/EMA Crossover with Ichimoku and 200 SMA Filter** strategy is a multi-faceted technical trading strategy that combines several key technical indicators to refine entry and exit points for trades. Here's a breakdown of the components and how they work together:
### 1. **SMA/EMA Crossover**
- **Simple Moving Average (SMA) & Exponential Moving Average (EMA) Crossover**:
- The core idea behind the crossover strategy is to use the relationship between two moving averages to generate buy or sell signals.
- **SMA** (Simple Moving Average) gives an average of past prices over a set period.
- **EMA** (Exponential Moving Average) places more weight on recent prices, making it more responsive to price movements.
- A **bullish crossover** occurs when a shorter period moving average (such as a 50-period EMA) crosses above a longer period moving average (such as a 200-period SMA), signaling a potential buy.
- A **bearish crossover** occurs when a shorter period moving average crosses below the longer period moving average, signaling a potential sell.
### 2. **Ichimoku Cloud**
- The **Ichimoku Cloud** is a versatile indicator that provides insight into trend direction, support and resistance levels, and momentum.
- **Cloud (Kumo)**: The space between the Senkou Span A and Senkou Span B lines. It helps identify whether the market is in an uptrend, downtrend, or consolidation.
- **Tenkan-sen** (Conversion Line) and **Kijun-sen** (Base Line): These lines are used for additional confirmation of trend direction.
- **Chikou Span**: A lagging line that is used to confirm the trend.
- The general trading rules based on the Ichimoku Cloud are:
- **Bullish Signal**: When the price is above the cloud and the Tenkan-sen crosses above the Kijun-sen.
- **Bearish Signal**: When the price is below the cloud and the Tenkan-sen crosses below the Kijun-sen.
### 3. **200 SMA Filter**
- The **200 SMA Filter** serves as a long-term trend filter.
- When the price is **above the 200 SMA**, it signals a long-term bullish trend, and you only look for buying opportunities.
- When the price is **below the 200 SMA**, it signals a long-term bearish trend, and you only look for selling opportunities.
- This filter helps to avoid counter-trend trades, aligning your positions with the broader market trend.
### **How the Strategy Works Together**
- **Trade Setup (Long Position)**
1. The **200 SMA Filter** must confirm an **uptrend** by ensuring that the price is above the 200 SMA.
2. A **bullish crossover** (e.g., the 50 EMA crossing above the 200 SMA) occurs.
3. **Ichimoku Cloud** confirms a bullish trend, with the price above the cloud and the Tenkan-sen crossing above the Kijun-sen.
4. You enter a **long trade** with this confluence of signals.
- **Trade Setup (Short Position)**
1. The **200 SMA Filter** must confirm a **downtrend** by ensuring the price is below the 200 SMA.
2. A **bearish crossover** (e.g., the 50 EMA crossing below the 200 SMA) occurs.
3. **Ichimoku Cloud** confirms a bearish trend, with the price below the cloud and the Tenkan-sen crossing below the Kijun-sen.
4. You enter a **short trade** with this confluence of signals.
### **Exit Strategy**
- Exits can be determined based on any of the following:
- **SMA/EMA crossover reversal**: Exit when the shorter-term moving average crosses back below the longer-term moving average for a long position or crosses above for a short position.
- **Ichimoku Cloud reversal**: If the price breaks through the cloud or the Tenkan-sen and Kijun-sen lines cross in the opposite direction.
- **Profit target or stop loss**: Setting predefined profit targets or using a trailing stop to lock in profits as the trade moves in your favor.
Summary of the Strategy
This strategy is designed to identify strong trends and avoid false signals by combining:
SMA/EMA crossovers for immediate market direction signals.
Ichimoku Cloud for confirming the strength and trend direction.
A 200
SMA filter to ensure trades align with the long-term trend.
By using these multiple indicators together, the strategy aims to refine entry and exit points, minimize risk, and increase the likelihood of successful trades.
Tomas Ratio Strategy with Multi-Timeframe AnalysisHello,
I would like to present my new indicator I have compiled together inspired by Calmar Ratio which is a ratio that measures gains vs losers but with a little twist.
Basically the idea is that if HLC3 is above HLC3 (or previous one) it will count as a gain and it will calculate the percentage of winners in last 720 hourly bars and then apply 168 hour standard deviation to the weekly average daily gains.
The idea is that you're supposed to buy if the thick blue line goes up and not buy if it goes down (signalized by the signal line). I liked that idea a lot, but I wanted to add an option to fire open and close signals. I have also added a logic that it not open more trades in relation the purple line which shows confidence in buying.
As input I recommend only adjusting the amount of points required to fire a signal. Note that the lower amount you put, the more open trades it will allow (and vice versa)
Feel free to remove that limiter if you want to. It works without it as well, this script is meant for inexperienced eye.
I will also publish a indicator script with this limiter removed and alerts added for you to test this strategy if you so choose to.
Also, I have added that the trades will enter only if price is above 720 period EMA
Disclaimer
This strategy is for educational purposes only and should not be considered financial advice. Always backtest thoroughly and adjust parameters based on your trading style and market conditions.
Made in collaboration with ChatGPT.
Swing High/Low Pivots Strategy [LV]The Swing High/Low Pivots Strategy was developed as a counter-momentum trading tool.
The strategy is suitable for any market and the default values used in the input settings menu are set for Bitcoin (best on 15min). These values, expressed in minimum ticks (or pips if symbol is Forex) make this tool perfectly adaptable to every symbol and/or timeframe.
Check tooltips in the settings menu for more details about every user input.
STRTEGY ENTRY & EXIT MECHANISMS:
Trades Entry based on the detection of swing highs and lows for short and long entries respectively, validated by:
- Limit orders placed after each new pivot level confirmation
- Moving averages trend filter (if enabled)
- No active trade currently open
Trades Exit when the price reaches take-profit or stop-loss level as defined in the settings menu. A double entry/second take-profit level can be enabled for partial exits, with dynamic stop-loss adjustment for the remaining position.
Enhanced Trade Precision:
By limiting entries to confirmed swing high (HH, LH) or swing low (HL, LL) pivot points, the strategy ensures that trades occur at levels of significant price reversals. This precision reduces the likelihood of entering trades in the midst of a trend or during uncertain price action.
Risk Management Optimization:
The strategy incorporates clearly defined stop-loss (SL) and take-profit (TP) levels derived from the pivot points. This structured approach minimizes potential losses while locking in profits, which is critical for consistent performance in volatile markets.
Trend Filtering for Better Entry:
The use of a configurable moving average filter adds a layer of trend validation. This prevents entering trades against the dominant market trend, increasing the probability of success for each trade.
Avoidance of Noise:
The lookback period (length parameter) confirms pivots only after a set number of bars, effectively filtering out market noise and ensuring that entries are based on reliable, well-defined price movements.
Adaptability Across Markets:
The strategy is versatile and can be applied across different markets (Forex, stocks, crypto) due to its dynamic use of ticks and pips converters. It adapts seamlessly to varying price scales and asset types.
Dual Quantity Entries:
The original and optionnal double-entry mechanism allows traders to capture both short-term and extended profits by scaling out of positions. This adaptive approach caters to varying risk appetites and market conditions.
Clear Visualization:
The plotted pivot points, entry limits, SL, and TP levels provide visual clarity, making it easy for traders to track the strategy's behavior and make informed decisions.
Automated Execution with Alerts:
Integrated alerts for both entries and exits ensure timely actions without the need for constant market monitoring, enhancing efficiency. Configurable alert messages are suitable for API use.
Any feedback, comments, or suggestions for improvement are always welcome.
Hope you enjoy!
R-based Strategy Template [Daveatt]Have you ever wondered how to properly track your trading performance based on risk rather than just profits?
This template solves that problem by implementing R-multiple tracking directly in TradingView's strategy tester.
This script is a tool that you must update with your own trading entry logic.
Quick notes
Before we dive in, I want to be clear: this is a template focused on R-multiple calculation and visualization.
I'm using a basic RSI strategy with dummy values just to demonstrate how the R tracking works. The actual trading signals aren't important here - you should replace them with your own strategy logic.
R multiple logic
Let's talk about what R-multiple means in practice.
Think of R as your initial risk per trade.
For instance, if you have a $10,000 account and you're risking 1% per trade, your 1R would be $100.
A trade that makes twice your risk would be +2R ($200), while hitting your stop loss would be -1R (-$100).
This way of measuring makes it much easier to evaluate your strategy's performance regardless of account size.
Whenever the SL is hit, we lose -1R
Proof showing the strategy tester whenever the SL is hit: i.imgur.com
The magic happens in how we calculate position sizes.
The script automatically determines the right position size to risk exactly your specified percentage on each trade.
This is done through a simple but powerful calculation:
risk_amount = (strategy.equity * (risk_per_trade_percent / 100))
sl_distance = math.abs(entry_price - sl_price)
position_size = risk_amount / (sl_distance * syminfo.pointvalue)
Limitations with lower timeframe gaps
This ensures that if your stop loss gets hit, you'll lose exactly the amount you intended to risk. No more, no less.
Well, could be more or less actually ... let's assume you're trading futures on a 15-minute chart but in the 1-minute chart there is a gap ... then your 15 minute SL won't get filled and you'll likely to not lose exactly -1R
This is annoying but it can't be fixed - and that's how trading works anyway.
Features
The template gives you flexibility in how you set your stop losses. You can use fixed points, ATR-based stops, percentage-based stops, or even tick-based stops.
Regardless of which method you choose, the position sizing will automatically adjust to maintain your desired risk per trade.
To help you track performance, I've added a comprehensive statistics table in the top right corner of your chart.
It shows you everything you need to know about your strategy's performance in terms of R-multiples: how many R you've won or lost, your win rate, average R per trade, and even your longest winning and losing streaks.
Happy trading!
And remember, measuring your performance in R-multiples is one of the most classical ways to evaluate and improve your trading strategies.
Daveatt
IU EMA Channel StrategyIU EMA Channel Strategy
Overview:
The IU EMA Channel Strategy is a simple yet effective trend-following strategy that uses two Exponential Moving Averages (EMAs) based on the high and low prices. It provides clear entry and exit signals by identifying price crossovers relative to the EMAs while incorporating a built-in Risk-to-Reward Ratio (RTR) for effective risk management.
Inputs ( Settings ):
- RTR (Risk-to-Reward Ratio): Define the ratio for risk-to-reward (default = 2).
- EMA Length: Adjust the length of the EMA channels (default = 100).
How the Strategy Works
1. EMA Channels:
- High-based EMA: EMA calculated on the high price.
- Low-based EMA: EMA calculated on the low price.
The area between these two EMAs creates a "channel" that visually highlights potential support and resistance zones.
2. Entry Rules:
- Long Entry: When the price closes above the high-based EMA (crossover).
- Short Entry: When the price closes below the low-based EMA (crossunder).
These entries ensure trades are taken in the direction of momentum.
3. Stop Loss (SL) and Take Profit (TP):
- Stop Loss:
- For long positions, the SL is set at the previous bar's low.
- For short positions, the SL is set at the previous bar's high.
- Take Profit:
- TP is automatically calculated using the Risk-to-Reward Ratio (RTR) you define.
- Example: If RTR = 2, the TP will be 2x the risk distance.
4. Exit Rules:
- Positions are closed at either the stop loss or the take profit level.
- The strategy manages exits automatically to enforce disciplined risk management.
Visual Features
1. EMA Channels:
- The high and low EMAs are dynamically color-coded:
- Green: Price is above the EMA (bullish condition).
- Red: Price is below the EMA (bearish condition).
- The area between the EMAs is shaded for better visual clarity.
2. Stop Loss and Take Profit Zones:
- SL and TP levels are plotted for both long and short positions.
- Zones are filled with:
- Red: Stop Loss area.
- Green: Take Profit area.
Be sure to manage your risk and position size properly.
DAILY Supertrend + EMA Crossover with RSI FilterThis strategy is a technical trading approach that combines multiple indicators—Supertrend, Exponential Moving Averages (EMAs), and the Relative Strength Index (RSI)—to identify and manage trades.
Core Components:
1. Exponential Moving Averages (EMAs):
Two EMAs, one with a shorter period (fast) and one with a longer period (slow), are calculated. The idea is to spot when the faster EMA crosses above or below the slower EMA. A fast EMA crossing above the slow EMA often suggests upward momentum, while crossing below suggests downward momentum.
2. Supertrend Indicator:
The Supertrend uses Average True Range (ATR) to establish dynamic support and resistance lines. These lines shift above or below price depending on the prevailing trend. When price is above the Supertrend line, the trend is considered bullish; when below, it’s considered bearish. This helps ensure that the strategy trades only in the direction of the overall trend rather than against it.
3. RSI Filter:
The RSI measures momentum. It helps avoid buying into markets that are already overbought or selling into markets that are oversold. For example, when going long (buying), the strategy only proceeds if the RSI is not too high, and when going short (selling), it only proceeds if the RSI is not too low. This filter is meant to improve the quality of the trades by reducing the chance of entering right before a reversal.
4. Time Filters:
The strategy only triggers entries during user-specified date and time ranges. This is useful if one wants to limit trading activity to certain trading sessions or periods with higher market liquidity.
5. Risk Management via ATR-based Stops and Targets:
Both stop loss and take profit levels are set as multiples of the ATR. ATR measures volatility, so when volatility is higher, both stops and profit targets adjust to give the trade more breathing room. Conversely, when volatility is low, stops and targets tighten. This dynamic approach helps maintain consistent risk management regardless of market conditions.
Overall Logic Flow:
- First, the market conditions are analyzed through EMAs, Supertrend, and RSI.
- When a buy (long) condition is met—meaning the fast EMA crosses above the slow EMA, the trend is bullish according to Supertrend, and RSI is below the specified “overbought” threshold—the strategy initiates or adds to a long position.
- Similarly, when a sell (short) condition is met—meaning the fast EMA crosses below the slow EMA, the trend is bearish, and RSI is above the specified “oversold” threshold—it initiates or adds to a short position.
- Each position is protected by an automatically calculated stop loss and a take profit level based on ATR multiples.
Intended Result:
By blending trend detection, momentum filtering, and volatility-adjusted risk management, the strategy aims to capture moves in the primary trend direction while avoiding entries at excessively stretched prices. Allowing multiple entries can potentially amplify gains in strong trends but also increases exposure, which traders should consider in their risk management approach.
In essence, this strategy tries to ride established trends as indicated by the Supertrend and EMAs, filter out poor-quality entries using RSI, and dynamically manage trade risk through ATR-based stops and targets.
MACD Aggressive Scalp SimpleComment on the Script
Purpose and Structure:
The script is a scalping strategy based on the MACD indicator combined with EMA (50) as a trend filter.
It uses the MACD histogram's crossover/crossunder of zero to trigger entries and exits, allowing the trader to capitalize on short-term momentum shifts.
The use of strategy.close ensures that positions are closed when specified conditions are met, although adjustments were made to align with Pine Script version 6.
Strengths:
Simplicity and Clarity: The logic is straightforward and focuses on essential scalping principles (momentum-based entries and exits).
Visual Indicators: The plotted MACD line, signal line, and histogram columns provide clear visual feedback for the strategy's operation.
Trend Confirmation: Incorporating the EMA(50) as a trend filter helps avoid trades that go against the prevailing trend, reducing the likelihood of false signals.
Dynamic Exit Conditions: The conditional logic for closing positions based on weakening momentum (via MACD histogram change) is a good way to protect profits or minimize losses.
Potential Improvements:
Parameter Inputs:
Make the MACD (12, 26, 9) and EMA(50) values adjustable by the user through input statements for better customization during backtesting.
Example:
pine
Copy code
macdFast = input(12, title="MACD Fast Length")
macdSlow = input(26, title="MACD Slow Length")
macdSignal = input(9, title="MACD Signal Line Length")
emaLength = input(50, title="EMA Length")
Stop Loss and Take Profit:
The strategy currently lacks explicit stop-loss or take-profit levels, which are critical in a scalping strategy to manage risk and lock in profits.
ATR-based or fixed-percentage exits could be added for better control.
Position Size and Risk Management:
While the script uses 50% of equity per trade, additional options (e.g., fixed position sizes or risk-adjusted sizes) would be beneficial for flexibility.
Avoid Overlapping Signals:
Add logic to prevent overlapping signals (e.g., opening a new position immediately after closing one on the same bar).
Backtesting Optimization:
Consider adding labels or markers (label.new or plotshape) to visualize entry and exit points on the chart for better debugging and analysis.
The inclusion of performance metrics like max drawdown, Sharpe ratio, or profit factor would help assess the strategy's robustness during backtesting.
Compatibility with Live Trading:
The strategy could be further enhanced with alert conditions using alertcondition to notify the trader of buy/sell signals in real-time.
3 EMA + RSI with Trail Stop [Free990] (LOW TF)This trading strategy combines three Exponential Moving Averages (EMAs) to identify trend direction, uses RSI to signal exit conditions, and applies both a fixed percentage stop-loss and a trailing stop for risk management. It aims to capture momentum when the faster EMAs cross the slower EMA, then uses RSI thresholds, time-based exits, and stops to close trades.
Short Explanation of the Logic
Trend Detection: When the 10 EMA crosses above the 20 EMA and both are above the 100 EMA (and the current price bar closes higher), it triggers a long entry signal. The reverse happens for a short (the 10 EMA crosses below the 20 EMA and both are below the 100 EMA).
RSI Exit: RSI crossing above a set threshold closes long trades; crossing below another threshold closes short trades.
Time-Based Exit: If a trade is in profit after a set number of bars, the strategy closes it.
Stop-Loss & Trailing Stop: A fixed stop-loss based on a percentage from the entry price guards against large drawdowns. A trailing stop dynamically tightens as the trade moves in favor, locking in potential gains.
Detailed Explanation of the Strategy Logic
Exponential Moving Average (EMA) Setup
Short EMA (out_a, length=10)
Medium EMA (out_b, length=20)
Long EMA (out_c, length=100)
The code calculates three separate EMAs to gauge short-term, medium-term, and longer-term trend behavior. By comparing their relative positions, the strategy infers whether the market is bullish (EMAs stacked positively) or bearish (EMAs stacked negatively).
Entry Conditions
Long Entry (entryLong): Occurs when:
The short EMA (10) crosses above the medium EMA (20).
Both EMAs (short and medium) are above the long EMA (100).
The current bar closes higher than it opened (close > open).
This suggests that momentum is shifting to the upside (short-term EMAs crossing up and price action turning bullish). If there’s an existing short position, it’s closed first before opening a new long.
Short Entry (entryShort): Occurs when:
The short EMA (10) crosses below the medium EMA (20).
Both EMAs (short and medium) are below the long EMA (100).
The current bar closes lower than it opened (close < open).
This indicates a potential shift to the downside. If there’s an existing long position, that gets closed first before opening a new short.
Exit Signals
RSI-Based Exits:
For long trades: When RSI exceeds a specified threshold (e.g., 70 by default), it triggers a long exit. RSI > short_rsi generally means overbought conditions, so the strategy exits to lock in profits or avoid a pullback.
For short trades: When RSI dips below a specified threshold (e.g., 30 by default), it triggers a short exit. RSI < long_rsi indicates oversold conditions, so the strategy closes the short to avoid a bounce.
Time-Based Exit:
If the trade has been open for xBars bars (configurable, e.g., 24 bars) and the trade is in profit (current price above entry for a long, or current price below entry for a short), the strategy closes the position. This helps lock in gains if the move takes too long or momentum stalls.
Stop-Loss Management
Fixed Stop-Loss (% Based): Each trade has a fixed stop-loss calculated as a percentage from the average entry price.
For long positions, the stop-loss is set below the entry price by a user-defined percentage (fixStopLossPerc).
For short positions, the stop-loss is set above the entry price by the same percentage.
This mechanism prevents catastrophic losses if the market moves strongly against the position.
Trailing Stop:
The strategy also sets a trail stop using trail_points (the distance in price points) and trail_offset (how quickly the stop “catches up” to price).
As the market moves in favor of the trade, the trailing stop gradually tightens, allowing profits to run while still capping potential drawdowns if the price reverses.
Order Execution Flow
When the conditions for a new position (long or short) are triggered, the strategy first checks if there’s an opposite position open. If there is, it closes that position before opening the new one (prevents going “both long and short” simultaneously).
RSI-based and time-based exits are checked on each bar. If triggered, the position is closed.
If the position remains open, the fixed stop-loss and trailing stop remain in effect until the position is exited.
Why This Combination Works
Multiple EMA Cross: Combining 10, 20, and 100 EMAs balances short-term momentum detection with a longer-term trend filter. This reduces false signals that can occur if you only look at a single crossover without considering the broader trend.
RSI Exits: RSI provides a momentum oscillator view—helpful for detecting overbought/oversold conditions, acting as an extra confirmation to exit.
Time-Based Exit: Prevents “lingering trades.” If the position is in profit but failing to advance further, it takes profit rather than risking a trend reversal.
Fixed & Trailing Stop-Loss: The fixed stop-loss is your safety net to cap worst-case losses. The trailing stop allows the strategy to lock in gains by following the trade as it moves favorably, thus maximizing profit potential while keeping risk in check.
Overall, this approach tries to capture momentum from EMA crossovers, protect profits with trailing stops, and limit risk through both a fixed percentage stop-loss and exit signals from RSI/time-based logic.
DemaRSI StrategyThis is a repost to a old script that cant be updated anymore, the request was made on Feb, 27, 2016.
Here's a engaging description for the tradingview script:
**DemaRSI Strategy: A Proven Trading System**
Join thousands of traders who have already experienced the power of this highly effective strategy. The DemaRSI system combines two powerful indicators - DEMA (Double Exponential Moving Average) and RSI (Relative Strength Index) - to generate profitable trades with minimal risk.
**Key Features:**
* **Trend-Following**: Our algorithm identifies strong trends using a combination of DEMA and RSI, allowing you to ride the waves of market momentum.
* **Risk Management**: The system includes built-in stop-loss and take-profit levels, ensuring that your gains are protected and losses are minimized.
* **Session-Based Trading**: Trade during specific sessions only (e.g., London or New York) for even more targeted results.
* **Customizable Settings**: Adjust the length of moving averages, RSI periods, and other parameters to suit your trading style.
**What You'll Get:**
* A comprehensive strategy that can be used with any broker or platform
* Easy-to-use interface with customizable settings
* Real-time performance metrics and backtesting capabilities
**Start Trading Like a Pro Today!**
This script is designed for intermediate to advanced traders who want to take their trading game to the next level. With its robust risk management features, this strategy can help you achieve consistent profits in various market conditions.
**Disclaimer:** This script is not intended as investment advice and should be used at your own discretion. Trading carries inherent risks, and losses are possible.
~Llama3
MicuRobert EMA Cross StrategyThis is a repost of a old strategy that cant be updated anymore, it was a request for a user made in Oct, 6, 2015
Here's a possible engaging description for the tradingview script:
**MicuRobert EMA Cross V2: A Powerful Trading Strategy**
Join the ranks of successful traders with this advanced strategy, designed to help you profit from market trends. The MicuRobert EMA Cross V2 combines two essential indicators - Exponential Moving Average (EMA) and Divergence EMA (DEMA) - to generate buy and sell signals.
**Key Features:**
* **Trading Session Filter**: Only trade during your preferred session, ensuring you're in sync with market conditions.
* **Trailing Stop**: Automatically adjust stop-loss levels to lock in profits or limit losses.
* **Customizable Trade Size**: Set the size of each trade based on your risk tolerance and trading goals.
**How it Works:**
The script uses two EMAs (5-period and 34-period) to identify trends. When the shorter EMA crosses above the longer one, a buy signal is generated. Conversely, when the shorter EMA falls below the longer one, a sell signal is triggered. The strategy also incorporates divergence analysis between price action and the EMAs.
**Visual Aids:**
* **EMA Plots**: Visualize the two EMAs on your chart to gauge market momentum.
* **Buy/Sell Signals**: See when buy or sell signals are generated, along with their corresponding entry prices.
* **Trailing Stop Lines**: Monitor stop-loss levels as they adjust based on price action.
**Get Started:**
Download this script and start trading like a pro! With its robust features and customizable settings, the MicuRobert EMA Cross V2 is an excellent addition to any trader's arsenal.
~Llama3
Custom Strategy: ETH Martingale 2.0Strategic characteristics
ETH Little Martin 2.0 is a self-developed trading strategy based on the Martingale strategy, mainly used for trading ETH (Ethereum). The core idea of this strategy is to place orders in the same direction at a fixed price interval, and then use Martin's multiple investment principle to reduce losses, but this is also the main source of losses.
Parameter description:
1 Interval: The minimum spacing for taking profit, stop loss, and opening/closing of orders. Different targets have different spacing. Taking ETH as an example, it is generally recommended to have a spacing of 2% for fluctuations in the target.
2 Base Price: This is the price at which you triggered the first order. Similarly, I am using ETH as an example. If you have other targets, I suggest using the initial value of a price that can be backtesting. The Base Price is only an initial order price and has no impact on subsequent orders.
3 Initial Order Amount: Users can set an initial order amount to control the risk of each transaction. If the stop loss is reached, we will double the amount based on this value. This refers to the value of the position held, not the number of positions held.
4 Loss Multiplier: The strategy will increase the next order amount based on the set multiple after the stop loss, in order to make up for the previous losses through a larger position. Note that after taking profit, it will be reset to 1 times the Initial Order Amount.
5. Long Short Operation: The first order of the strategy is a multiple entry, and in subsequent orders, if the stop loss is reached, a reverse order will be opened. The position value of a one-way order is based on the Loss Multiplier multiple investment, so it is generally recommended that the Loss Multiplier default to 2.
Improvement direction
Although this strategy already has a certain trading logic, there are still some improvement directions that can be considered:
1. Dynamic adjustment of spacing: Currently, the spacing is fixed, and it can be considered to dynamically adjust the spacing based on market volatility to improve the adaptability of the strategy. Try using dynamic spacing, which may be more suitable for the actual market situation.
2. Filtering criteria: Orders and no orders can be optimized separately. The biggest problem with this strategy is that it will result in continuous losses during fluctuations, and eventually increase the investment amount. You can consider filtering out some fluctuations or only focusing on trend trends.
3. Risk management: Add more risk management measures, such as setting a maximum loss limit to avoid huge losses caused by continuous stop loss.
4. Optimize the stop loss multiple: Currently, the stop loss multiple is fixed, and it can be considered to dynamically adjust the multiple according to market conditions to reduce risk.