tks you Nicola, I saw it but I’m not sure it’s the same with different phase, tomorrow I will take my time to understand the code on the link you gave me and answer again, and tks again for quick answer
Phase 1 is one of those things which is easy with the eyes, but which needs coding criteria that may conclude differently for some cases… One way to not overcomplicate phase 1 coding is to consider bollinger bandwidth (variable bbw in code below) below a certain limit, chosen by user (variable bbwlimit in code below). Phases 2, 3, 4 are easy as soon as boll bandwidth is above your limit.
bbw=BollingerBandWidth[20](close)
bsup=BollingerUp[20](close)
binf=BollingerDown[20](close)
bbwlimit=0.003
if bbw<=bbwlimit then
phase=1
elsif bsup>bsup[1] and binf<binf[1] then
phase=2
elsif (bsup>bsup[1] and binf>binf[1]) or (bsup<bsup[1] and binf<binf[1]) then
phase=3
elsif bsup<bsup[1] and binf>binf[1] then
phase=4
else
phase=phase[1]
endif
return phase
I totally agree with you, and I know it’s not easy, but I study a lot for it, I will try to make something correct, about the ph1 I know it’s not easy to detect but using the volatility cycle and some other idea it will be possible to make something, for detecting the ph1 I will use the ph3 and 4 and volatility for maybe try to detect the ph1, I will come back on this thread when I will in my office this afternoon
tks you Nicola, I saw the code and try to understand it, it’s just based on moving average to detect the phase and I think it’s not like that, but it’s a good idea and it will help me to restart to program, tks again
Phase 1 is one of those things which is easy with the eyes, but which needs coding criteria that may conclude differently for some cases… One way to not overcomplicate phase 1 coding is to consider bollinger bandwidth (variable bbw in code below) below a certain limit, chosen by user (variable bbwlimit in code below). Phases 2, 3, 4 are easy as soon as boll bandwidth is above your limit.
some one can tell me how to do for my condition C1 and C2 is tru on a minimum of N bar ? I no want to use somethink like C1 = BBup > BBup[1] AND BBup[1] > BBup[2] AND …etc
// (。♥‿♥。) Block Start
BBup = BollingerUp[nBB](close)
BBDown = BollingerDown[nBB](close)
max1 = BollingerUp[nBB]
min1 = BollingerDown[nBB]
// Block End (。♥‿♥。)
// (。♥‿♥。) Block Start
// Conditions : C1/C2
C1 = BBup > BBup[1] //AND BBup[1] > BBup[2] AND BBup[2] > BBup[3]
C2 = BBDown < BBDown[1] //AND BBDown[1] < BBDown[2] AND BBDown[2] < BBDown[3]
Signal = 0
// Block End (。♥‿♥。)
AllCondition = C1 AND C2
IF AllCondition Then
Signal = 1
DRAWCANDLE(max1, min1, max1, min1) Coloured (0, 255, 0, 42)
ELSE
Signal = 0
ENDIF
Return
Hoi @ZeroCafeine
Alternatively, you could use the conditions for Phase 2 (expansion / increase in volatility):
Fase 2 => BBup > BBup[n] and BBDown < BBDown[n]
In collaboration with the slope of the average for determining the direction of the price .
tks for your help, it’s a nice idea to use the slope of the average but for me I use it now just in the ph3, it’s can help, in ph2 is more complicated,
Now I got this result but it’s just based on the direrction of the BB, I have to work more for solve some small probleme before to go to more complicated
hi every one,
I need you help pls on the ph3, you can see my picture, the ph3 start in 1 and finish in 2, so condition is :
-1) First condition the upper band turns over (only the first time), we don’t need to check what happens afterwards on the upper band as long as the lower band is descending (in the whole part 3)
-2) Second condition, the lower band turns over, in our exemple in point 2 ( and we need only the first turn over)
tks in advance for any help or idea or link
that is my code for ph3
//(。♥‿♥。)================================================(。♥‿♥。)
// Setup: SAGAT Ph3
// Code: # Sagat Ph3 v
// Version 1
// Index:
// TF:
// Spread:
// Date: 08/09/2022
// Notes: Detection de Phase 3 Bollinger
//
// Attribus:
// - BBup / BBDown
// -
// -
// Conditions:
// - C1/C2/C3 -> Ph3 Haussiere
// - C4/C5/C6 -> Ph3 Baissiere
//(。♥‿♥。)================================================(。♥‿♥。)
// (。♥‿♥。) Block Start
// Block End (。♥‿♥。)
// (。♥‿♥。) Block Start
BBup = BollingerUp[nBB](close)
BBDown = BollingerDown[nBB](close)
BBSMA = Average[nBB]
max1 = BollingerUp[nBB]
min1 = BollingerDown[nBB]
// Block End (。♥‿♥。)
// (。♥‿♥。) Block Start
// Conditions : C1/C2
C1 = BBup > BBup[1] //AND BBup[1] > BBup[2] AND BBup[2] > BBup[3]
C2 = BBDown > BBDown[1] //AND BBDown[1] < BBDown[2] AND BBDown[2] < BBDown[3]
C3 = BBSMA > BBSMA[1]
C4 = BBup < BBup[1] //AND BBup[1] > BBup[2] AND BBup[2] > BBup[3]
C5 = BBDown < BBDown[1] //AND BBDown[1] < BBDown[2] AND BBDown[2] < BBDown[3]
C6 = BBSMA < BBSMA[1]
Signal = 0
// Block End (。♥‿♥。)
AllConditions = C1 AND C2 AND C3 OR C4 AND C5 AND C6
IF AllConditions Then
Signal = 1
DRAWCANDLE(max1, min1, max1, min1) Coloured (0, 153, 255, 42)
ELSE
Signal = 0
ENDIF
Return
@JS
tks for your answer, I saw it only now, maybe my second question can answer you, the problem with a code like BBup > BBup[n] and BBDown < BBDown[n] it’s not good for me, because I have to control each BB and not just the BB[0] with the BB[n], I have to know what happen with the BB1, BB2, …., BB[n]
hi every one,
I need you help pls on the ph3, you can see my picture, the ph3 start in 1 and finish in 2, so condition is :
-1) First condition the upper band turns over (only the first time), we don’t need to check what happens afterwards on the upper band as long as the lower band is descending (in the whole part 3)
-2) Second condition, the lower band turns over, in our exemple in point 2 ( and we need only the first turn over)
tks in advance for any help or idea or link
that is my code for ph3
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR.
For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com
If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.
Get Assistance
Assistance Type
Your Need
Proposed Solutions
Do you like cookies? 🍪 We use cookies to ensure you get the best experience on our website.
(Learn more)