Hello,
I'm trying to create a block strategy based on candlestick reversals.
Basically, when the stock is in oversold area and one of the bullish reversal candlesticks appear, I'd like to wait until the first green candle breaks above EMA 8 and then buy the next day open or the same day before close. At the same time, the "oversold area" indicator should be "going up" from oversold at the time that green candle triggers the buy. And... it may take a few days before the reversal candle and the buy trigger candle. Let's say up to 5 days.
The Sell signal would be basically the opposite.
An example for the BUY might be the DISC stock on 23rd Oct 2023 - reversal candle in oversold area. Then the green trigger candle came on 26th.
I found it difficult to:
- search for "any reversal candlestick" ... I need to list them all in the Multi COndition group
- find out if "one of the previous 5 candles was a reversal candle and at the same time, the stock was in oversold area at that time" - that would require nested Multi Condition Group but the system actually thrown an error when trying that
- find out that an indicator is "growing" or "declining"
Any ideas?
I'm trying to create a block strategy based on candlestick reversals.
Basically, when the stock is in oversold area and one of the bullish reversal candlesticks appear, I'd like to wait until the first green candle breaks above EMA 8 and then buy the next day open or the same day before close. At the same time, the "oversold area" indicator should be "going up" from oversold at the time that green candle triggers the buy. And... it may take a few days before the reversal candle and the buy trigger candle. Let's say up to 5 days.
The Sell signal would be basically the opposite.
An example for the BUY might be the DISC stock on 23rd Oct 2023 - reversal candle in oversold area. Then the green trigger candle came on 26th.
I found it difficult to:
- search for "any reversal candlestick" ... I need to list them all in the Multi COndition group
- find out if "one of the previous 5 candles was a reversal candle and at the same time, the stock was in oversold area at that time" - that would require nested Multi Condition Group but the system actually thrown an error when trying that
- find out that an indicator is "growing" or "declining"
Any ideas?
Rename
QUOTE:We could put a rule like that in the PowerPack. Please make a feature request for it.
- search for "any reversal candlestick" ... I need to list them all in the Multi COndition group
QUOTE:There will always be complex rules like this that you won't be able to do with blocks. If you need something like this done for C# Strategy Code, consider the Concierge Service for custom programming jobs and consulting.
- find out if "one of the previous 5 candles was a reversal candle and at the same time, the stock was in oversold area at that time"
QUOTE:This one is easy. Use the conditon Indicator Compare to Value and insert Transformer Indicator IndOnInd to apply a ROC to your other indicator. Choose a period for ROC (for this purpose I like 2 bars). If the result is above 0, it's growing, and vice-versa.
- find out that an indicator is "growing" or "declining"
A simpler way would be to use Indicator Compare to Indicator, select the same indicator in both parameters, and select some value greater than zero for Number of Bars Ago.
>>search for "any reversal candlestick" ... I need to list them all in the Multi COndition group<<
I think we could add a new Condition in the Chart Pattern Extension, something like Candle in Candle Group. And give you the ability to create your own Candle Groups.
>> find out if "one of the previous 5 candles was a reversal candle and at the same time, the stock was in oversold area at that time<<
The Candle Group Condition would work for this, coupled with the Within the Past N Bars Qualifier.
I think we could add a new Condition in the Chart Pattern Extension, something like Candle in Candle Group. And give you the ability to create your own Candle Groups.
>> find out if "one of the previous 5 candles was a reversal candle and at the same time, the stock was in oversold area at that time<<
The Candle Group Condition would work for this, coupled with the Within the Past N Bars Qualifier.
The Candle Group Condition?
If it were a MultiConditionGroup for the last 3 bars, and the the candle result was "true" 3 bars ago, how would youy= determine/confirm if it were oversold at the time the condition was true precisely 3 bars ago? We're asking about blocks here.
If it were a MultiConditionGroup for the last 3 bars, and the the candle result was "true" 3 bars ago, how would youy= determine/confirm if it were oversold at the time the condition was true precisely 3 bars ago? We're asking about blocks here.
Imagine a new Candle Group Condition Building Block that resolves true if the current bar is one of a user-defined group of candles. The user could create a group called "Reversal Candles."
Am I not making myself clear?
Am I not making myself clear?
It's clear now.
The term "The Candle Group Condition" was only mentioned once and it sounded like it already existed.
The term "The Candle Group Condition" was only mentioned once and it sounded like it already existed.
To get it completely though we’d need to add the ability to drop of Qualifier on a MCG. Because we want to detect the Candle Group AND an oversold indicator that both happen within the past 5 bars.
A Qualifier on a MCG would open up options like this.
A Qualifier on a MCG would open up options like this.
QUOTE:
This one is easy. Use the conditon Indicator Compare to Value and insert Transformer Indicator IndOnInd to apply a ROC to your other indicator. Choose a period for ROC (for this purpose I like 2 bars). If the result is above 0, it's growing, and vice-versa.
Not sure I got this properly... would the image below be a correct setup in case I want to model a condition that a stock's 200 SMA is continuously growing for the last 20 bars?
Assuming you mean the SMA200 is moving up for 20 consecutive bars this is how I'd do it,
OK, makes sense. Yes, your assumption is correct.
Thx :)
Thx :)
Actually, there is one drawback of this solution. The backtester does not perform any trades within the first year of trading... before the SMA 200 is able to fully load.
It's not a big deal perhaps, I simply added one more year in the beginning. It's just that you need to know about it.
It's not a big deal perhaps, I simply added one more year in the beginning. It's just that you need to know about it.
Aha... except that the Benchmark's profit IS calculated in the first year so the results are then not perfectly comparable.
Sure, we know. That's why the metrics and trading begin at the "StartIndex", which is the longest period at which all indicators in your strategy are valid. It's calculated and assigned in the Initialize() method of your strategy, which you can see if you "Open as a C# Strategy".
The benchmark also begins at StartIndex so it won’t use the first year if it’s assigned properly.
Here his strategy can be done because it requires 2 conditions over a given time, thanks to within the past N bars (oversold + reversal candle).
But let's imagine that I ask for a 3rd condition such as for example an impulsive candle with a volume 300% higher than the previous one, but I want this condition to be achieved after the two conditions have been validated.
In this case we come back to my request for “flex” (compliance/respect with orders).
https://www.wealth-lab.com/Discussion/OR-condition-with-multiple-Condition-Blocks-9132
https://help.tc2000.com/m/69401/l/1200586-how-to-use-flex-scan-conditions
To keep it simple, add a condition "if block N is true:" and number the blocks or in the multiple condition group style "order of blocks".
But I guess considering blocks as a condition must be very heavy on the machines.
But let's imagine that I ask for a 3rd condition such as for example an impulsive candle with a volume 300% higher than the previous one, but I want this condition to be achieved after the two conditions have been validated.
In this case we come back to my request for “flex” (compliance/respect with orders).
https://www.wealth-lab.com/Discussion/OR-condition-with-multiple-Condition-Blocks-9132
https://help.tc2000.com/m/69401/l/1200586-how-to-use-flex-scan-conditions
To keep it simple, add a condition "if block N is true:" and number the blocks or in the multiple condition group style "order of blocks".
But I guess considering blocks as a condition must be very heavy on the machines.
You can get your order by adding the N Bars Ago qualifier to each of the conditions. If you need A to occur before B which has to occur before C, you would put 2 bars ago on A and 1 bar ago on B.
Hi Ramsa,
We're not going to change the whole architecture to add a "flex." Can you spell out the complete and exact rules you're looking to achieve? With the recent added flexibility in our Building Blocks it's likely already possible.
We're not going to change the whole architecture to add a "flex." Can you spell out the complete and exact rules you're looking to achieve? With the recent added flexibility in our Building Blocks it's likely already possible.
Your Response
Post
Edit Post
Login is required