Can someone finish the syntax on this non functioning code.
Forums › ProRealTime English forum › ProBuilder support › Can someone finish the syntax on this non functioning code.
- This topic has 6 replies, 2 voices, and was last updated 6 years ago by Nicolas.
-
-
08/10/2018 at 10:36 PM #77992
Hi, Can anyone fix this code?
It was posted here on PRT but has a minor syntax error if anyone can fix it that’d be appreciated as I wanted to compare it to the code I modified from another site and posted here:
https://www.prorealcode.com/topic/kase-dev-stop-dev-stops-4-5-6-0-using-sar-to-flip-devs/Cheers
BardKase Dev Stop Loss Using SAR1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556//Kase Deviation Stoploss Bandsn = 30DTR = max(max(High - Low[2], abs(High - Close[2])),max(abs(Low - Close[2]),(abs(Low - Close[2]))))avg = average[n](DTR)st = std[n](DTR)maFast = average[9,1](close)maSlow = average[21,1](close)once DevInit = 1If DevInit = 1 ThenIf maFast > maSlow ThenDevLong = 1DevLongC = 0ElseDevLong = 0DevShortC = 0EndIfDevInit = 0ElsIf DevInit = 0 and DevLong = 1 ThenHighestDev3 = Dev3For y = 1 to DevLongC DoIf Dev3[y] > HighestDev3 ThenHighestDev3 = Dev3[y]EndIfNextIf close < HighestDev3 ThenDevLong = 0DevShortC = 0EndIfElsIf DevInit = 0 and DevLong = 0 ThenLowestDev3 = Dev3For x = 1 to DevShortC DoIf Dev3[x] < LowestDev3 ThenDevLong = 1DevLongC = 0EndIfEndIfIf DevLong = 1 ThenDevLongC = DevLongC + 1//WarningLine = typicalprice-avg//Dev1 = typicalprice-avg - stDev2 = typicalprice-avg - 2.2*stDev3 = typicalprice-avg - 3.6*stElsIf DevLong = 0 ThenDevShortC = DevShortC + 1//WarningLine = typicalprice+avg//Dev1 = typicalprice+avg + stDev2 = typicalprice+avg + 2.2*stDev3 = typicalprice+avg + 3.6*stEndIfReturn Dev2 coloured(2, 118, 253) style(dottedline,2) as "Dev Stop 2.2",Dev3 coloured(2, 118, 253) style(dottedline,2) as "Dev Stop 3.6"08/16/2018 at 10:21 AM #78350I fixed the syntax error of your code, don’t know if the indicator is computing correctly though, here it is:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556//Kase Deviation Stoploss Bandsn = 30DTR = max(max(High - Low[2], abs(High - Close[2])),max(abs(Low - Close[2]),(abs(Low - Close[2]))))avg = average[n](DTR)st = std[n](DTR)maFast = average[9,1](close)maSlow = average[21,1](close)once DevInit = 1If DevInit = 1 ThenIf maFast > maSlow ThenDevLong = 1DevLongC = 0ElseDevLong = 0DevShortC = 0EndIfDevInit = 0ElsIf DevInit = 0 and DevLong = 1 ThenHighestDev3 = Dev3For y = 1 to DevLongC DoIf Dev3[y] > HighestDev3 ThenHighestDev3 = Dev3[y]EndIfNextIf close < HighestDev3 ThenDevLong = 0DevShortC = 0EndIfElsIf DevInit = 0 and DevLong = 0 ThenLowestDev3 = Dev3For x = 1 to DevShortC DoIf Dev3[x] < LowestDev3 ThenDevLong = 1DevLongC = 0EndIfnextIf DevLong = 1 ThenDevLongC = DevLongC + 1//WarningLine = typicalprice-avg//Dev1 = typicalprice-avg - stDev2 = typicalprice-avg - 2.2*stDev3 = typicalprice-avg - 3.6*stElsIf DevLong = 0 ThenDevShortC = DevShortC + 1//WarningLine = typicalprice+avg//Dev1 = typicalprice+avg + stDev2 = typicalprice+avg + 2.2*stDev3 = typicalprice+avg + 3.6*stEndIfendifReturn Dev2 coloured(2, 118, 253) style(dottedline,2) as "Dev Stop 2.2",Dev3 coloured(2, 118, 253) style(dottedline,2) as "Dev Stop 3.6"08/16/2018 at 2:39 PM #7838308/16/2018 at 3:30 PM #7839708/16/2018 at 6:01 PM #7840908/16/2018 at 9:27 PM #78417Note sure why this image didn’t attach with the post above about juanj’s code not working but his Dev Stop lines are flat horizontal lines on the indicator window and don’t appear at all when applied to the main Price chart window. (The Kase Dev Stops are similar to ATR bands).
Cheers, hope this makes sense.
08/17/2018 at 12:16 PM #78455 -
AuthorPosts
Find exclusive trading pro-tools on