outsidebar trading code
Forums › ProRealTime English forum › ProBuilder support › outsidebar trading code
- This topic has 17 replies, 4 voices, and was last updated 2 days ago by
GraHal.
-
-
06/30/2025 at 6:05 PM #248598Can someone help me, i get an error with outsidebar code: the following variable is not defined: Signalbarheight//SignalbarHeight=5if range>=SignalbarHeight*pipsize thenif high>high[1] and close<low[1] thenbear=1bull=0elsif low<low[1] and close>high[1] thenbull=1bear=0elsebear=0bull=0endifelsebear=0bull=0endifoffset=AverageTrueRange[14](close)*2if bear thenDRAWARROWDOWN(barindex, high+offset) coloured(255,0,0)elsif bull thenDRAWARROWUP(barindex, low–offset) coloured(0,255,0)endifreturn06/30/2025 at 7:03 PM #24859906/30/2025 at 7:04 PM #248600
Hi,
try deleting the // at beginning of the first line: //SignalbarHeight=5
SignalbarHeight=5
if range>=SignalbarHeight*pipsize thenif high>high[1] and close<low[1] thenbear=1bull=0elsif low<low[1] and close>high[1] thenbull=1bear=0elsebear=0bull=0endifelsebear=0bull=0endifoffset=AverageTrueRange[14](close)*2if bear thenDRAWARROWDOWN(barindex, high+offset) coloured(255,0,0)elsif bull thenDRAWARROWUP(barindex, low–offset) coloured(0,255,0)endifreturn06/30/2025 at 7:05 PM #248602(Roberto was faster)
1 user thanked author for this post.
07/08/2025 at 8:06 PM #24873707/09/2025 at 11:10 AM #24875207/09/2025 at 12:09 PM #248753This is de code i use.
SignalbarHeight=5
if range>=SignalbarHeight*pipsize then
if high>high[1] and close<low[1] then
bear=1
bull=0
elsif low<low[1] and close>high[1] then
bull=1
bear=0
else
bear=0
bull=0
endif
else
bear=0
bull=0
endif
offset=AverageTrueRange[14](close)*2
if bear then
DRAWARROWDOWN(barindex, high+offset) coloured(255,0,0)
elsif bull then
DRAWARROWUP(barindex, low-offset) coloured(0,255,0)
endif07/09/2025 at 12:19 PM #24875407/09/2025 at 12:39 PM #24875607/09/2025 at 12:54 PM #248757So using the attached Settings for Alerts … which conditions are you using to try and set an Alert for the Outside bar?
As you cannot set an Alert for when an ‘Arrow’ is visible – the only other option surely – is you would need to set conditions for all the Conditions that make up the Indicator (and thus be independent of the Indicator code producing Arrows??) ?
Maybe I need more coffee?? 🙂
07/09/2025 at 1:37 PM #24875907/09/2025 at 4:15 PM #248765The last code you posted (after appending RETURN), works like a charm on different timeframes and different units:
123456789101112131415161718192021222324SignalbarHeight=5if range>=SignalbarHeight*pipsize thenif high>high[1] and close<low[1] thenbear=1bull=0elsif low<low[1] and close>high[1] thenbull=1bear=0elsebear=0bull=0endifelsebear=0bull=0endifoffset=AverageTrueRange[14](close)*2if bear thenDRAWARROWDOWN(barindex, high+offset) coloured(255,0,0)elsif bull thenDRAWARROWUP(barindex, low-offset) coloured(0,255,0)endifRETURNIn any case I suggest using this simplified version:
1234567891011121314151617SignalbarHeight=5bear=0bull=0if range>=SignalbarHeight*pipsize thenif high>high[1] and close<low[1] thenbear=1elsif low<low[1] and close>high[1] thenbull=1endifendifoffset=AverageTrueRange[14](close)*2if bear thenDRAWARROWDOWN(barindex, high+offset) coloured(255,0,0)elsif bull thenDRAWARROWUP(barindex, low-offset) coloured(0,255,0)endifRETURN1 user thanked author for this post.
07/09/2025 at 4:17 PM #248768Here you go.
Add the code below as a ‘New Panel’ and then set Alert on value = 1 (bull) or value = -1 (bear)
1234567891011121314151617181920212223242526SignalbarHeight=5if range>=SignalbarHeight*pipsize thenif high>high[1] and close<low[1] thenbear=1bull=0elsif low<low[1] and close>high[1] thenbull=1bear=0elsebear=0bull=0endifelsebear=0bull=0endif//offset=AverageTrueRange[14](close)*2if bear thenbear = -1//DRAWARROWDOWN(barindex, high+offset) coloured(255,0,0)elsif bull thenbull = 1//DRAWARROWUP(barindex, low-offset) coloured(0,255,0)endifReturn bear, bull2 users thanked author for this post.
07/09/2025 at 7:38 PM #24877107/09/2025 at 7:41 PM #248772 -
AuthorPosts
Find exclusive trading pro-tools on