Parabolic SAR Code
Forums › ProRealTime English forum › ProBuilder support › Parabolic SAR Code
- This topic has 16 replies, 2 voices, and was last updated 3 years ago by robertogozzi.
Tagged: parabolic, parabolic sar, SAR
-
-
01/13/2018 at 11:29 PM #5939401/14/2018 at 12:24 AM #59397
general background: http://www.incrediblecharts.com/indicators/parabolic_sar.php
formula stuff: http://www.tradesignalonline.com/lexicon/view.aspx?id=12528&se=PSAR
1 user thanked author for this post.
01/14/2018 at 12:20 PM #59421Hi Tom,
Here you have the code of SAR from an Italian forum :
have a nice day
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465// SAR - Parabolic SAR 11.11.13// Questo codice vi propone l’algoritmo per la riproduzione del Parabolic SAR// Parametri// increment (increment = 0.02)// initial (initial = 0.02)// limite (limite = 0.2)IF BARINDEX < 2 THENparabolic = LOWislong = 1af = limitehp = HIGHlp = LOWELSEIF islong THENparabolic = parabolic + af * (hp - parabolic)parabolic = MIN(parabolic, LOW[1])parabolic = MIN(parabolic, LOW[2])ELSEparabolic=parabolic + af * (lp - parabolic)parabolic=MAX(parabolic, HIGH[1])parabolic=MAX(parabolic, HIGH[2])ENDIFreverse = 0IF islong THENIF LOW < parabolic THENislong = 0reverse = 1parabolic = hplp = LOWaf = initialENDIFELSEIF HIGH > parabolic THENislong = 1reverse =1parabolic = lphp = HIGHaf = initialENDIFENDIFIF NOT reverse THENIF islong THENIF HIGH > hp THENhp = HIGHaf = af + incrementaf = MIN (af,limite)ENDIFELSEIF LOW < lp THENlp = LOWaf = af + incrementaf = MIN (af,limite)ENDIFENDIFENDIFENDIF////////////////////////////////////////////////////////////////RETURN parabolic as " parabolic "01/14/2018 at 12:43 PM #59429Here you have another code of SAR
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455REM SARif barindex < 2 thenfacteur = 0.02tmpSAR = lowextreme = lowtendance = 1elseif tendance[ 1 ] = 1 thenextreme = max( extreme[ 1 ], high )if tmpSAR[1] > low thentendance = -1facteur = 0.02tmp = max(high,high[1])tmpSAR = max(extreme, tmp)extreme = lowelseif extreme > extreme[1] and facteur <0.2 thenfacteur = facteur+0.02endiftmpSAR = tmpSAR[1]+facteur*(extreme-tmpSAR[1])tmp = min(low,low[1])tmpSAR = min(tmpSAR,tmp)endifelseextreme = min( extreme[ 1 ], low )if tmpSAR[1] <high thentendance = 1facteur = 0.02tmp = min(low,low[1])tmpSAR = min(extreme,tmp)extreme = highelseif extreme < extreme[1] and facteur <0.2 thenfacteur = facteur+0.02endiftmpSAR = tmpSAR[1]+facteur*(extreme-tmpSAR[1])tmp = max(high,high[1])tmpSAR = max(tmpSAR,tmp)endifendifendifif tmpSAR>=tmpSAR[1] thencol=1elsecol=-1endifreturn tmpSAR[1] coloured by col as "SAR"07/07/2018 at 4:16 AM #75515Thanks for sharing this. I’m having difficulty when adjusting the 3 variables of initial, increment and limite. I want the pSAR to be highly sensitive (ie. change from under to over at the slightest provocation), but it seems PRT has a lower limit on such a display. Is this correct? Is there a way to get around this limitation? Regards.
07/08/2018 at 10:31 AM #7556807/08/2018 at 10:37 AM #75570Thank you, yes I tried adjusting them several times. Someone explained to me that it’s possible PRT used a slightly different code for the SAR. There are a few different ones around. I’m trying to replicate what I have on another platform. If I can get the code for it, I’m hoping you or someone else might be able to translate it for me. Is there a place where I can request a translation please?
07/08/2018 at 1:52 PM #75584If the code is not copyright protected, you can freely create a new topic following this procedure (for MT4 code conversion or any other trading platform):
07/11/2018 at 6:46 AM #75758I’ve asked the author and he’s strict with sharing his work. So I can’t do that.
But I wonder if you’d help. I’ve tried modifying both of the codes above to achieve a greater responsiveness (ie. a choppier pSAR) and can’t get that happening.
07/11/2018 at 8:58 AM #7576507/11/2018 at 9:15 AM #7576907/11/2018 at 10:19 AM #75772ok, but that’s already very fast with the settings I gave in the last post. Since I have no clue of what you expect to be more responsive, could you please share with me some screenshots of the other indicator you talked about? Thank you.
07/11/2018 at 11:32 AM #7578507/12/2018 at 9:15 AM #7584607/23/2021 at 9:58 AM #174047Please see in next post the code from the ‘SAR ATD’ indicator in French.
Actually this indicator is not OK, because the SAR should not reverse if touched but not crossed at the close of the period.
See this example were the SAR reverses whereas it should not.Can anyone help provide the right code modification to get this result?
Best regards
-
AuthorPosts
Find exclusive trading pro-tools on