Trendlines (long)Hi all!
I hope that this indicator helps you to be a more efficient trader. The concept is well known and useful. So this is not some magic algorithm founded by me, but rather a well known concept. The concept is the drawing of trendlines.
It draws trendlines that has a retest. It draws the trendlines in different colors, the colors used are blue, red, fuchsia and lime.
These are the steps for finding a trendline:
1. Find a generic retest
Find a low that has 2 earlier lows and 1 later low that are higher. This is the reason that a trendline will be created "1 bar late". This is the base and the indicator goes on from here, meaning that this needs to be true to continue.
2. Find an uptrend
Look back 8 bars to find a low that is lower than the retest low.
3. Create the first point of a trendline
Go thru every bar between the user defined "Lookback" and the retest bar (minus the user defined "Skip gap" that's needed between points to create a trendline). From the earliest bar to the latest.
4. Create the second point of the trendline
Go thru every bar between the retest bar and the the first point (bar) minus the "Skip gap". From latest bar to the earliest. A trendline between the two bars are invalidated if some of the criteria are met in-between the bars creating the trendline:
- closed above the trendline (trendline broken)
- is not within the retest bar
- the slope of the trendline is upwards (this indicator is for long entries only)
- at least 1 of the bars creating the retest (1 main bar and 2 earlier bars) has NOT been above the trendline
- is not the created trendline (between the two points) that's closest to the low of the retest bar
TODO:
- add functionality to draw trendlines directly on breakouts
- add volume (high volume needed to create a trendline from a breakout/retest)
- ...?
I hope this explanation makes sense, let me know otherwise. Also let me know if you have any suggestions on improvements.
Best of luck trading!
TRENDLINERETEST
IsAlgo - Manual TrendLine► Overview:
Manual TrendLine is a strategy that allows traders to manually insert a trendline and opens trades when the trendline is retested or when the price hits a new highest high or lowest low. It provides flexibility in trendline configuration and trading behavior, enabling responsive and adaptable trading strategies.
► Description:
The Manual TrendLine strategy revolves around using manually defined trendlines as the primary tool for making trading decisions. Traders start by specifying two key points on the chart to establish the trendline. Each point is defined by a specific time and price, enabling precise placement according to the trader’s analysis and insights. Additionally, the strategy allows for the adjustment of the trendline’s width, which acts as a buffer zone around the trendline, providing flexibility in how closely price movements must align with the trendline to trigger trades.
Once the trendline is established, the strategy continuously monitors price movements relative to this line. One of its core functions is to execute trades when the price retests the trendline. A retest occurs when the price approaches the trendline after initially diverging from it, indicating potential continuation of the prevailing trend. This behavior is often seen as a confirmation of the trend’s strength, and the strategy takes advantage of these moments to enter trades in the direction of the trend.
Beyond retests, the strategy also tracks the formation of new highest highs and lowest lows in relation to the trendline. When the price reaches a new highest high or lowest low, it signifies strong momentum in the trend’s direction. The strategy can be configured to open trades at these critical points.
Another key feature of the strategy is its response to trendline breaks. A break occurs when the price moves through the trendline, potentially signaling a reversal or a significant shift in market sentiment. The strategy can be set to open reverse trades upon such breaks, enabling traders to quickly adapt to changing market conditions. Additionally, traders have the option to stop opening new trades after a trendline break, helping to avoid trades during periods of uncertainty or increased volatility.
↑ Up Trend Example:
↓ Down Trend Example:
► Features and Settings:
⚙︎ TrendLine: Define the time and price of the two main points of the trendline, and set the trendline width.
⚙︎ Entry Candle: Specify the minimum and maximum body size and the body-to-candle size ratio for entry candles.
⚙︎ Trading Session: Define specific trading hours during which the strategy operates, restricting trades to preferred market periods.
⚙︎ Trading Days: Specify active trading days to avoid certain days of the week.
⚙︎ Backtesting: backtesting for a selected period to evaluate strategy performance. This feature can be deactivated if not needed.
⚙︎ Trades: Configure trade direction (long, short, or both), position sizing (fixed or percentage-based), maximum number of open trades, and daily trade limits.
⚙︎ Trades Exit: Set profit/loss limits, specify trade duration, or exit based on band reversal signals.
⚙︎ Stop Loss: Choose from various stop-loss methods, including fixed pips, ATR-based, or highest/lowest price points within a specified number of candles. Trades can also be closed after a certain number of adverse candle movements.
⚙︎ Break Even: Adjust stop loss to break even once predefined profit levels are reached, protecting gains.
⚙︎ Trailing Stop: Implement a trailing stop to adjust the stop loss as the trade becomes profitable, securing gains and potentially capturing further upside.
⚙︎ Take Profit: Set up to three take-profit levels using methods such as fixed pips, ATR, or risk-to-reward ratios. Alternatively, specify a set number of candles moving in the trade’s direction.
⚙︎ Alerts: Comprehensive alert system to notify users of significant actions, including trade openings and closings. Supports dynamic placeholders for take-profit levels and stop-loss prices.
⚙︎ Dashboard: Visual display on the chart providing detailed information about ongoing and past trades, aiding users in monitoring strategy performance and making informed decisions.
► Backtesting Details:
Timeframe: 30-minute EURUSD chart
Initial Balance: $10,000
Order Size: 500 units
Commission: 0.05%
Slippage: 5 ticks
This strategy opens trades around a manually drawn trendline, which results in a smaller number of closed trades.