Hello guys I have a problem.
I want to show the close of the 1 minute candlestick yesterday at 17:00h in Probuilder.
My idea:
If yesterday and Time = 170000 Then
myclose = close
Endif
Return myclose
But “yesterday” or something like this dosn´t work.
Does somebody has any idea
It depends “from when” you want to display the 17h close of previous day…
If you want to display it from beginning of current day until close of current day, then this should do:
if time=170000 then
tempclose=close
endif
if openday<>openday[1] then
myclose=tempclose
endif
return myclose
If you want to display it from 17h previous day until 17h current day, then this other version should do it:
if time=170000 then
myclose=close
endif
return myclose
BCParticipant
Master
Hi PRT Master
How to display 3 days back of 17:00 Close?
Thanks
Here you go:
if time=170000 then
myclose2 = myclose1
myclose1 = myclose
myclose=close
endif
return myclose2
BCParticipant
Master
Thanks Vonasi.
But what if need display at day begin?
Thanks.
Change the time to 000000 or anything else.
Or do you mean as in the example from before where the 1700 close is not shown until the start of a new day? If so this should do it:
if time = 170000 then
myclose2 = myclose1
myclose1 = myclose
myclose = close
endif
if openday <> openday[1] then
myclosex = myclose2
endif
return myclosex
BCParticipant
Master
Thanks Robert
Is there any simple syntax if optimize a range (eg: from yesterday to 29 days ago) at Proorder?
BCParticipant
Master
That will be little bulky if I code like this:-
Once EndTime = 170000
Once LookBackDay = 5 // Range: 1-7
If Time = EndTime then
If LookBackDay = 1 then
TempClose1 = Close
EndIf
If LookBackDay = 2 then
TempClose2 = TempClose1
TempClose1 = Close
EndIf
If LookBackDay = 3 then
TempClose3 = TempClose2
TempClose2 = TempClose1
TempClose1 = Close
EndIf
If LookBackDay = 4 then
TempClose4 = TempClose3
TempClose3 = TempClose2
TempClose2 = TempClose1
TempClose1 = Close
EndIf
If LookBackDay = 5 then
TempClose5 = TempClose4
TempClose4 = TempClose3
TempClose3 = TempClose2
TempClose2 = TempClose1
TempClose1 = Close
EndIf
If LookBackDay = 6 then
TempClose6 = TempClose5
TempClose5 = TempClose4
TempClose4 = TempClose3
TempClose3 = TempClose2
TempClose2 = TempClose1
TempClose1 = Close
EndIf
If LookBackDay = 7 then
TempClose7 = TempClose6
TempClose6 = TempClose5
TempClose5 = TempClose4
TempClose4 = TempClose3
TempClose3 = TempClose2
TempClose2 = TempClose1
TempClose1 = Close
EndIf
Endif
If Openday <> Openday[1] then
If LookBackDay = 1 then
CloseDX = TempClose1
EndIf
If LookBackDay = 2 then
CloseDX = TempClose2
EndIf
If LookBackDay = 3 then
CloseDX = TempClose3
EndIf
If LookBackDay = 4 then
CloseDX = TempClose4
EndIf
If LookBackDay = 5 then
CloseDX = TempClose5
EndIf
If LookBackDay = 6 then
CloseDX = TempClose6
EndIf
If LookBackDay = 7 then
CloseDX = TempClose7
EndIf
EndIf
return CloseDX
TODAY instruction has changed with v11, so now the only solution is to make a loop … Previously a simple solution would be to make simple substract: TODAY-DATE<=29 (it should still work in v10.3 though), you can test it with:
once x = 29
if today-date<=x then
if time=100000 then
drawhline(close)
endif
endif
return
Not tested, please do.
I came up with this:
p = 29 //how many days ago you are looking for the close of
closetime = 170000 //the close time that you are looking for p days ago
displaytime = 000000 //the time that you want to start displaying that close time from
a = time
if barindex >= p and time = displaytime then
timecount = 0
for j = 0 to barindex
if a[j] = closetime then
timecount = timecount + 1
if timecount = p then
myclose = close[j]
break
endif
endif
next
endif
return myclose
BCParticipant
Master
Thanks Nicolas, I tested but no luck.
Thanks Vonasi, it work.
Mine is working too!!! 
Perhaps BC did not apply it to the price chart. It is very messy compared to mine so I think mine still wins!