Hello
I would need someone to help me with this indicator found in prorealcode.
It seems to me an excellent indicator and I would like to use it to be able to build a strategy but unfortunately I do not understand why it appears to me this way.
I enclose below what appears to me and what should appear.
Thank you
// --- Settings
n=120 // time span in minutes, choose parameter n equal to 15, 30, 60, 120, 180 or 240
start=080000 // time start in HHMMSS format
finish=220000 // time end in HHMMSS format
// --- End of settings
//
if n=15 then
changebarre= openminute[1]>openminute or (openminute[1]<15 and openminute>=15) or (openminute[1]<30 and openminute>=30) or (openminute[1]<45 and openminute>=45)
deltamin=1500
elsif n=30 then
changebarre= openminute[1]>openminute or (openminute[1]<30 and openminute>=30)
deltamin=3000
elsif n=60 then
changebarre= openminute[1]>openminute
deltamin=10000
elsif n=120 then
deltamin=20000
hrs=(opentime-start)/deltamin
changebarre= (hrs[1]<1 and hrs>=1) or (hrs[1]<2 and hrs>=2) or (hrs[1]<3 and hrs>=3) or (hrs[1]<4 and hrs>=4) or (hrs[1]<5 and hrs>=5) or (hrs[1]<6 and hrs>=6) or (hrs[1]<7 and hrs>=7) or (hrs[1]<8 and hrs>=8) or (hrs[1]<9 and hrs>=9) or (hrs[1]<10 and hrs>=10) or (hrs[1]<11 and hrs>=11)
elsif n=180 then
deltamin=30000
hrs=(opentime-start)/deltamin
changebarre= (hrs[1]<1 and hrs>=1) or (hrs[1]<2 and hrs>=2) or (hrs[1]<3 and hrs>=3) or (hrs[1]<4 and hrs>=4) or (hrs[1]<5 and hrs>=5) or (hrs[1]<6 and hrs>=6) or (hrs[1]<7 and hrs>=7)
elsif n=240 then
deltamin=40000
hrs=(opentime-start)/deltamin
changebarre= (hrs[1]<1 and hrs>=1) or (hrs[1]<2 and hrs>=2) or (hrs[1]<3 and hrs>=3) or (hrs[1]<4 and hrs>=4) or (hrs[1]<5 and hrs>=5)
else
DRAWTEXT("n must be 15, 30, 60, 120, 180 or 240", barindex, close)
endif
//
if changebarre then
stoque=barchange
barchange=barindex
myhigh=highest[barchange-stoque](high)[1]
mylow=lowest[barchange-stoque](low)[1]
myclose=close[1]
endif
//
if opentime>=start+deltamin and opentime<finish then
PPcama=myclose
R1cama=myclose+(myhigh-mylow)*1.1/12
R2cama=myclose+(myhigh-mylow)*1.1/6
R3cama=myclose+(myhigh-mylow)*1.1/4
R4cama=myclose+(myhigh-mylow)*1.1/2
S1cama=myclose-(myhigh-mylow)*1.1/12
S2cama=myclose-(myhigh-mylow)*1.1/6
S3cama=myclose-(myhigh-mylow)*1.1/4
S4cama=myclose-(myhigh-mylow)*1.1/2
else
PPcama=0
R1cama=0
R2cama=0
R3cama=0
R4cama=0
S1cama=0
S2cama=0
S3cama=0
S4cama=0
endif
RETURN PPcama AS "PP Camarilla", R1cama AS "R1 Camarilla", R2cama AS "R2 Camarilla", R3cama AS "R3 Camarilla", R4cama AS "R4 Camarilla", S1cama AS "S1 Camarilla", S2cama AS "S2 Camarilla", S3cama AS "S3 Camarilla", S4cama AS "S4 Camarilla"
This is the code I didn’t put above.
Because if any value is 0, it’s quite out of scale, compared to price.
Tick the option shown in my pic.
Change the way the values are displayed for the price chart: price settings / vertical axis scale and use “price only”
Ok Thanks for your answer Roberto
It works perfectly
Not related to the resolved question, but there’s a bug at line 32 above (or line 38 in the library post https://www.prorealcode.com/prorealtime-indicators/intraday-flexible-camarilla-pivot-points/), it should be:
if changebarre or (opentime[1]=start) then
Not sure why it’s in there, it’s ok in a modified version in the comments below the post. I guess I fixed it at the time while making the draft and didn’t amend too the already copied code in the draft. My apologies.