Quotetanman # long and short signal formula def OBV = TotalSum(Sign(close - close[1]) *volume); def OBVUP = OBV > OBV[1]; def OBVDN = OBV < OBV[1]; Tanman what's the reason you use TotalSum in this case? It looks like difference of OBV and OBV[1] would be the difference of current bar volume and the very first bar volume of the chart. It seems kind of irrelevant comparing these twby howo3579 - Trading Discussion
Baffled, that's interesting. What time period or tick do use usually use? I think momentum is always there because majority of volume comes from algo no matter its stock or forex. We probably just need to adopt an optimum time period or tick volume. I have some input that might be able make the methodpre reliable. Right now your using average to take profit. However average also means there areby howo3579 - Trading Discussion
Tampman, I haven't been able to do it in real market hours but I have been simulating using on demand the past few days. Needless to say you're absolutely right. I didn't think about it when I wrote the script. Because of 4 hour aggregation values are used on 1 hour chart, the StochRSI and C level will keep changing until 4 hour period is finished. On back test report, TOS only recorded the finaby howo3579 - Trading Discussion
You can assign condition to c line too. Ctotal.AssignValueColor(if ctotal>=2 then Color.Green else if ctotal <=-2 then Color.Red else color.gray); This will plot c line in green if its over 2 and red below -2. I use these numbers because they are my exit condition but you can assign condition however you want.by howo3579 - Trading Discussion
Tampman, I guess you can incorporate accdist to my strategy. But any time fullk macd are in uptrend, you'll have green accdist, and vise versa for downtrend. Maybe it's a little redundant to have accdist label. I think its better to actually plot accdist, then you it'll give you a big picture whether we are in acc or distribution. The new study the plan doesn't plot stochrsi. It plots c valuby howo3579 - Trading Discussion
QuoteTampman what do I change it to if I want to short? To short, you can just have another study of the same script and just change the break out condition. def rundown1 = close < close[1]; def rundown2 = close < close[2]; plot Below = rundown1 and rundown2; Below.SetDefaultColor(Color.Red); Below.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); # --- define range ---by howo3579 - Trading Discussion
Quotetampman what this code is supposed to do This is to see the moving average range of current candle if the previous candle broke out above its previous 2 candles. Any time frame. If you want to go long on the open of current bar when the condition is met (blue arrow), you probably need the range of close-open instead of high-low. This way you can see whether the trend is up or down. You can aby howo3579 - Trading Discussion
Quoterobert def TheSum = TotalSum(if counter > HighestAll(counter) - AverageLength then RangeAfterRunup else 0); Robert your genius. But I'm still confused how this code gave us sum of rangeafterrunup of only the averagelength. Let say we're at counter =90. Highestall(counter) of current bar would give us 90. Averagelength is 4. This will give us the current condition if 90>90-4, and sum aby howo3579 - Trading Discussion
Tampman, The number -100(10000) you have on your chart is neither RSI value nor C vlaue. You can see the C value on the subgraph. If you want 4H_stochRSI on subgraph here is the code. declare lower; input RSI_length = 14; input over_bought = 80; input over_sold = 20; input cross_over = 40; input RSI_average_type = AverageType.WILDERS; def RSI_price = close(period=AggregationPeriod.by howo3579 - Trading Discussion
baffled1 Wrote: Quotebaffled1 for that next candle, i.e., an average for, say, the last 50 instances of that "next" candle, instead of an average for all the non-event intervening candles. I was thinking all night and try to come up with some thing but it just made my head hurt. I was trying to use compoundvalue() and fold to do it but I have no idea how to get the barnumber of theby howo3579 - Trading Discussion
tampman, i'm not sure what you mean about the c level. can you post your screen shot? go to postimg.org and upload your screen shot there. they will give you a link of the image. Then you can post it on here.by howo3579 - Trading Discussion
Tampman, The stochrsi is already in the study script. The very first black of the code is it. I didn't plot the stochrsi in the study because we just care about c value. I plot it the stoch rsi just for reference but the code was just taken from the study plan. The vertucal line signal is already taking into account if stochrsi crossing. You don't need extra subgraph for stochrsi. For the stratby howo3579 - Trading Discussion
Tampman, Sorry I forgot to post screen shot of the chart. Below is what it looks like. However I haven't got to trade using this strategy because I have a day job and am not in from of TOS station. I also created 2 new columns on watch list. If I'm in front of the computer all day I can just pay attention to the numbers of the columns once every hour. As for unload and cover until next sellby howo3579 - Trading Discussion
Robert, I know how to have alert on the study on the chart opened. However this alert doesn't send me text message and I wouldn't know if I turn off the computer or away. I'd like to have alert on watch list which can notify me even when tos is not running. But it seems there's a limitation on what the script can do on study alert.by howo3579 - Trading Discussion
Robert, I wrote the alert manually but it seems in Study Alert it only recognizes alert that's set this way. Sorry I'm a noob at navigating TOS. Am it missing something here?by howo3579 - Trading Discussion
Robert, I've set the study alert when FullK_Day crosses 40. Once the alert is fired I have to go set it up again. Is there way to keep the alert condition without having to go in and set up every time? Kind of hard to do when I'm not with the platform during the day.by howo3579 - Trading Discussion
Tamp, Yea I'm having trouble figuring out how to have unload or cover signal only after buy or short signal. The rules are simple in below. Take position: When FullK_4H crosses above 40, buy signal is triggered only if C (total of weighted score) is greater or equal to 3. When FullK_4H crosses below 40, short signal is triggered only if C (total of weighted score) is less or equal to -3.by howo3579 - Trading Discussion
Tampman, sorry I uploaded wrong one. I'm trying to let it stop showing exit signal when I don't have position but still couldn't figure out how. But it shouldn't matter when backtest. Here is the correct study. declare lower; # 4H StochRSI 40 Xover and Daily StochRSI trend input RSI_length = 14; input over_bought = 80; input over_sold = 20; input cross_over = 40; input RSI_average_tyby howo3579 - Trading Discussion
Robert, About the discontinuous daily data, it turned out it's not because of its closing price. I included secondstilltime(0930) condition but still didn't work. I plotted FullK_Daily itself without defining FullK_4H and it gave me continuous plot with no problem. def FullK_Daily = StochasticFull(over_bought, over_sold, KPeriod, DPeriod, RSI_Daily, RSI_Daily, RSI_Daily, slowing_period, averaby howo3579 - Trading Discussion
Oops sorry I didn't know you had the second example. Must have scrolled down too fast. You're the man. However I don't need to plot the close. I need to implement this dictated close to daily aggregation period in calculation. I might be able to use SecondsTillTime condition to play around. I'll post any updated code if I figure out. Thanks again Robert.by howo3579 - Trading Discussion
I understand it shifts at midnight. The problem here, if I understand correctly, is from 0000 to 0930 the daily close is (will be) that of 1600. During this period there’s no data if our main aggregation period is less than a day. Is it possible to replace the daily close during 0000 ~ 0930 with 1600[1] (previous day close)?by howo3579 - Trading Discussion
Thank you for the explanation. So it looks like TOS is not returning active close for daily during extended hours. If it isn't possible to do that can we dictate what the daily close should be during extended hours? Instead of letting the close shift from previous day close to following day's close, how do we ask TOS to use the previous day close until 9:30am (9:00 for future) and then it can staby howo3579 - Trading Discussion
Robert, I've written the weighted score system that I posted a couple of weeks ago. Though I still couldn't figure out how to identify diversions, the win rate so far has surpassed my expectation. I want to share with you and the forum since I couldn't have written it without studying up your codes (can only utilize so much with thinkscript lesson without actual examples). I believe this works bby howo3579 - Trading Discussion
Here is the screen shot of the report for last 10 days. Notice the sell to close position size is always 2 which is not what I wanted. It should've been 1 on moar trade. Only the one that got stopped out in loss should be 2. Also I have no idea why initial buy to open P/L is $0.07. It should've been 0. Same as other buy to open rows. Total P/L down at the bottom doesn't make sense either. I'by howo3579 - Trading Discussion
QuoteRobert My wife and I are in the process of packing the house in preparation for our move, so I don't really have time for any scripting right now. Thanks Robert. I understand your FP/HRFP code and have a general idea how I can write my system except defining divergence. I’m studying the autowave code to see how I can approach it. Now my question is for Tanman’s open range system I reby howo3579 - Trading Discussion
Robert, I came across your thread when learning about thinkscript. Thanks so much for sharing your knowledge and skills. Can you help a noob figure out how to create a new indicator. I’m right now trying to test if a short term swing trader can gain an edge with a simple combination of momentum indicators. We only need standard RSI and MACD and MACD histogram. I have 6 rules. I want to assignby howo3579 - Trading Discussion