PSAR Transition Indicator for ThinkorSwim

tomsk

Well-known member
VIP
This study looks for a PSAR state transition (either from bullish to bearish or vice versa) and plots a horizontal price line into the expansion area.
If the state transition already triggered, it calculates the number of bars ago the event happened. I've included labels, alerts as well as chart bubbles.


Here is the code

Code:
# PSAR Transition Indicator
# tomsk
# 11.20.2019

# V1.0 - 11.20.2019 - tomsk - Initial release of PSAR Transition Indicator

# This study looks for a PSAR state transition (either from bullish to bearish
# or vice versa) and plots a horizontal price line into the expansion area. If
# the state transition already triggered, it calculates the number of bars ago
# the event happened. I've included labels, alerts as well as chart bubbles

input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
input offSet = 2;

assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");

def bar = barNumber();
def state = {default init, long, short};
def extreme;
def SAR;
def acc;

switch (state[1]) {
case init:
    state = state.long;
    acc = accelerationFactor;
    extreme = high;
    SAR = low;
case short:
    if (SAR[1] < high)
    then {
        state = state.long;
        acc = accelerationFactor;
        extreme = high;
        SAR = extreme[1];
    } else {
        state = state.short;
        if (low < extreme[1])
        then {
            acc = min(acc[1] + accelerationFactor, accelerationLimit);
            extreme = low;
        } else {
            acc = acc[1];
            extreme = extreme[1];
        }
        SAR = max(max(high, high[1]), SAR[1] + acc * (extreme - SAR[1]));
    }
case long:
    if (SAR[1] > low)
    then {
        state = state.short;
        acc = accelerationFactor;
        extreme = low;
        SAR = extreme[1];
    } else {
        state = state.long;
        if (high > extreme[1])
        then {
            acc = min(acc[1] + accelerationFactor, accelerationLimit);
            extreme = high;
        } else {
            acc = acc[1];
            extreme = extreme[1];
        }
        SAR = min(min(low, low[1]), SAR[1] + acc * (extreme - SAR[1]));
    }
}

plot parSAR = SAR;
parSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
parSAR.SetDefaultColor(GetColor(5));
def transitionBull = state[1] == state.short and state == state.long;
def transitionBear = state[1] == state.long and state == state.short;
def transitionBar = if transitionBull or transitionBear
                    then bar
                    else transitionBar[1];
def transitionPrice = if bar == HighestAll(transitionBar)
                      then close
                      else transitionPrice[1];
def transitionBarsAgo = if bar != transitionBar
                 then bar - transitionBar
                 else if bar == transitionBar
                      then Double.NaN
                 else transitionBarsAgo[1];
def timeAxis = if IsNaN(close[-1]) and !IsNaN(close) then bar else timeAxis[1];
plot horizLine = if GetTime() <= RegularTradingEnd(getYYYYMMDD()) and
                 transitionBar == HighestAll(transitionBar)
                 then transitionPrice
                 else Double.NaN;
horizLine.SetLineWeight(2);
horizLine.SetDefaultColor(Color.Yellow);
AddLabel(transitionBull or transitionBear, "PSAR Transition Detected Now!", Color.Yellow);
AddLabel(!(transitionBull or transitionBear), "PSAR Transition " + transitionBarsAgo + " bars ago", Color.Cyan);
Alert(transitionBull, "PSAR Transition Bull", Alert.BAR, Sound.Ding);
Alert(transitionBear, "PSAR Transition Bear", Alert.Bar, Sound.Ring);
AddChartBubble(bar == HighestAll(timeAxis+offSet), transitionPrice, "PSAR\nTransitioned", Color.Pink);
# End PSAR Transition Indicator
 
Last edited by a moderator:
Excellent & Genius! Can we extend it a bit -- Can we show the last XX Transitions? Say last 5?
 
Excellent & Genius! Can we extend it a bit -- Can we show the last XX Transitions? Say last 5?

I like to keep things simple and that's why I designed it to show the most recent transition. If you like to show more lines all you need to do is to replicate my code. Remember each line you draw needs it's own set of variables to keep track of the transition bar number and price. It also needs separate plot statement.

