Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.18 KB | None | 0 0
  1. Arizona times = CDT - 2 -- Arizona does not have Daylight Savings Time
  2.  
  3. ------- Saturday, March 17, 2018 -------
  4. 08:05 MTS1: GM TCuls!
  5. 08:30 DougN: In applying the TOS PPS study to a watchlist and then creating a column to signal when the alert triggers, all seems to be working correctly. Can someone share how to apply color to the box in the watchlist column rather then the "1" and "0". This is the simple code for this watchlist column...IsNaN("value" = PPS().buysignal) is false. Thank you!
  6. 08:34 Jake-Elwood: you have 2 choices to color a watchlist column, either use a label and use its coloring or AddBackgroundColor
  7. 08:34 MTS1: Doug; use the AddLabel() function and put your formula in there
  8. 08:36 MTS1: Or AddBackgroundColor as Jake mentioned; the sort may be different; AddLabel sorts AlphaNumeric IIRC
  9. 08:36 Jake-Elwood: coloring logic looks like this:
  10. if <condition> then Color.GREEN else Color.RED
  11.  
  12. 08:48 MTS1: yw. .
  13. 09:13 DougN: thanks very much guys...I will try to get these to work. These are very helpful skills that you have and hopefully someday Ill be able to apply more and help others as you are. Thank you!
  14. 09:13 AlphaInvestor: There is a third choice - coloring the text of a PLOT statement
  15. 09:13 AlphaInvestor: That will still sort correctly
  16. 09:48 Nube: Updated US Bond yield spread and curve script. Added an AD line for us bond yields since AD lines are all I've been doing lately
  17. 09:48 Nube: 
  18. 09:49 Nube: http://tos.mx/k8dImE
  19. 09:49 Nube: That version also has the Ten - One Spread which I don't believe the earlier version had. I added that because it has more history than the other spreads
  20. 09:50 MTS1: Cool Nube; thanks!
  21. 09:52 MTS1: I see you have the white border figured out. .
  22. 10:36 Nube: That line is the AD line for yield
  23. 10:36 Nube: Your chart weekly, Jake?
  24. 10:38 Jake-Elwood: was daily, now weekly. I now see same as your pic except for the dashed lines, they don't seem to be in this code
  25. 10:38 Nube: Oh, yeah, those were lines I was drawing when looking at charts
  26. 10:39 Nube: Didn't occur to me that I hadn't shared the change until after
  27. 10:39 Jake-Elwood: might want to add hide on intraday as the FRED data looks like only daily and above
  28. 10:42 Nube: Would be a good idea, which is why I won't
  29. 10:42 Jake-Elwood: heehee
  30. 10:59 amalia: lol
  31. 12:04 Y2K: .
  32. 12:07 momo: ..
  33. 12:11 technicaltraderoom: Hope everyone is well, quick question, how do I ignore 0 values when computing an average? I've done average(if number > 0 then number else no) but it still seems to count zeros in its computation.
  34. 12:26 DougN: Unfortunately I'm not able to get the code accepted by Thinkscript to colorize the PPS study column that I created. Thanks for everyones help but I've tried every combination I can ponder and can't get it operational. Can someone show me how it should be written in association with the existing script ...IsNaN("value" = PPS().buysignal) is false....to get it to colorize on a signal? Thank you!
  35. 12:26 MTS1: TT; need to explain more; 0 in the source data, or NaN? 0 in the Average? What would you plot instead on that bar; what would you want the value to be? No is a boolean; or in this case No = 0 as a value so it'd still count.
  36. 12:27 MTS1: What have you tried Doug? Did you find the functions in the manual with syntax details?
  37. 12:31 DougN: MTS1...is that where I find the "AdLabel" function? I was just trying the ...if condition> then Color.GREEN else Color.RED...but could not get anything there
  38.  
  39. 12:31 MTS1: http://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/AddLabel.html; what would you want to state in the column (text), and what color would you want it to be if buy signal is true or false; use Jake's syntax in the color variable; if <PPSbuysignal?> then Color.GREEN else Color.RED? What statement do you have and we can play with it. .
  40. 12:32 DougN: ahh...let me try that
  41. 12:32 MTS1: We already mentioned you can use AddLabel, AddBackgroundColor, or Plot; all are in the manual. Those are the only three that control color in a column, but plot is text color only
  42. 12:33 DougN:
  43. IsNaN("value" = PPS().buysignal) is false
  44. if <PPSbuysignal?> then Color.GREEN else Color.RED
  45. 12:33 MTS1: You can only have ONE eitther plot or addlabel in a column script.
  46. 12:33 MTS1: Where is the addlabel or alternative function?
  47. 12:35 DougN: I wil go to manual as I haven't done that yet. I want to learn.
  48. 12:36 DougN: Thank you for the input!
  49. 12:37 MTS1: that'd be the start if we point you to a function ;)
  50. 12:37 momo: technicaltraderoom when you say “else no” that is same as saying “else 0”
  51. 12:37 MTS1: Sample; no separate line needed for true / false determination: AddLabel(1,"TEXT", if IsNaN("value" = PPS().buysignal) then Color.GREEN else Color.RED);
  52. 12:37 momo: So you are letting 0 be still there
  53. 12:41 AlphaInvestor: No is a zero in binary/boolean
  54. 12:42 AlphaInvestor: Yes is a 1 ... athough many programming languages treat any non zero value as True or Yes
  55. 12:45 amalia: PPS sucks
  56. 12:45 amalia: kthxbye
  57. 12:46 AlphaInvestor: Any idea how to tell if it is Saturday or Sunday in TOS. Using
  58. def CurrentDOW = GetDayOfWeek(GetYYYYMMDD());
  59. returns 5 currently (Friday)
  60. 12:46 AlphaInvestor: likely because there is no bar today
  61. 12:47 DougN: MTS1...Should this be working? IsNaN("value" = PPS().buysignal) is false
  62. AssignBackgroundColor(if "value" = PPS().buysignal) then color.LIGHT_GREEN else color.BLACK);
  63. 12:47 amalia: Ai, I’m working on that right now. Haha Tell ya, everytime I’m working on something, someone in here is already on it
  64. 12:47 MTS1: Probably need to test in OnDemand? Wonder what it returns on Sunday when futures are open..
  65. 12:47 amalia: Tried ==7 to no avail either
  66. 12:48 amalia: Right. Aiming for Sunday open here
  67. 12:48 AlphaInvestor: MTS - that would probably depend on whether you had a /Futures symbol up
  68. 12:48 amalia: And don’t wanna input date function either. Too much work there
  69. 12:49 MTS1: your first line is not complete Doug; what variable are you populating?
  70. 12:49 AlphaInvestor: Doug - that should not work
  71. 12:49 AlphaInvestor: I suspect buysymbol would only ever by 1 or 0 - true or false ... never NaN
  72. 12:49 MTS1: you need to have an if statement in there somewhere
  73. 12:51 DougN: yes its true or false
  74. 12:51 MTS1: What is the rest of the statement; what value are you actually plotting to display in the cell?
  75. 12:51 DougN: IsNaN("value" = PPS().buysignal) is false
  76. AssignBackgroundColor(if "value" = PPS().buysignal) then color.LIGHT_GREEN else color.BLACK);...no value just the color
  77. 12:52 MTS1: an if / then statement always starts with "if"
  78. 12:53 DougN: there is if right before value...wrong place?
  79. 12:53 MTS1: use http://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/If.html or
  80. http://tlc.thinkorswim.com/center/reference/thinkScript/Reserved-Words/if.html
  81. 12:53 DougN: ok...thx!!!
  82. 12:53 MTS1: look at the syntax on those pages and decide what works best. The function seems easiest?
  83. 12:54 AlphaInvestor: ooh ooh ooh ... help me next -- Horseshack from Everybody Loves Cotter
  84. 12:54 MTS1: The reference is a great place; put the function in the reference filter on the right top of the page, or search. HowTo's are great also to get to learn the platform.
  85. 13:02 technicaltraderoom: MTS1 here is the context, I'm grabbing the zigzagsign bubble amounts when the reversal amount is set to 0.1 so I can get the average movement in both the positive and negative direction of an equity.
  86.  
  87. For example, over 840 1m candles (two days) there were 20 zigzag bubbles generated by the study, so there is technically 820 0's and 20 numbers that give you the movement amount. I'm looking to remove all those 0s in the computation of the average, I just want it to compute the average over those 20 zigzag bubbles.
  88. 13:03 technicaltraderoom: I've separated positive movements from negative movements, but as stated above, everything but the bubble amounts generated by the zigzagsign study are 0s so it kills the average. I'm looking to remove those 0s.
  89. 13:03 MTS1: Doug; FYI you can still have if statement in the AssignBackgroundColor Variable; like my AddLabel Sample above; like AssignBackgroundColor(if IsNaN("value" = PPS().buysignal) then Color.GREEN else Color.RED);
  90. 13:08 AlphaInvestor: Sounds like a job for FOLD not Average()
  91. 13:09 AlphaInvestor: sum up the non-zero numbers in a FOLD statement
  92. count the non-zero numbers in a FOLD statement
  93. divide to get the average
  94. 13:10 technicaltraderoom: I'll give it a shot, thanks Alpha
  95. 13:12 technicaltraderoom: That should work as a quick patch, since I know the value of n here (how many values above 0), but sounds like it will not be an option when I don't know the value of n
  96. 13:13 AlphaInvestor: No, that is why you Count the number of non-zeros in a separate FOLD
  97. 13:13 AlphaInvestor: Well, I need to get home to gorge myself on corned beef and cabbage - Later Traders
  98. 13:13 technicaltraderoom: Smart, not sure why I didn't see that as an option
  99. 13:13 technicaltraderoom: Thanks again
  100. 13:22 FrankB3: Anyone know if this is a "small trader sentiment " indicator or script... would like a RSI ???/
  101. 13:27 MTS1: Frank; what is "this" ?
  102. 13:27 AlphaInvestor: Would TD Ameritrade's $IMX work?
  103. 13:27 AlphaInvestor: If not, AAII Investor Sentiment Survey would be my choice
  104. 13:29 UpTheCreek: Doug, if you return, there is a trick to PPS buy and sell signals, they aren't boolean, they are numbers.
  105. 13:30 AlphaInvestor: but 1 and 0 equate to booleans anyways ...
  106. 13:30 UpTheCreek: but it's worse than that
  107. 13:31 AlphaInvestor: oh, I never plotted them
  108. 13:31 UpTheCreek: if I remember right it a number or NaN
  109. 13:32 FrankB3: thanks AI::: will check it out.... seems like when a the small traders(under 10K) are in total agreement on down turns >>> signals a change to the upside
  110. 13:34 FrankB3: 16:27 MTS1: a non-price view of market reaction
  111. 13:35 UpTheCreek: last time I checked, nobody asked me how big my account was the last time I placed a trade
  112. 13:36 MTS1: Frank; still not sure what indicator or script you were looking at. But same applies to Speculators in COT, newsletter publisher survey, etc. You're looking for contrarian signals?
  113. 13:36 AlphaInvestor: mine keeps changing in value ... one day I am a big trader, next week I am a pipsqueak
  114. 13:36 FrankB3: Yep,,, there is some private research being done... I don't know how they obtain their info
  115. 13:37 UpTheCreek: you could use COT data as well for small specs...just not on ToS :(
  116. 13:37 FrankB3: Oh, yea:: then I.m a pipsweak of a pepsqueak
  117. 13:39 FrankB3: I think in the COT data: you can find proffesionl traders data, each week
  118. 13:39 MTS1: Google it Frank; COT is public, and there are free sites to chart it. Google fin newsletter sentiment for hulbert, etc.
  119. 13:39 jmachado: Alpha, how exactly would you go about adding up those non-zero numbers using a fold statement?
  120. 13:40 FrankB3: thanks guys ,,, later
  121. 13:41 AlphaInvestor: JM - I am not a good FOLDer
  122. 13:41 jmachado: Neither am I sadly haha
  123. 13:43 AlphaInvestor: somethinng like this
  124. def SumUp = if MyVariable > 0
  125. then SumUp + MyVariable
  126. else SumUp[1] ;
  127. 13:43 UpTheCreek: then run a seperate counter variable for each non zero number you have. It may work for what you are doing, or not...
  128. 13:43 AlphaInvestor: def CountUp = if MyVariable > 0
  129. then SumUp + 1
  130. else SumUp[1] ;
  131. 13:44 AlphaInvestor: oops
  132. def CountUp = if MyVariable > 0
  133. then CountUp + 1
  134. else CountUp[1] ;
  135. 13:45 jmachado: I'll plug it in and give it a shot, thanks
  136. 13:46 AlphaInvestor: Later Traders
  137. 15:25 jmachado: For Alpha or anyone who can give further insight, I attempted to do what Alpha suggested and came up with the following
  138. 15:25 jmachado: def price = close;
  139. def reversalAmount = 0.1;
  140. def "ZZ$" = reference ZigZagHighLow(price, price, 0, reversalAmount, 1, 0);
  141. def zzSave = if !IsNaN("ZZ$") then price else GetValue(zzSave, 1);
  142. def chg = price - GetValue(zzSave, 1);
  143. def barNumber = BarNumber();
  144.  
  145. def Up = if !IsNaN("ZZ$") and chg > 0 then chg else no;
  146. def CountUpN = if Up > 0
  147. then CountUpN + 1
  148. else CountUpN[1] ;
  149. def CountUpTotal = if Up > 0
  150. then CountUpTotal + Up
  151. else CountUpTotal[1] ;
  152. plot UpAverage = CountUpTotal/CountUpN;
  153.  
  154. def Down = if !IsNaN("ZZ$") and chg < 0 then chg else no;
  155. def CountDownN = if Down < 0
  156. then CountDownN + 1
  157. else CountDownN[1] ;
  158. def CountDownTotal = if Down < 0
  159. then CountDownTotal + Down
  160. else CountDownTotal[1] ;
  161. plot DownAverage = CountDownTotal/CountDownN;
  162. 15:25 jmachado: Unfortunately nothing is coming up, so I'm going to keep working on it, but any insight would be much appreciated. Thanks.
  163. 15:46 Jake-Elwood: looks to me that you are feeding the zzHL study some garbage inputs which result in no zigzag from being drawn. Review the details about the study and see what it really needs.
  164. Plot out your intermediate values so you can see more of what is going on....like this:
  165. plot zzsave_ = zzSave;
  166. zzSave_.setPaintingStrategy(paintingStrategy.VALUES_BELOW);
  167. 15:46 Jake-Elwood: http://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/V-Z/ZigZagHighLow.html
  168. 15:53 jmachado: Not sure what you're saying Jake, as the Up and Down items correctly isolate and display the zigzagsign bubbles I'm referring to.
  169. 15:58 Jake-Elwood: I see no bubbles in your code
  170. 15:58 jmachado: Please read up to the prior conversation for context
  171. 16:00 jmachado: I basically copy-pasted the code for ZigZagSign, and the Up/Down in the code above is what the bubbles in the ZigZagSign code uses to get that data.
  172. 16:02 jmachado: The issue here is isolating that data from all the zeros in-between to create an average. My end goal is to get the average of all of positive movement that you see in the bubbles of the ZigZagSign study. The same for the negative movement as well.
  173. 16:04 Jake-Elwood: well, I don't know what's your code and what's ToS code in that script you posted a half hour ago, all I'm saying is that it starts out not working and stays that way. If you think otherwise, that's fine, maybe I'm missing something significant.
  174. 16:06 jmachado: Thanks for attempting to help though
  175. 16:07 Jake-Elwood: np
  176. 16:13 MTS1: JM; so instead of using FOLD you are now just attempting to retain the prior value if ZZ$ does not return a value?
  177. 16:17 jmachado: MTS1, Yes, I'm going off of what Alpha suggested above in his example code.
  178. 16:17 jmachado: Never used fold before, not sure how to tackle it
  179. 16:19 jmachado: If you'd be willing to share any insight on properly using fold it would be greatly appreciated
  180. 16:19 JFoy: Newbie here. How can I add ATR to a Scan?
  181. 16:21 MTS1: JM; there will be more experts in on Monday; I'm not. But check your values; I tried plotting the first defs and don't think that's what you want to be using. Alpha's example was skipping the 0's, not using the prior value on each bar:
  182. 16:21 MTS1: Plot these as triangles or somethign in different colors:
  183. 16:21 MTS1: plot ZZ = reference ZigZagHighLow(close, close, 0, .1, 1, 0);
  184. def zzSave = if !IsNaN(ZZ) then close else GetValue(zzSave, 1);
  185. plot zz_ = zzsave;
  186. plot chg = close +25- GetValue(zzSave, 1);
  187. addlabel(1,"chg"+chg);
  188. 16:25 MTS1: I guess I'm confused where zzSave comes in
  189. 16:25 jmachado: Wish I could share screenshots here
  190. 16:26 MTS1: (or chg). I thought you just wanted to average the last ZZ$ values?
  191. 16:27 MTS1: You can share screenshots; just make sure they are small enough. Also after you paste them in chat box make sure to right-click and zoom to 10% before posting here.
  192. 16:27 MTS1: May need to reduce size of screenshot before you can paste in chatbox though if you get bad size error.
  193. 16:29 jmachado: 
  194. 16:30 jmachado: On the price chart is the ZigZagSign study, with the bubbles on showing the movement from each reversal identified by the study
  195. 16:31 jmachado: On the bottom is the Up and Down from my code, but replacing the def with plot, to show that it is isolating and plotting the same numbers from the ZigZagSign study
  196. 16:31 jmachado: In short, I want to take all the green bubbles (positive movements) from the ZigZagSign study and get an average of them. Same with the red bubbles.
  197. 16:33 jmachado: My plot basically goes: 0, 0, 0, 0, 0, 0.355 and if I try to get an average from that it includes all of the 0s in its computation
  198. 16:34 jmachado: I just want to create a study that adds the "0.355, 0.2273, 0.2369, 0.3251, etc." from the ZigZagSign study above and creates an average of them.
  199. 16:35 jmachado: Hopefully that clears up what I'm looking for
  200. 16:35 Deadboydeath0: hey guys i new to tos platform and i got a question: why did my trades get rejected with bp= -1 share illegal.
  201. 16:36 Deadboydeath0: REJECTED: You will open a prohibited position with BP: illegal -1 share
  202. 16:36 Deadboydeath0: i have enough capital but cant
  203. 16:36 Deadboydeath0: is it because the market is not open now?
  204. 16:40 jmachado: Deadboy, use the live support, they will be able to look at your account and give you the exact answer why
  205. 16:40 jmachado: Could be a permissions issue, could be a few things
  206. 16:40 jmachado: This is a chat for talking about thinkscript
  207. 16:54 amalia: ^What he said.
  208. 16:54 amalia: Most of the time, that is.
  209. 17:05 Gadgets: hello
  210. 17:05 amalia: http://tos.mx/h8jhb2
  211. Weekly targets for swing trading. New idea of the week
  212. 17:06 amalia: I find it works best on indices.
  213. 17:11 markps: Amalia, what general time frame do you use this with?
  214. 17:11 markps: .
  215. 17:13 markps: Obviously, it is weekly, just wondering the method to the madness.
  216. 17:16 jmachado: MTS1 any futher thoughts or inputs to what I shared above?
  217. 17:21 MTS1: JM; is that for the script you posted above? I
  218. 17:21 MTS1: I'm not able to replicate
  219. 17:24 MTS1: Checked your notes again above; seems you're missing the sum of the ZZ values. Alpha's example was to sum the instances you want to average, and count how often they occured, then divide them. That's not what I see in your script.
  220. 17:26 amalia: Swings for me are usually 10dte or less. These are just levels to target or start position from
  221. 17:27 MTS1: 15:43 AlphaInvestor: somethinng like this
  222. def SumUp = if ZZ$ > 0
  223. then SumUp + ZZ$
  224. else SumUp[1] ;
  225. 15:44 AlphaInvestor:
  226. def CountUp = if ZZ$ > 0
  227. then CountUp + 1
  228. else CountUp[1] ;
  229. 17:27 MTS1: Assuming ZZ$ is the value you;ve plotted. Then divide SumUp by CountUp
  230. 17:34 jmachado: def price = close;
  231. def reversalAmount = 0.1;
  232. def "ZZ$" = reference ZigZagHighLow(price, price, 0, reversalAmount, 1, 0);
  233. def zzSave = if !IsNaN("ZZ$") then price else GetValue(zzSave, 1);
  234. def chg = price - GetValue(zzSave, 1);
  235.  
  236. plot Up = if !IsNaN("ZZ$") and chg > 0 then chg else no;
  237. plot Down = if !IsNaN("ZZ$") and chg < 0 then chg else no;
  238. 17:34 jmachado: So if you post this above it doesn't give you what I have in my screenshot?
  239. 17:34 jmachado: Because it should
  240. 17:40 jmachado: Also, the example you're posting returns nothing as well
  241. 17:41 jmachado: I appreciate the input but I fear we're not on the same page, perhaps I'm just not explaining what I'm looking to accomplish well enough, thanks for the help though.
  242. 17:42 amalia: yw
  243. 17:50 amalia: NOOO tculs
  244. 17:50 amalia: I see you typing =(
  245. 17:51 admin_tculs: thinKScript Lounge chatroom will be closing soon Please finish all conversations by 8pm ct Have a nice evening
  246. 17:51 amalia: gn tculs and room
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement