draw segments around signal bar
Forums › ProRealTime English forum › ProBuilder support › draw segments around signal bar
- This topic has 5 replies, 2 voices, and was last updated 9 months ago by samm85.
-
-
02/01/2024 at 1:00 PM #227238
Hi, I have a problem, I cannot get this to draw a segment around the signal bar in question. What I am aiming to do is bracket the closing bar with horizontal segments if the conditions (below) are met at the bar close. I have it drawing the arrows but I have taken out my attempt to draw segments. Ideally I would like it to remove the segments around previous signals so only one set of segments are shown at a time. I would like the segments to span 8 bars into the future. I cannot get it to even draw the segments and coding the removal of the last signal is beyond my understanding. Any help would be greatly appreciated.
DEFPARAM DRAWONLASTBARONLY = TRUE
CONDITIONS = CLOSE > HIGH[1] AND CLOSE > HIGH[2]
CONDITION2 =CLOSE < LOW[1] AND CLOSE < LOW[2]
if conditions and not conditions[1] then
drawarrowUP(barindex,low-10) COLOURED (0,255,0)
ELSIF CONDITION2 AND NOT CONDITIONS THEN
drawarrowDOWN(barindex,HIGH+10) COLOURED (255,0,0)
endif
return
02/01/2024 at 3:38 PM #227251Hi,
I understand the part about seeing only the latest set of segments implying a set has to disappear when a new one comes along, not just be visible on signal bar only and disappear. However it doesn’t say if you want segments to remain drawn from latest barindex to barindex+8 while bars slide, or if you want the segments to stay attached to signal barindex and slide into the past with it (so stop segments on bar8,+7,+6 etc… each time a new barindex starts). Here is a version making the assumption to let them slide into the past until replaced:
1234567891011121314151617181920212223242526//DEFPARAM DRAWONLASTBARONLY = TRUECONDITIONS = CLOSE > HIGH[1] AND CLOSE > HIGH[2]CONDITION2 =CLOSE < LOW[1] AND CLOSE < LOW[2]if conditions and not conditions[1] thendrawarrowUP(barindex,low-10) COLOURED (0,255,0)memobar=barindexmemolow=lowmemohigh=highELSIF CONDITION2 AND NOT CONDITIONS THENdrawarrowDOWN(barindex,HIGH+10) COLOURED (255,0,0)memobar=barindexmemolow=lowmemohigh=highendifDRAWSEGMENT(memobar, memohigh, memobar+8, memohigh)DRAWSEGMENT(memobar, memolow, memobar+8, memolow)return1 user thanked author for this post.
02/01/2024 at 4:14 PM #22725202/02/2024 at 3:33 PM #227327Hi, I wonder if you could help me again.
For back testing purposes I removed the “drawonlastbaronly” condition but rather obviously it displays every instance the signal was made. Can the code be modified to display the condition only after an opposite signal has been made. I have tried to illustrate the idea with the attached, the main image being what it displays now and the inset image is what im aiming for. So it would display the first buy signal bracket and then doesn’t bracket another bar unless a sell signal arrives, then a buy signal then a sell signal and so on.
Thanks
Sam
02/02/2024 at 5:56 PM #227340Hi,
switching to drawonlastbaronly=false, and ignoring signals on same side as previous one until an opposite signal occurs:
1234567891011121314151617181920212223242526272829303132DEFPARAM DRAWONLASTBARONLY = false//TRUEonce sigup=1once sigdown=1CONDITIONS = CLOSE > HIGH[1] AND CLOSE > HIGH[2]CONDITION2 =CLOSE < LOW[1] AND CLOSE < LOW[2]if conditions and not conditions[1] and sigdown thendrawarrowUP(barindex,low-10) COLOURED (0,255,0)memobar=barindexmemolow=lowmemohigh=highsigup=1sigdown=0ELSIF CONDITION2 AND NOT CONDITIONS and sigup THENdrawarrowDOWN(barindex,HIGH+10) COLOURED (255,0,0)memobar=barindexmemolow=lowmemohigh=highsigup=0sigdown=1endifDRAWSEGMENT(memobar, memohigh, memobar+8, memohigh)DRAWSEGMENT(memobar, memolow, memobar+8, memolow)return1 user thanked author for this post.
02/03/2024 at 11:20 AM #227351 -
AuthorPosts
Find exclusive trading pro-tools on