I've given you the methodology, so feel free to replicate as many lines as you need. Personally I'd think your chart will look very cluttered.
 
Last edited:
Hello Good fellas,

Having had all these indicators, I have traded many parabolic moves poorly and lost money or missed the boat.

I can’t feel the confidence to drop big money into a trade.

How do I get that confidence? Here are a few questions on my mind:

1. What charts do you guys use? Ticks are better to exit sooner or Rinko are better?

2. How do you guys exit or save profits before the big drop or downward halt?

3. How do we enter into a trade after the halt?

4. What are the indicators? Pretty much everything is lagging and I see that it’s dropping in front of my eyes and I can’t get a better price during the sell... or I’ll hold the bag forever.

5. Anyone using conditional orders to exit quickly?

6. Have you guys tried the TDA API to automatically enter and exit?

7. Is there any pumping group? I see many no news runners running crazy.. not sure how people are buying in big numbers.. you’re look at 20x daily volume all of sudden .. with no catalyst.

8. Any paid indicators or scanners for these parabolic moves?

9. Looks like conditional orders based on 1m are too late.. as everyone seems to be trading ticks?

10. Any popular candle patterns or price action for the parabolic moves?

11. If you miss the waves, any short criteria?

Thanks much !!!
 
I love my PSAR. I use this one.

However, it is just a trending indicator, it can't tell you that an uptrend will continue to run.
  • I don't chase price so I can't tell you how to pick out those 'no news runners running crazy'. If you find a way, be sure to come back and let us know.
  • I trade on catalysts which I believe will drive the price.
  • I exit when it hits resistance on the AMM2. That sometimes leaves too early, but if it breaks through resistance, I can always buy back in.
  • I don't know anyone on this forum that uses the API to auto-trade. The sum and substance that I have seen: https://usethinkscript.com/threads/...y-the-script-for-autotrading.2189/#post-43619
 
Last edited:
@doug914 This is more of a utility. If you want to scan for PSAR state change, then you can use the built-in ParabolicSARCrossover indicator.

Here is an example—scanning for bearish change.

emL5Ps3.png
 
Is there a way you can leave all the previous lines on instead of just the current one. Say I want to see the last 10 times the psar was crossed is there some way to access previous price level breaks and paint the price levels?
 
Is there a way you can leave all the previous lines on instead of just the current one. Say I want to see the last 10 times the psar was crossed is there some way to access previous price level breaks and paint the price levels?

See if this helps where all transitional lines appear until a new one is formed. A price coloring option is included where the close is greater than a bull transition line, the candles will be colored green, closes below bear transition line will be colored red, and otherwise gray.

Capture.jpg
Ruby:
# PSAR Transition Indicator
# tomsk
# 11.20.2019

# V1.0 - 11.20.2019 - tomsk - Initial release of PSAR Transition Indicator

# This study looks for a PSAR state transition (either from bullish to bearish
# or vice versa) and plots a horizontal price line into the expansion area. If
# the state transition already triggered, it calculates the number of bars ago
# the event happened. I've included labels, alerts as well as chart bubbles

input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
input offSet = 2;

assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");

def bar = barNumber();
def state = {default init, long, short};
def extreme;
def SAR;
def acc;

switch (state[1]) {
case init:
    state = state.long;
    acc = accelerationFactor;
    extreme = high;
    SAR = low;
case short:
    if (SAR[1] < high)
    then {
        state = state.long;
        acc = accelerationFactor;
        extreme = high;
        SAR = extreme[1];
    } else {
        state = state.short;
        if (low < extreme[1])
        then {
            acc = min(acc[1] + accelerationFactor, accelerationLimit);
            extreme = low;
        } else {
            acc = acc[1];
            extreme = extreme[1];
        }
        SAR = max(max(high, high[1]), SAR[1] + acc * (extreme - SAR[1]));
    }
case long:
    if (SAR[1] > low)
    then {
        state = state.short;
        acc = accelerationFactor;
        extreme = low;
        SAR = extreme[1];
    } else {
        state = state.long;
        if (high > extreme[1])
        then {
            acc = min(acc[1] + accelerationFactor, accelerationLimit);
            extreme = high;
        } else {
            acc = acc[1];
            extreme = extreme[1];
        }
        SAR = min(min(low, low[1]), SAR[1] + acc * (extreme - SAR[1]));
    }
}

plot parSAR = SAR;
parSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
parSAR.SetDefaultColor(GetColor(5));
def transitionBull = state[1] == state.short and state == state.long;
def transitionBear = state[1] == state.long and state == state.short;
def transitionBar = if transitionBull or transitionBear
                    then bar
                    else transitionBar[1];
def transitionPrice = if bar == (transitionBar)
                      then close
                      else transitionPrice[1];
def transitionBarsAgo = if bar != transitionBar
                 then bar - transitionBar
                 else if bar == transitionBar
                      then Double.NaN
                 else transitionBarsAgo[1];
def timeAxis = if IsNaN(close[-1]) and !IsNaN(close) then bar else timeAxis[1];
def hline = if GetTime() <= RegularTradingEnd(getYYYYMMDD()) and
                 transitionBar == (transitionBar)
                 then transitionPrice
                 else hline[1];
plot horizLine = hline;
horizLine.SetLineWeight(2);
horizLine.SetDefaultColor(Color.Yellow);                                                                                 horizLine.setpaintingStrategy(paintingStrategy.HORIZONTAL);
AddLabel(transitionBull or transitionBear, "PSAR Transition Detected Now!", Color.Yellow);
AddLabel(!(transitionBull or transitionBear), "PSAR Transition " + transitionBarsAgo + " bars ago", Color.Cyan);
Alert(transitionBull, "PSAR Transition Bull", Alert.BAR, Sound.Ding);
Alert(transitionBear, "PSAR Transition Bear", Alert.Bar, Sound.Ring);
AddChartBubble(bar == HighestAll(timeAxis+offSet), transitionPrice, "PSAR\nTransitioned", Color.Pink);

input showpricecolor = yes;
def bull = if transitionbull then 1 else if bull[1]==1 and !transitionbear then 1 else 0;
assignpriceColor(if !showpricecolor then color.current else if bull and close > hline then color.green else if !bull and close < hline then color.red else color.gray);
# End PSAR Transition Indicator
 
Last edited:
Tomsk Parabolic SAR Mod

This is my first post. I have been looking at the indicators created by Tomsk and he does some amazing work. I found his Parabolic SAR to be extremely useful for trading futures using renko charts. I only use the horizontal line that comes along with his study. I hope someone in this great forum could change the code so the horizontal line would change color (uptick) when the SAR turns bullish and red color (downtick) when the SAR turns bearish. I read that Tomsk is no longer active because he lost his mother and Im really sorry to hear that. I too lost my mom to cancer a couple of months ago and I can sympathize with his loss. Best regards. Stay safe out there.

Original code
# PSAR Transition Indicator
# tomsk
# 11.20.2019

# V1.0 - 11.20.2019 - tomsk - Initial release of PSAR Transition Indicator

# This study looks for a PSAR state transition (either from bullish to bearish
# or vice versa) and plots a horizontal price line into the expansion area. If
# the state transition already triggered, it calculates the number of bars ago
# the event happened. I've included labels, alerts as well as chart bubbles

input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
input offSet = 2;

assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");

def bar = barNumber();
def state = {default init, long, short};
def extreme;
def SAR;
def acc;

