Central Pivot point with Top and bottom Buffer
Forums › ProRealTime English forum › ProBuilder support › Central Pivot point with Top and bottom Buffer
- This topic has 4 replies, 2 voices, and was last updated 3 years ago by robertogozzi.
-
-
08/14/2021 at 10:48 AM #175302
I wrote a code shown below
1234567891011121314151617181920212223242526272829303132333435363738394041DefParam DrawOnLastBarOnly = trueH1 = DHigh(1)L1 = DLow(1)C1 = DClose(1)PDC=c1PDH=H1PDL=L1PPDAY = (H1 + L1 + C1) / 3BCPRT=((H1 + L1)/2 )-10BCPR= (H1 + L1)/2TCPR =(PPDay-BCPR)+PPDayTCPRT=((PPDay-BCPR)+PPDay) +10DRAWsegment(barindex-1,PPDay,barindex,PPDay)DRAWsegment(barindex-1,BCPR,barindex,BCPR)DRAWsegment(barindex-1,TCPR,barindex,TCPR)drawtext(“TCPR”,barindex,TCPR,SansSerif,Bold,13)drawtext(“BCPR”,barindex,BCPR,SansSerif,Bold,13)drawtext(“PPDay”,barindex,PPDay,SansSerif,Bold,13)//drawtext(“PDC”,barindex,PDC,SansSerif,Bold,13)RETURN TCPR AS ” TCPR” ,BCPR AS “BCPR”, PPDay as “PPDay”I want to put condition on this code
At times BCPR is greater than TCPR
So I will like to add
If BCPR is greater than TCPR then
BCPR=((H1 + L1)/2 )+10
TCPR=((PPDay-BCPR)+PPDay) -10
If TCPR is greater than BTCPR then
TCPR=((H1 + L1)/2 )+10
BCPR=((PPDay-BCPR)+PPDay) -10
08/14/2021 at 11:23 AM #175306There you go:
1234567891011121314151617181920212223242526272829DefParam DrawOnLastBarOnly = trueH1 = DHigh(1)L1 = DLow(1)C1 = DClose(1)PDC=c1PDH=H1PDL=L1PPDAY = (H1 + L1 + C1) / 3BCPRT=((H1 + L1)/2 )-10BCPR= (H1 + L1)/2TCPR =(PPDay-BCPR)+PPDayTCPRT=((PPDay-BCPR)+PPDay) +10///////////////////////////////If BCPR > TCPR thenBCPR=((H1 + L1)/2 )+10TCPR=((PPDay-BCPR)+PPDay) -10ELSIf TCPR > BCPR thenTCPR=((H1 + L1)/2 )+10BCPR=((PPDay-BCPR)+PPDay) -10ENDIF//////////////////////////////DRAWsegment(barindex-1,PPDay,barindex,PPDay)DRAWsegment(barindex-1,BCPR,barindex,BCPR)DRAWsegment(barindex-1,TCPR,barindex,TCPR)drawtext("TCPR",barindex,TCPR,SansSerif,Bold,13)drawtext("BCPR",barindex,BCPR,SansSerif,Bold,13)drawtext("PPDay",barindex,PPDay,SansSerif,Bold,13)//drawtext("PDC",barindex,PDC,SansSerif,Bold,13)RETURN TCPR AS " TCPR" ,BCPR AS "BCPR", PPDay as "PPDay"08/14/2021 at 12:23 PM #175314Thanks for the prompt response.I have re-written it but it is showing blank. Please help
123456789101112131415161718192021222324252627282930313233//DefParam DrawOnLastBarOnly = trueH1 = DHigh(1)L1 = DLow(1)C1 = DClose(1)PDC=c1PDH=H1PDL=L1PPDAY = (H1 + L1 + C1) / 3BCPR= (H1 + L1)/2TCPR =(PPDay-BCPR)+PPDay///////////////////////////////If BCPR > TCPR thenBCPRT=((H1 + L1)/2 )+10TCPRT=((PPDay-BCPR)+PPDay) -10ELSIf TCPR > BCPR thenTCPRT=((H1 + L1)/2 )+10BCPRT=((PPDay-BCPR)+PPDay) -10ENDIF//////////////////////////////DRAWsegment(barindex-1,PPDay,barindex,PPDay)DRAWsegment(barindex-1,BCPR,barindex,BCPR)DRAWsegment(barindex-1,TCPR,barindex,TCPR)DRAWsegment(barindex-1,BCPRT,barindex,BCPRt)DRAWsegment(barindex-1,TCPRT,barindex,TCPRT)drawtext(“TCPR”,barindex,TCPR,SansSerif,Bold,13)drawtext(“BCPR”,barindex,BCPR,SansSerif,Bold,13)drawtext(“PPDay”,barindex,PPDay,SansSerif,Bold,13)drawtext(“TCPRT”,barindex,TCPRT,SansSerif,Bold,13)drawtext(“BCPRT”,barindex,BCPRT,SansSerif,Bold,13)//drawtext(“PDC”,barindex,PDC,SansSerif,Bold,13)RETURN TCPR AS ” TCPR” ,BCPR AS “BCPR”, PPDay as “PPDay”,TCPRT AS ” TCPRT” ,BCPRT AS “BCPRT”08/14/2021 at 1:21 PM #175329I’ll check next week.
08/17/2021 at 10:56 AM #175526It works fine, with 10K units (if you use 200K units, then you’ll have to wait some time).
I added +5 to BARINDEX when displaying text, so it is plotted in the future (a feature added in v11) and doesn’t make a mess with data lines:
123456789101112131415161718192021222324252627282930313233DefParam DrawOnLastBarOnly = trueH1 = DHigh(1)L1 = DLow(1)C1 = DClose(1)PDC=c1PDH=H1PDL=L1PPDAY = (H1 + L1 + C1) / 3BCPR= (H1 + L1)/2TCPR =(PPDay-BCPR)+PPDay///////////////////////////////If BCPR > TCPR thenBCPRT=((H1 + L1)/2 )+10TCPRT=((PPDay-BCPR)+PPDay) -10ELSIf TCPR > BCPR thenTCPRT=((H1 + L1)/2 )+10BCPRT=((PPDay-BCPR)+PPDay) -10ENDIF//////////////////////////////DRAWsegment(barindex-1,PPDay,barindex,PPDay)DRAWsegment(barindex-1,BCPR,barindex,BCPR)DRAWsegment(barindex-1,TCPR,barindex,TCPR)DRAWsegment(barindex-1,BCPRT,barindex,BCPRt)DRAWsegment(barindex-1,TCPRT,barindex,TCPRT)drawtext("TCPR",barindex+5,TCPR,SansSerif,Bold,13)drawtext("BCPR",barindex+5,BCPR,SansSerif,Bold,13)drawtext("PPDay",barindex+5,PPDay,SansSerif,Bold,13)drawtext("TCPRT",barindex+5,TCPRT,SansSerif,Bold,13)drawtext("BCPRT",barindex+5,BCPRT,SansSerif,Bold,13)//drawtext("PDC",barindex,PDC,SansSerif,Bold,13)RETURN TCPR AS " TCPR" ,BCPR AS "BCPR", PPDay as "PPDay",TCPRT AS " TCPRT" ,BCPRT AS "BCPRT" -
AuthorPosts
Find exclusive trading pro-tools on