Previous Price Level Indicator not working as intended anymore

Jimbo

New member
VIP
Hi, recently this past week I am noticed that one of my previous indicators is not working as it was before.

I found this indicator that was used to plot a horizontal line at the current price level.

Code:
plot priceLine = highestAll(if isNan(close[-1]) and !isNAN(close) then close else double.nan);
priceLine.setdefaultColor(Color.Pink);
priceline.setlineWeight(1);
priceline.setStyle(curve.medium_dash);

But now the indicator lags behind the actual current price like in the picture below (The salmon pink dashed line)
JRvaYr5.png


Is there something wrong with the code now? Or is my ToS just lagging? Any advice would be appreicated.
 

J007RMC

Well-known member
2019 Donor
This is what I use

Code:
#Horizontal Price Line by Thinkscripter
plot priceLine = HighestAll(if IsNaN(close[-1]) and !IsNaN(close) then close else Double.NaN);
priceLine.SetDefaultColor(Color.white);
priceLine.SetLineWeight(2);

#Squeeze Added
input showsqueeze = yes;
def bbupper = reference BollingerBands().UpperBand;
def kcupper = KeltnerChannels().Upper_Band;
def Squeeze  = bbupper - kcupper < 0;
plot Squeezeplot = if showsqueeze and Squeeze then priceLine else Double.NaN;
Squeezeplot.SetDefaultColor(Color.black);
Squeezeplot.SetPaintingStrategy(PaintingStrategy.POINTS);
Squeezeplot.SetLineWeight(3);
Squeezeplot.HideBubble();

#Count of Periods in consecutive squeeze
rec countsq = if Squeeze then countsq[1] + 1 else 0;
rec count1sq = if !Squeeze then count1sq[1] + 1 else 0;

#Expansion Bubbles
input n = 5;
def n1  = n + 1;
def c = close;

input showsqueezebubble = no;
AddChartBubble(showsqueezebubble and !IsNaN(c[n1]) and IsNaN(c[n]), c[n1] ,( if Squeeze[n1] then "S \n"+Round(countsq[n1], 2) else "NS \n" + count1sq[n1]) , color.orange);
 

Jimbo

New member
VIP
it seems like the line only updates once a candle closes. It was working a few weeks ago but the only change I made was that I asked ToS to enable bookmap for me.

Not sure if it could be a performance issue. I do have a lot of detached grids.

My memory settings are 4096/6144 MB and have deleted the usergui folder
 

J007RMC

Well-known member
2019 Donor
The only thing I can think of is to delete unused studies and I'm sure you have done that too. Or delete the whole program and re-install maybe?
 

rad14733

Well-known member
VIP
@Jimbo There have been reports of PriceLine code not working properly since the last TOS weekend update... In another topic a member contacted Tech Support and they stated changes were made to HighestAll(), but didn't divulge what those changes were... My three different PriceLine scripts have been working but I have noticed that there have been times when I have had to go into the Study Settings Panel and click on Apply to get some to sync properly again, but this is only after I have made changes to other scripts in other chart panels... All of my charts use one of my PriceLine scripts...
 

Tipher

New member
FWIW

To add to what @graf received, I reported the issue as well (and I suggest everyone report it so they know that we want the old functionality back) and got the following, more detailed, explanation:

Thank you again for your patience. With the most recent ThinkorSwim update scripts that use full range functions such as HighestAll, LowestAll, InertiaAll, StDevAll, StErrAll no longer re-calculate per tick. This issue has been brought to the attention of our developers and we have and continue to add accounts to the list of those affected to gauge the impact.
 

securedabag23

Member
2019 Donor
VIP
@Jimbo There have been reports of PriceLine code not working properly since the last TOS weekend update... In another topic a member contacted Tech Support and they stated changes were made to HighestAll(), but didn't divulge what those changes were... My three different PriceLine scripts have been working but I have noticed that there have been times when I have had to go into the Study Settings Panel and click on Apply to get some to sync properly again, but this is only after I have made changes to other scripts in other chart panels... All of my charts use one of my PriceLine scripts...
@rad14733 could you share your priceline script? I've called TD 3 times and still no fix. I tried the above mention script and its still laggy as well as others.
 