switch (state[1]) {
case init:
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = low;
case short:
if (SAR[1] < high)
then {
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = extreme[1];
} else {
state = state.short;
if (low < extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = low;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = max(max(high, high[1]), SAR[1] + acc * (extreme - SAR[1]));
}
case long:
if (SAR[1] > low)
then {
state = state.short;
acc = accelerationFactor;
extreme = low;
SAR = extreme[1];
} else {
state = state.long;
if (high > extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = high;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = min(min(low, low[1]), SAR[1] + acc * (extreme - SAR[1]));
}
}

plot parSAR = SAR;
parSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
parSAR.SetDefaultColor(GetColor(5));
def transitionBull = state[1] == state.short and state == state.long;
def transitionBear = state[1] == state.long and state == state.short;
def transitionBar = if transitionBull or transitionBear
then bar
else transitionBar[1];
def transitionPrice = if bar == (transitionBar)
then close
else transitionPrice[1];
def transitionBarsAgo = if bar != transitionBar
then bar - transitionBar
else if bar == transitionBar
then Double.NaN
else transitionBarsAgo[1];
def timeAxis = if IsNaN(close[-1]) and !IsNaN(close) then bar else timeAxis[1];
def hline = if GetTime() <= RegularTradingEnd(getYYYYMMDD()) and
transitionBar == (transitionBar)
then transitionPrice
else hline[1];
plot horizLine = hline;
horizLine.SetLineWeight(2);
horizLine.SetDefaultColor(Color.Yellow); horizLine.setpaintingStrategy(paintingStrategy.HORIZONTAL);
#AddLabel(transitionBull or transitionBear, "PSAR Transition Detected Now!", Color.Yellow);
#AddLabel(!(transitionBull or transitionBear), "PSAR Transition " + transitionBarsAgo + " bars ago", Color.Cyan);
#Alert(transitionBull, "PSAR Transition Bull", Alert.BAR, Sound.Ding);
#Alert(transitionBear, "PSAR Transition Bear", Alert.Bar, Sound.Ring);
#AddChartBubble(bar == HighestAll(timeAxis+offSet), transitionPrice, "PSAR\nTransitioned", Color.Pink);

input showpricecolor = yes;
def bull = if transitionbull then 1 else if bull[1]==1 and !transitionbear then 1 else 0;
assignpriceColor(if !showpricecolor then color.current else if bull and close > hline then color.green else if !bull and close < hline then color.white else color.yellow);
# End PSAR Transition Indicator
 
Last edited by a moderator:
Tomsk Parabolic SAR Mod

This is my first post. I have been looking at the indicators created by Tomsk and he does some amazing work. I found his Parabolic SAR to be extremely useful for trading futures using renko charts. I only use the horizontal line that comes along with his study. I hope someone in this great forum could change the code so the horizontal line would change color (uptick) when the SAR turns bullish and red color (downtick) when the SAR turns bearish. I read that Tomsk is no longer active because he lost his mother and Im really sorry to hear that. I too lost my mom to cancer a couple of months ago and I can sympathize with his loss. Best regards. Stay safe out there.

Original code
# PSAR Transition Indicator
# tomsk
# 11.20.2019

# V1.0 - 11.20.2019 - tomsk - Initial release of PSAR Transition Indicator

# This study looks for a PSAR state transition (either from bullish to bearish
# or vice versa) and plots a horizontal price line into the expansion area. If
# the state transition already triggered, it calculates the number of bars ago
# the event happened. I've included labels, alerts as well as chart bubbles

input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
input offSet = 2;

assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");

def bar = barNumber();
def state = {default init, long, short};
def extreme;
def SAR;
def acc;

switch (state[1]) {
case init:
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = low;
case short:
if (SAR[1] < high)
then {
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = extreme[1];
} else {
state = state.short;
if (low < extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = low;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = max(max(high, high[1]), SAR[1] + acc * (extreme - SAR[1]));
}
case long:
if (SAR[1] > low)
then {
state = state.short;
acc = accelerationFactor;
extreme = low;
SAR = extreme[1];
} else {
state = state.long;
if (high > extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = high;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = min(min(low, low[1]), SAR[1] + acc * (extreme - SAR[1]));
}
}

plot parSAR = SAR;
parSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
parSAR.SetDefaultColor(GetColor(5));
def transitionBull = state[1] == state.short and state == state.long;
def transitionBear = state[1] == state.long and state == state.short;
def transitionBar = if transitionBull or transitionBear
then bar
else transitionBar[1];
def transitionPrice = if bar == (transitionBar)
then close
else transitionPrice[1];
def transitionBarsAgo = if bar != transitionBar
then bar - transitionBar
else if bar == transitionBar
then Double.NaN
else transitionBarsAgo[1];
def timeAxis = if IsNaN(close[-1]) and !IsNaN(close) then bar else timeAxis[1];
def hline = if GetTime() <= RegularTradingEnd(getYYYYMMDD()) and
transitionBar == (transitionBar)
then transitionPrice
else hline[1];
plot horizLine = hline;
horizLine.SetLineWeight(2);
horizLine.SetDefaultColor(Color.Yellow); horizLine.setpaintingStrategy(paintingStrategy.HORIZONTAL);
#AddLabel(transitionBull or transitionBear, "PSAR Transition Detected Now!", Color.Yellow);
#AddLabel(!(transitionBull or transitionBear), "PSAR Transition " + transitionBarsAgo + " bars ago", Color.Cyan);
#Alert(transitionBull, "PSAR Transition Bull", Alert.BAR, Sound.Ding);
#Alert(transitionBear, "PSAR Transition Bear", Alert.Bar, Sound.Ring);
#AddChartBubble(bar == HighestAll(timeAxis+offSet), transitionPrice, "PSAR\nTransitioned", Color.Pink);

input showpricecolor = yes;
def bull = if transitionbull then 1 else if bull[1]==1 and !transitionbear then 1 else 0;
assignpriceColor(if !showpricecolor then color.current else if bull and close > hline then color.green else if !bull and close < hline then color.white else color.yellow);
# End PSAR Transition Indicator

Try this where the horizontal line code was moved below the bull definition. Then assignvaluecolor is used instead of setdefaultcolor to color the line.

Ruby:
# PSAR Transition Indicator
# tomsk
# 11.20.2019

# V1.0 - 11.20.2019 - tomsk - Initial release of PSAR Transition Indicator

# This study looks for a PSAR state transition (either from bullish to bearish
# or vice versa) and plots a horizontal price line into the expansion area. If
# the state transition already triggered, it calculates the number of bars ago
# the event happened. I've included labels, alerts as well as chart bubbles

input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
input offSet = 2;

assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");

def bar = barNumber();
def state = {default init, long, short};
def extreme;
def SAR;
def acc;

switch (state[1]) {
case init:
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = low;
case short:
if (SAR[1] < high)
then {
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = extreme[1];
} else {
state = state.short;
if (low < extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = low;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = max(max(high, high[1]), SAR[1] + acc * (extreme - SAR[1]));
}
case long:
if (SAR[1] > low)
then {
state = state.short;
acc = accelerationFactor;
extreme = low;
SAR = extreme[1];
} else {
state = state.long;
if (high > extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = high;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = min(min(low, low[1]), SAR[1] + acc * (extreme - SAR[1]));
}
}

plot parSAR = SAR;
parSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
parSAR.SetDefaultColor(GetColor(5));
def transitionBull = state[1] == state.short and state == state.long;
def transitionBear = state[1] == state.long and state == state.short;
def transitionBar = if transitionBull or transitionBear
then bar
else transitionBar[1];
def transitionPrice = if bar == (transitionBar)
then close
else transitionPrice[1];
def transitionBarsAgo = if bar != transitionBar
then bar - transitionBar
else if bar == transitionBar
then Double.NaN
else transitionBarsAgo[1];
def timeAxis = if IsNaN(close[-1]) and !IsNaN(close) then bar else timeAxis[1];
def hline = if GetTime() <= RegularTradingEnd(getYYYYMMDD()) and
transitionBar == (transitionBar)
then transitionPrice
else hline[1];

#AddLabel(transitionBull or transitionBear, "PSAR Transition Detected Now!", Color.Yellow);
#AddLabel(!(transitionBull or transitionBear), "PSAR Transition " + transitionBarsAgo + " bars ago", Color.Cyan);
#Alert(transitionBull, "PSAR Transition Bull", Alert.BAR, Sound.Ding);
#Alert(transitionBear, "PSAR Transition Bear", Alert.Bar, Sound.Ring);
#AddChartBubble(bar == HighestAll(timeAxis+offSet), transitionPrice, "PSAR\nTransitioned", Color.Pink);

input showpricecolor = yes;
def bull = if transitionbull then 1 else if bull[1]==1 and !transitionbear then 1 else 0;
assignpriceColor(if !showpricecolor then color.current else if bull and close > hline then color.green else if !bull and close < hline then color.white else color.yellow);

plot horizLine = hline;
horizLine.SetLineWeight(2);
horizLine.assignValueColor(if bull then color.uptick else color.downtick);
horizLine.setpaintingStrategy(paintingStrategy.HORIZONTAL);
# End PSAR Transition Indicator
 
See if this helps where all transitional lines appear until a new one is formed. A price coloring option is included where the close is greater than a bull transition line, the candles will be colored green, closes below bear transition line will be colored red, and otherwise gray.
Sorry I wasn't notified there was a reply. Sad face emoji.

This is really cool! Is there a way to have the lines at where the psar was broken instead of where the close > greater than psar? For example if the psar was at 50 and the bar closed at 51 to still have the line be at 50?

What I'm really trying to do is get an alert if the price right now hits the psar.
 
See if this helps where all transitional lines appear until a new one is formed. A price coloring option is included where the close is greater than a bull transition line, the candles will be colored green, closes below bear transition line will be colored red, and otherwise gray.
I managed to figure out (with my MacGruber level coding skillset) how to print a label on the chart with the current psar level. Now I want to get an alert if the current price = the label.https://www.dropbox.com/s/fse6d4w2g71ifmv/2021-12-17-TOS_CHARTS.png?dl=0
 
I just found this code

def parsar = reference parabolicSAR();
addlabel(yes, "PARSAR[1]) " + astext(parsar[1]), color.white);

How do I get an alert that the current price (or current price +/- .005% or whatever) = label

Thanks!
 
I just found this code

def parsar = reference parabolicSAR();
addlabel(yes, "PARSAR[1]) " + astext(parsar[1]), color.white);

How do I get an alert that the current price (or current price +/- .005% or whatever) = label

Thanks!
Code:
def parsar = reference parabolicSAR();
addlabel(yes, "PARSAR[1]) " + astext(parsar[1]), color.white);
def psarAlert = between(close, parsar * .995, parsar * 1.005) ;
Alert(psarAlert, "psar alert", Alert.Bar, Sound.Chimes);
 
Hi! - quick question here - how would I reference the parabolic sar crossover in TOS? Specifically, I'm looking to include the bullish crossing type into my strategy for a buy point and the bearish crossing type for a sell point.

I've tried reference ParabolicSARCrossover(0.02, 0.2, bullish) and reference ParabolicSARCrossover(0.02, 0.2, bearish) and it's not working for some reason.

Any help is much appreciated!
 
Last edited by a moderator:
Hi! - quick question here - how would I reference the parabolic sar crossover in TOS? Specifically, I'm looking to include the bullish crossing type into my strategy for a buy point and the bearish crossing type for a sell point.

I've tried reference ParabolicSARCrossover(0.02, 0.2, bullish) and reference ParabolicSARCrossover(0.02, 0.2, bearish) and it's not working for some reason.

Any help is much appreciated!
crossingtype is not used any more.
This get you to the same place:
Ruby:
def sar = reference ParabolicSAR(0.02, 0.2) ;
def bullish = close crosses above sar ;
def bearish = close crosses below sar ;
 
Last edited:
See if this helps where all transitional lines appear until a new one is formed. A price coloring option is included where the close is greater than a bull transition line, the candles will be colored green, closes below bear transition line will be colored red, and otherwise gray.
how do I edit the code to get rid of the pink text bubble on the chart?
 
how do I edit the code to get rid of the pink text bubble on the chart?

Modify this code

Ruby:
AddChartBubble(bar == HighestAll(timeAxis+offSet), transitionPrice, "PSAR\nTransitioned", Color.Pink);

Replace it with

Ruby:
input showbubble = no;
AddChartBubble(showbubble and bar == HighestAll(timeAxis+offSet), transitionPrice, "PSAR\nTransitioned", Color.Pink);
 
Modify this code

Ruby:
AddChartBubble(bar == HighestAll(timeAxis+offSet), transitionPrice, "PSAR\nTransitioned", Color.Pink);

Replace it with

Ruby:
input showbubble = no;
AddChartBubble(showbubble and bar == HighestAll(timeAxis+offSet), transitionPrice, "PSAR\nTransitioned", Color.Pink);
sorry for double question post, fixed - THANKS MUCH!
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
502 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top