Single chart bubble instead of every candle


0
0

Hi Pete, 

I have this code, I am getting bubble on each dot instead of just one bubble. How can I resove it?

and I use this study on 15 min TF so can the bubble be moved forward automatically after the completion of four 15 min candles? If its possible I want to apply your soultion to some other studies as well.

input aggregationPeriod = AggregationPeriod.DAY;
def highValue = high(period = aggregationPeriod)[1];
def lowValue = low(period = aggregationPeriod)[1];
def closeValue = close(period = aggregationPeriod)[1];
def range = highValue – lowValue;
plot DailyBankMathHigh = if GetDay() == GetLASTDay() then closeValue + ((range) * .75)else Double.NaN;
plot DailyBankMathLow = if GetDay() == GetLastDay() then closeValue – ((range) * .75) else Double.NaN;
AddLabel(yes, Concat(“DailyBMH : “, DailyBankMathHigh ), Color.ORANGE);
AddLabel(yes, Concat(“DailyBML : “, DailyBankMathLow ), Color.GREEN);
AddChartBubble(YES,DailyBankMathLow, Concat(“DBML: “,  DailyBankMathLow), Color.GREEN, yes);
AddChartBubble(YES,DailyBankMathHIGH, Concat(“DBMH: “,  DailyBankMathHIGH), Color.ORANGE);

Marked as spam
Posted by (Questions: 49, Answers: 62)
Asked on October 13, 2019 12:34 am
117 views
0
Private answer

There is a relatively simple solution to force only the first chart bubble to plot (or last). But if you want the chart bubbles to move after the completion of every 4th candle. This requires a more complex solution that I cannot complete in the time I permit for providing free solutions in the Q&A forum.

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on October 13, 2019 9:00 am
0
Please let me know the solution for first part and how much would it cost for the custom need?
( at October 13, 2019 2:48 pm)
0
Private answer

The solution to plotting only one chart bubble instead of plotting one on every bar. You need to use a true/false condition for the first argument of the AddChartBubble function. In your code you are using a value of 'yes'. Which means that every bar on the chart will display the chart bubble.

AddChartBubble(!IsNaN(close) and IsNaN(close[-1]),DailyBankMathLow, Concat(“DBML: “, DailyBankMathLow), Color.GREEN, yes);
AddChartBubble(!IsNaN(close) and IsNaN(close[-1],DailyBankMathHIGH, Concat(“DBMH: “, DailyBankMathHIGH), Color.ORANGE);

This will plot the chart bubbles only on the last bar of the chart. If you need further modifications to the code you can submit a project request here:

https://www.hahn-tech.com/about/

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on October 13, 2019 3:56 pm
0
Thank you so much Pete.
( at October 13, 2019 4:58 pm)