♥ 0 |
Mr Hanhn,
I’ve looked at one of your previous posts and tried to follow what you were doing but it’s not transcribing the same for what I’m doing it seems. Would appreciate help if you were able
What I’m working on is inside the ## I’m trying to to count the bars, it’d great to add the bar count to my other labels. So basically, While there’s a bear div which I have printed with the label I’d also like to add to that how many bars have been printing that div.(it’s printing as histogram–hence bar count) I need it to flip however, so from bear div histogram print(let’s say it prints 3 bars, then 2, then 1 if 0 then NaN( I have labels set to Black no color or div printed if histogram = 0) but once it flips to bull div it needs to concat bar count again. I think!! my problem is this def upTrend = bulldiv[2] < bulldiv[1] and bulldiv[1] < bulldiv; I tried interchanging scale instead of bulldiv/beardiv but couldn’t figure it out. If you give it a try huge thanks to you. input length = 20; def indicator = mydivergence; def isbulldiv = if (bullslope < 0 and myslope >= 0) then 1 else 0; def myBullDiv = if isbulldiv then myslope * bullslope else 0 ; def scale = Max(AbsValue(LowestAll(myBullDiv)), AbsValue(LowestAll(myBearDiv))); # # plot bulldiv = AbsValue(myBullDiv) / scale * 100; bulldiv.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); ################################## def upTrend = bulldiv[2] < bulldiv[1] and bulldiv[1] < bulldiv; def isUpTrend = !upTrend[1] and upTrend; rec upTrendCounter = CompoundValue(1, if isUpTrend then 1 else if upTrend then upTrendCounter[1] + 1 else 0, 0); AddLabel (yes, (Concat(“ —- “, Round(uptrendcounter, 1)))); ################################## input BuyLabelText = ” Buy “; input SellLebelText = ” Sell “; AddLabel(yes, ” /Bull/ ” , if bulldiv >= 50 then color.green else if bulldiv > 0 then color.light_GREEN else Color.blACK); RESOLVED
Marked as spam
|
Please log in to post questions.