rad14733

Well-known member
VIP
@securedabag23 Yeah, the performance seems to have been getting worse so today I searched for an alternate PriceLine method and found one that I used this morning... Then, just now, I did another search for alternate scripts and found that the one I was using is also posted HERE in these forums... It might just be me but I think this variant actually responds faster than the HighestAll() variant... I'm still searching to see if anything else is available that doesn't use HighestAll() and will post any that I find...
 

Pensar

Well-known member
VIP
@securedabag23 @rad14733 Mobius of the TSL recently posted this priceline indicator in the chat as an alternative to using HighestAll(). Maybe you can find it useful.

Code:
# Line At Price
# Mobius
# Alternative to using the HighestAll() function

input barsBack = 1000;

def c = if !IsNaN(close) and IsNaN(close[-1])
        then close
        else c[1];
plot line = if isNaN(close[-barsBack])
            then c[-barsBack]
            else Double.NaN;
 

securedabag23

Member
2019 Donor
VIP
@securedabag23 @rad14733 Mobius of the TSL recently posted this priceline indicator in the chat as an alternative to using HighestAll(). Maybe you can find it useful.

Code:
# Line At Price
# Mobius
# Alternative to using the HighestAll() function

input barsBack = 1000;

def c = if !IsNaN(close) and IsNaN(close[-1])
        then close
        else c[1];
plot line = if isNaN(close[-barsBack])
            then c[-barsBack]
            else Double.NaN;
Thank you gents. I will try both.
 

barbaros

Well-known member
VIP
Try this


Code:
# LastPriceTracker
# Barbaros

plot hc = HighestAll(if isNaN(close[-1]) then Close(period = AggregationPeriod.DAY) else Double.NaN);
hc.SetPaintingStrategy(PaintingStrategy.LINE);
hc.SetStyle(Curve.SHORT_DASH);
hc.SetDefaultColor(Color.Orange);
hc.HideBubble();
hc.HideTitle();
 

rad14733

Well-known member
VIP
Try this


Code:
# LastPriceTracker
# Barbaros

plot hc = HighestAll(if isNaN(close[-1]) then Close(period = AggregationPeriod.DAY) else Double.NaN);
hc.SetPaintingStrategy(PaintingStrategy.LINE);
hc.SetStyle(Curve.SHORT_DASH);
hc.SetDefaultColor(Color.Orange);
hc.HideBubble();
hc.HideTitle();

@barbaros There have been issues recently with HighestAll() causing problems, especially with PriceLine scripts... Mine were working fine since the last TOS update but they have progressively become more and more unusable... Supposedly, TOS made changes to the HighestAll() function but haven't stated what changes they made... The PriceLine freezes and doesn't keep pace with trade prices... That is the reason we have been looking for more reliable alternatives... Does the use of AggregationPeriod.DAY make a difference for intraday charts...???
 

barbaros

Well-known member
VIP
@barbaros There have been issues recently with HighestAll() causing problems, especially with PriceLine scripts... Mine were working fine since the last TOS update but they have progressively become more and more unusable... Supposedly, TOS made changes to the HighestAll() function but haven't stated what changes they made... The PriceLine freezes and doesn't keep pace with trade prices... That is the reason we have been looking for more reliable alternatives... Does the use of AggregationPeriod.DAY make a difference for intraday charts...???
Hey @rad14733, yes, it seems that they made changes to the HighestAll() function that effects these price line painting scripts. I usually use the price line in intraday charts and found that using the day aggregation works well with HighestAll() function. I have not tested on daily timeframe. If it doesn't work in the daily time frame, I wonder if a one higher time frame is the trick. Overall, intraday plotting works for me with daily aggregation.
 

Similar threads

Top