The first thing that may jump out at you on the chart is that it is not a Renko chart. TradingView does not allow strategies to be posted when on a Renko chart. However, I wanted to publish the following ideas from my journey in creating a trading strategy for a Renko chart. I didn't realize I wouldn't be able to publish it on the chart itself (or anywhere) until after I'd completed the first phase of it. To see this on a Renko chart, you can convert the chart to Renko, set the timeframe to 1 minute and then the blocksize to 20 (for CL1! or WTI) using a close, traditional setting, and no wicks.
I had several goals I wanted to achieve when I started building this strategy.
Learn PineScript. The best way to learn a new programming language is to have a practical target to reach.
Codify some of the ideas I have been putting together over the past several years on trading with Renko charts.
Have a way to remove emotions out of entering and exiting trades.
TradingView does not allow for strategies to be published on Renko charts due to some of the nuances with the charts that can distort results of tests. However, once you understand some of these scenarios, you can look for them and adjust. As for the strategy, to-date, it is based on three indicators: the Least Squares Moving Average, Donchian Channels, and Linear Regression. I wanted all of the inputs to be configurable like the underlying indicators themselves. As I got into the development and testing of ideas (I started over many different times :D), I realized there were other parameters I wanted be able to configure and added the as I went.
The approach (as of now):
Create a TV strategy that could be used for back testing
The strategy should be well supported on Renko charts with a common setup and configurations
The strategy could be applied to Renko charts and be configurable enough to support all types of markets
For the Renko charts, I typically go with a static setup. As an example, for CL1! or WTI, I use a blocksize of 0.20 or 20 ticks using the closing price and a traditional configuration. I do not use wicks on the charts. I set the timeframe to 1 minute (this is the length of time needed at the sustained price to print the specific brick). In TV strategies, my understanding is that until the brick prints, the strategy won’t be executed for the strategy. I touch on some of the ramifications later but for now know this is probably one of many reasons strategies won’t be published on Renko charts.
For the strategy, I wanted to create something that is reactive. I wanted it to be able to detect patterns or the beginnings of some type of pattern and then look for some type of evolution on the incoming bars. One thing I realized during testing is that having a “lookback” introduced latency.
Think of the strategy as a series of or layers of filters. As the strategy moves through the execution process for each bar/brick, the filters become more restrictive and constrained. My goal was to be able to back test ideas that gave me the largest profit factor with a minimum number of trades and drawdown.
Least Squares Moving Average (LSMA): This is the first layer of the three filters. J Basically, there is an entry and exit threshold that the LSMA is compared against to determine if there is a change in direction with either a crossover or crossunder. If there is a cross, then the first condition to enter a trade is met. In the strategy, this is the only configuration that is turned on by default.
Use the LSMA for Flat Detection: If enabled, will detect if the LSMA has not changed brick over brick. If this condition is detected, it will disable the entry of both longs and short. The rationale being that if flat, the market is in short term consolidation and new entries should not be made. With the LSMA length default set to 5, this rarely happens.
Use the LSMA for Full Direction Detection: This enables a couple of additional checks that can influence the order process.
Is the LSMA direction cross in sync with the price direction (e.g., if the LSMA is crossing over (up) but the brick direction is red (down), then the two are not in sync and entries should be disabled
Is the LSMA, on a crossover (up) greater than the last LSMA high (vice versa for a cross under (down)). This can detect scenarios where price is consolidating but not necessarily making new highs or lows. This will keep trades for triggering during this consolidation.
Donchian Channels: The second layer in the filters. The initial setting for this is a length of 5. By default, this layer is disabled. If enabled, then the Basis of the DC is used to filter out trades where the price is positioned contrary to it. If the DC is enabled, to enter a long trade, the close must be above the Basis and for a short, the close must be below the Basis. Otherwise, entries are disabled.
Use the Basis for Flat Detection: Like the LSMA, if bar over bar the Basis of the DC turns flat, any trades will be disabled. Like the LSMA, the purpose of this flat detection is for consolidation and to not take trades while the market is consolidating.
Use the Basis for Full Direction Detection: If enabled, like the LSMA, enforces alignment of the DC’s Basis and price direction. And, like the LSMA, if the Basis has not taken out the previous high or low, then the entry process is disabled.
For both the LSMA and the DC Channel, enabling these last two configs can become restrictive. As you experiment with them with the market of your choice, you can fine tune them to fit your trading / account style. The intent of both flat detection and the current to previous high/low is to filter out conditions that lead to price churn and trading thrash.
The indicators up to now have been reactionary to price movement. Regardless of a larger view of direct or bias, an entry is triggered; long or short. What if you want to trade with a bias or at least back test to see how it may influence your trades? What can you use to determine a bias. The method I chose in this strategy is Linear Regression.
Linear Regression: The third layer of the filters. This filter is used to determine if the trend is up, down, or flat (transitioning between up and down). Once enabled, trades will only be taken in the direction of the trend (unless in transition). With this filter, you can configure the length and the threshold to detect consolidation. The length will tune how fast a change in direction is detected while the threshold will determine how far from 0 the slope of the regression must be for it to indicate neutral.
Additional configurations: Brick Threshold to Pull Rip Cord: Once an entry is made, it can go contrary to your thinking. This setting will let you control how far you are willing for price to drive from original entry contrary to what you were thinking. Close the Position on First Brick: To keep profits close, this will exit any position (long or short) once the first brick contrary to the current position is printed. You will want to experiment with this and back test. Once it does exit, if the position is triggered again in the next several blocks, it will try to enter.
Consolidation Length: This config controls the slope threshold in the LR to differentiate from up and down.
Again, full disclosure, TradingView does not allow strategies to be published on Renko charts. If you want to experiment with it, you can convert the chart to Renko and configure it as outlined above. Then, you can experiment with various configurations and see what type of results you get. Some things to watch out for:
If you apply this to a US stock and focus on the regular session, then there will be gaps at the open that won’t appear as gaps on Renko charts. However, the strategy can try to make it look like you had a great fill on the open (which most likely is not the case). Additional work needs to be done to filter out this specific scenario
Limit orders should not be considered in the strategy on a Renko chart because the brick will only be executed when the brick prints. Market orders should only be used and only when the close for the brick prints.
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.