Hey @Svanoy thank you for following up with me & thank you @halcyonguy for chiming in to help out.
I am only a few weeks in on learning thinkscript so excuse me on the confusion I may have caused. I truly appreciate the help & guidance.
as for the script I believe i got it to work with fold. It now seems to sum the correct amount when I change the period input & time frame aggregation input. I attached what i have completed any input on if of if not correct would be appreciated.
Ruby:#Short Term Candle Body Sentiment input ShortTermSentiment = aggregationPeriod.fivE_MIN; input ShortTermSumPeriods = 6; def ST_O = open(period = ShortTermSentiment); def ST_C = close(period = ShortTermSentiment); def ST_bodyHeight =...
The code below shows a chart bubble for every candles body height. How can this be modified so a chart bubble ONLY appears if
body height is between 2 - 4 in height?
def CandleBodyTop = MidBodyVal() + 0.5 * BodyHeight();
addchartbubble(1, candleBodyTop,BodyHeight() ,color.cyAN);
Ruby:def CandleBodyTop = MidBodyVal() + 0.5 * BodyHeight(); AddChartBubble( Between(BodyHeight(), 2, 4), CandleBodyTop, BodyHeight() , Color.CYAN);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
@SleepyZ Thank you very much. That worked! Now how do you add a custom text in the bubble instead of the number value ?
Ruby:def CandleBodyTop = MidBodyVal() + 0.5 * BodyHeight(); AddChartBubble( Between(BodyHeight(), 2, 4), CandleBodyTop, "Custom Text \n 2nd Line, if wanted \n" + BodyHeight() , Color.CYAN);
def Bull = <YellowCandle> or <GreenCandle> or <DarkGreenCandle>;
def Bull_Candle_Count = fold i = 1 to 50 with Bull_Counter = 0 do if GetValue(Bull,i)==1 then Bull_Counter+GetValue(BodyHeight(),i) else Bull_Counter;
What could you add to this script so that it only populates a chart bubble for the previous 10 candles?
Ruby:input count = 10; def CandleBodyTop = MidBodyVal() + 0.5 * BodyHeight(); def cond = Between(BodyHeight(), 2, 4); def hcount = CompoundValue(1, if !IsNaN(cond) then hcount[1] + 1 else hcount[1], 0); AddChartBubble(HighestAll(hcount) - hcount <= count - 1 , CandleBodyTop, "Custom Text \n 2nd Line, if wanted \n" + BodyHeight() , Color.CYAN);
I am using this script on a 5min chart. Is there a way to code it so I have the 5min chart open & it sums candles on a higher time frame like@VIP_TOS
With the information you have provided, it would be similar to this
and repeat for Bear Candles.Ruby:def Bull = <YellowCandle> or <GreenCandle> or <DarkGreenCandle>; def Bull_Candle_Count = fold i = 1 to 50 with Bull_Counter = 0 do if GetValue(Bull,i)==1 then Bull_Counter+GetValue(BodyHeight(),i) else Bull_Counter;
Would need more information to go any further.
Is there a way to code it so I have the 5min chart open & it sums candles on a higher time frame like
15min, 1hr or daily ?
def DAY_Chart_Candle_Count = aggregationPeriod.DAY;
#Candle Colors
input CandlesToSum = 10;
def Dark_Red_Candle_NAME = DarkRed;
def Red_Candle_NAME = Red;
def Yellow_Candle_NAME = Yellow;
def Orange_Candle_NAME = Orange;
def Green_Candle_NAME = Green;
def Dark_Green_Candle_NAME = DarkGreen;
#Bullish Candle BODY SUM
def Dark_green_Candle_BODY = fold i = 1 to candlesToSum with Dark_green_Candle_NAME_Counter = 0 do if GetValue(Dark_green_Candle_NAME,i)==1 then Dark_green_Candle_NAME_Counter+GetValue(BodyHeight(),i) else Dark_green_Candle_NAME_Counter ;
def green_Candle_BODY = fold h = 1 to candlesToSum with green_Candle_NAME_Counter = 0 do if GetValue(green_Candle_NAME,h)==1 then green_Candle_NAME_Counter+GetValue(BodyHeight(),h) else green_Candle_NAME_Counter;
def yellow_Candle_BODY = fold g = 1 to candlesToSum with yellow_Candle_NAME_Counter = 0 do if GetValue(yellow_Candle_NAME,g)==1 then yellow_Candle_NAME_Counter+GetValue(BodyHeight(),g) else yellow_Candle_NAME_Counter;
Try this
Rich (BB code):input count = 10; def CandleBodyTop = MidBodyVal() + 0.5 * BodyHeight(); def cond = Between(BodyHeight(), 2, 4); def hcount = CompoundValue(1, if cond then hcount[1] + 1 else hcount[1], 0); AddChartBubble(cond and HighestAll(hcount) - hcount <= count - 1 , CandleBodyTop, "Custom Text \n 2nd Line, if wanted \n" + BodyHeight() , Color.CYAN);
def DAY_Chart_Candle_Count = aggregationPeriod.DAY;
#Candle Colors
def Dark_Red_Candle_NAME = DarkRed;
def Red_Candle_NAME = Red;
def Yellow_Candle_NAME = Yellow;
def Orange_Candle_NAME = Orange;
def Green_Candle_NAME = Green;
def Dark_Green_Candle_NAME = DarkGreen;
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
C | Creating script for candle height body height | Questions | 9 | |
O | Price Range PER Candle (Body Only) | Questions | 1 | |
M | Don't count a candle if it has a line for a body (doji). | Questions | 1 | |
J | Intraday Candle Body Gaps | Questions | 3 | |
Inside Candle Up or Down using BODY of Mother candle NOT wick. | Questions | 3 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.