Creating a Kagi Bear condition
Forums › ProRealTime English forum › ProOrder support › Creating a Kagi Bear condition
- This topic has 4 replies, 2 voices, and was last updated 6 years ago by
soulintact.
-
-
09/23/2019 at 8:37 AM #108201
Dear all,
I am trying to create a Bear condition out of Nicola’s excellent Kagi on price chart. I get a syntax error, and I cannot understand why. Anyone spotting the error, thanks!
Bear condition out of Kagi on price1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253//PRC_Kagi on price chart | indicator//05.09.2019//Nicolas @ www.prorealcode.com//Sharing ProRealTime knowledge// --- settings// select one of the two possible setting (0=don't use)ReversalAmountPercent = 1.5 //amount of price percent to inverse Kagi trend//ReversalAmountPoints = 0 //amount of points to inverse Kagi trend// --- end of settingsonce kagi=closeif ReversalAmountPercent>0 then//percent retracementpup = (close-kagi)/kagipdn = (kagi-close)/kagiInvDec = 1/0.1//bullish reversalif pup>=ReversalAmountPercent/100 thencoeff = abs(pup/ReversalAmountPercent)*100coeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi+(kagi*(ReversalAmountPercent/100)*coeff)endif//bearish reversalif pdn>=ReversalAmountPercent/100 thencoeff = abs(pdn/ReversalAmountPercent)*100coeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi-(kagi*(ReversalAmountPercent/100)*coeff)endifif ReversalAmountPoints>0 then//points retracementpup = close-kagipdn = kagi-closeInvDec = 1//bullish reversalif pup>=ReversalAmountPoints*pointsize thencoeff = (pup/pointsize)/ReversalAmountPointscoeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi+(ReversalAmountPoints*pointsize)*coeffendif//bearish reversalif pdn>=ReversalAmountPoints*pointsize thencoeff = (pdn/pointsize)/ReversalAmountPointscoeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi-(ReversalAmountPoints*pointsize)*coeffendifBearKagi=(pdn>=ReversalAmountPercent/100) or (pdn>=ReversalAmountPoints*pointsize)09/23/2019 at 10:06 AM #108215The “ReversalAmountPoints” is still commented in your code at line 9.
1 user thanked author for this post.
09/23/2019 at 12:12 PM #108245Thanks Nicolas. It was careless of me. Unfortunately, I still get the syntax error message. Any more observations or possible ideas, thanks!
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253//PRC_Kagi on price chart | indicator//05.09.2019//Nicolas @ www.prorealcode.com//Sharing ProRealTime knowledge// --- settings// select one of the two possible setting (0=don't use)ReversalAmountPercent = 1.5 //amount of price percent to inverse Kagi trendReversalAmountPoints = 0 //amount of points to inverse Kagi trend// --- end of settingsonce kagi=closeif ReversalAmountPercent>0 then//percent retracementpup = (close-kagi)/kagipdn = (kagi-close)/kagiInvDec = 1/0.1//bullish reversalif pup>=ReversalAmountPercent/100 thencoeff = abs(pup/ReversalAmountPercent)*100coeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi+(kagi*(ReversalAmountPercent/100)*coeff)endif//bearish reversalif pdn>=ReversalAmountPercent/100 thencoeff = abs(pdn/ReversalAmountPercent)*100coeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi-(kagi*(ReversalAmountPercent/100)*coeff)endifif ReversalAmountPoints>0 then//points retracementpup = close-kagipdn = kagi-closeInvDec = 1//bullish reversalif pup>=ReversalAmountPoints*pointsize thencoeff = (pup/pointsize)/ReversalAmountPointscoeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi+(ReversalAmountPoints*pointsize)*coeffendif//bearish reversalif pdn>=ReversalAmountPoints*pointsize thencoeff = (pdn/pointsize)/ReversalAmountPointscoeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi-(ReversalAmountPoints*pointsize)*coeffendifBearKagi=(pdn>=ReversalAmountPercent/100) or (pdn>=ReversalAmountPoints*pointsize)09/23/2019 at 12:21 PM #108248If you are just looking for when the new Kagi is up or down, just check the color in the original code.
If R>0 , then its red, otherwise it’s green.
To spot a new reversal, check if the previous R was >0 or = to 0.
1bearish = r>0 and r[1]=0and vice versa for a new bullish reversal condition:
1bullish = r[1]>0 and r=01 user thanked author for this post.
09/23/2019 at 12:44 PM #108254Thanks Nicolas, you solved it.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061//PRC_Kagi on price chart | indicator//05.09.2019//Nicolas @ www.prorealcode.com//Sharing ProRealTime knowledge// --- settings// select one of the two possible setting (0=don't use)ReversalAmountPercent = 1.5 //amount of price percent to inverse Kagi trendReversalAmountPoints = 0 //amount of points to inverse Kagi trend// --- end of settingsonce kagi=closeif ReversalAmountPercent>0 then//percent retracementpup = (close-kagi)/kagipdn = (kagi-close)/kagiInvDec = 1/0.1//bullish reversalif pup>=ReversalAmountPercent/100 thencoeff = abs(pup/ReversalAmountPercent)*100coeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi+(kagi*(ReversalAmountPercent/100)*coeff)r=0//g=255endif//bearish reversalif pdn>=ReversalAmountPercent/100 thencoeff = abs(pdn/ReversalAmountPercent)*100coeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi-(kagi*(ReversalAmountPercent/100)*coeff)r=255//g=0endifendifif ReversalAmountPoints>0 then//points retracementpup = close-kagipdn = kagi-closeInvDec = 1//bullish reversalif pup>=ReversalAmountPoints*pointsize thencoeff = (pup/pointsize)/ReversalAmountPointscoeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi+(ReversalAmountPoints*pointsize)*coeffr=0//g=255endif//bearish reversalif pdn>=ReversalAmountPoints*pointsize thencoeff = (pdn/pointsize)/ReversalAmountPointscoeff = round(InvDec*coeff-0.5)/InvDeckagi=kagi-(ReversalAmountPoints*pointsize)*coeffr=255//g=0endifendifBearKagi=r>0 and r[1]=0 -
AuthorPosts
Find exclusive trading pro-tools on