T H A O Y A N G

The Code

				
					//@version=1
//SYMPLE Algo
indicator("SYMPLE Algo", overlay=true)
 
qrlcfqj = input.string(defval = 'Auto', title='MODE', options=['Auto','Manual'], group = 'SYMPLE MODE')
 
jgqfpnj = input.string(defval = 'Balanced: Medium early & certain signals', title = 'Your Trading Style', options = ['Dynamic: Earlier but less certain signals','Balanced: Medium early & certain signals','Safe: More certain but later signals'], group = 'Only in AUTO MODE')
hkxfcrk = input.string(defval = 'AUTO', title = 'Entry Length', options = ['AUTO','1','2','3','4'], group = 'Only in MANUAL MODE')
tdmdezw = input.string(defval = 'AUTO', title = 'Entry Smooth', options = ['AUTO','0','1','2','3'], group = 'Only in MANUAL MODE')
mvzrtsx = input.string(defval = 'AUTO', title = 'Exit Length', options = ['AUTO','1','2','3','4','5','6','7','8'], group = 'Only in MANUAL MODE')
uoccdav = input.string(title = 'Exit Value', options = ['AUTO','1','2','3','4','5','6','7','8'], defval = 'AUTO', group = 'Only in MANUAL MODE')
ioqfuqm = input.string (defval = 'AUTO', title = 'Fake Trend Detector', options = ['AUTO','OFF','1','2','3','4','5','6','7'], group = 'Only in MANUAL MODE')
 
dev2 = 1
 
var int difcegz = na
var int hbslpuv = na
var int iagcagd = na
var float mevkzoo = na
var int jcqwadb = na
var int pezywkm = na
var color azldinz = na
 
if qrlcfqj == 'Auto'
    if jgqfpnj == 'Dynamic: Earlier but less certain signals'
        hbslpuv := 15
        iagcagd := 0
        difcegz := 2
        jcqwadb := 92
        pezywkm := 3
    if jgqfpnj == 'Balanced: Medium early & certain signals'
        hbslpuv := 24
        iagcagd := 2
        difcegz := 8
        jcqwadb := 50
        pezywkm := 13
    if jgqfpnj == 'Safe: More certain but later signals'
        hbslpuv := 35
        iagcagd := 4
        difcegz := 8
        jcqwadb := 50
        pezywkm := 40
 
if qrlcfqj == 'Manual'
    if hkxfcrk == 'AUTO'
        hbslpuv := 24
    if hkxfcrk == '1'
        hbslpuv := 12
    if hkxfcrk == '2'
        hbslpuv := 20
    if hkxfcrk == '3'
        hbslpuv := 28
    if hkxfcrk == '4'
        hbslpuv := 36
 
    if tdmdezw == 'AUTO'
        iagcagd := 2
    if tdmdezw == '0'
        iagcagd := 0
    if tdmdezw == '1'
        iagcagd := 1
    if tdmdezw == '2'
        iagcagd := 3
    if tdmdezw == '3'
        iagcagd := 5
 
    if mvzrtsx == 'AUTO'
        difcegz := 8
    if mvzrtsx == '1'
        difcegz := 2
    if mvzrtsx == '2'
        difcegz := 3
    if mvzrtsx == '3'
        difcegz := 5
    if mvzrtsx == '4'
        difcegz := 7
    if mvzrtsx == '5'
        difcegz := 10
    if mvzrtsx == '6'
        difcegz := 13
    if mvzrtsx == '7'
        difcegz := 16
    if mvzrtsx == '8'
        difcegz := 19
 
    if uoccdav == 'AUTO'
        if difcegz == 8
            jcqwadb := 50
        if difcegz == 2
            jcqwadb := 91
        if difcegz == 3
            jcqwadb := 80
        if difcegz == 5
            jcqwadb := 65
        if difcegz == 7
            jcqwadb := 54
        if difcegz == 10
            jcqwadb := 41
        if difcegz == 13
            jcqwadb := 37
        if difcegz == 16
            jcqwadb := 33
        if difcegz == 19
            jcqwadb := 29
           
    if uoccdav == '1'
        jcqwadb := 100 - difcegz*3
    if uoccdav == '2'
        jcqwadb := 98 - difcegz*3
    if uoccdav == '3'
        jcqwadb := 95 - difcegz*3
    if uoccdav == '4'
        jcqwadb := 91 - difcegz*3
    if uoccdav == '5'
        jcqwadb := 86 - difcegz*3
    if uoccdav == '6'
        jcqwadb := 80 - difcegz*3
    if uoccdav == '7'
        jcqwadb := 73 - difcegz*3
    if uoccdav == '8'
        jcqwadb := 65 - difcegz*3
 
    if ioqfuqm == 'AUTO'
        pezywkm := 13
    if ioqfuqm == 'OFF'
        pezywkm := 1
    if ioqfuqm == '1'
        pezywkm := 3
    if ioqfuqm == '2'
        pezywkm := 5
    if ioqfuqm == '3'
        pezywkm := 12
    if ioqfuqm == '4'
        pezywkm := 21
    if ioqfuqm == '5'
        pezywkm := 34
    if ioqfuqm == '6'
        pezywkm := 55
    if ioqfuqm == '7'
        pezywkm := 89
 
var float gvrwlrs = na
khmurvb = math.max(ta.highest(close, pezywkm),ta.highest(open, pezywkm))
khmurvb1 = math.max(ta.highest(close, pezywkm + 1),ta.highest(open, pezywkm + 1))
khmurvb2 = math.max(ta.highest(close, pezywkm + 2),ta.highest(open, pezywkm + 2))
khmurvb3 = math.max(ta.highest(close, pezywkm + 3),ta.highest(open, pezywkm + 3))
khmurvb4 = math.max(ta.highest(close, pezywkm + 4),ta.highest(open, pezywkm + 4))
khmurvb5 = math.max(ta.highest(close, pezywkm + 5),ta.highest(open, pezywkm + 5))
khmurvb6 = math.max(ta.highest(close, pezywkm + 6),ta.highest(open, pezywkm + 6))
khmurvb7 = math.max(ta.highest(close, pezywkm + 7),ta.highest(open, pezywkm + 7))
khmurvb8 = math.max(ta.highest(close, pezywkm + 8),ta.highest(open, pezywkm + 8))
khmurvb9 = math.max(ta.highest(close, pezywkm + 9),ta.highest(open, pezywkm + 9))
khmurvb10 = math.max(ta.highest(close, pezywkm + 10),ta.highest(open, pezywkm + 10))
khmurvb11 = math.max(ta.highest(close, pezywkm + 11),ta.highest(open, pezywkm + 11))
khmurvb12 = math.max(ta.highest(close, pezywkm + 12),ta.highest(open, pezywkm + 12))
khmurvb13 = math.max(ta.highest(close, pezywkm + 13),ta.highest(open, pezywkm + 13))
 
if khmurvb1[1] > khmurvb[1]
    if khmurvb2[1] > khmurvb1[1]
        if khmurvb3[1] > khmurvb2[1]
            if khmurvb4[1] > khmurvb3[1]
                if khmurvb5[1] > khmurvb4[1]
                    if khmurvb6[1] > khmurvb5[1]
                        if khmurvb7[1] > khmurvb6[1]
                            if khmurvb8[1] > khmurvb7[1]
                                if khmurvb9[1] > khmurvb8[1]
                                    if khmurvb10[1] > khmurvb9[1]
                                        if khmurvb11[1] > khmurvb10[1]
                                            if khmurvb12[1] > khmurvb11[1]
                                                if khmurvb13[1] > khmurvb12[1]
                                                    gvrwlrs := khmurvb13[1]
                                                else
                                                    gvrwlrs := khmurvb12[1]
                                            else
                                                gvrwlrs := khmurvb11[1]
                                        else
                                            gvrwlrs := khmurvb10[1]
                                    else
                                        gvrwlrs := khmurvb9[1]
                                else
                                    gvrwlrs := khmurvb8[1]
                            else
                                gvrwlrs := khmurvb7[1]
                        else
                            gvrwlrs := khmurvb6[1]
                    else
                        gvrwlrs := khmurvb5[1]
                else
                    gvrwlrs := khmurvb4[1]
            else
                gvrwlrs := khmurvb3[1]
        else
            gvrwlrs := khmurvb2[1]
    else
        gvrwlrs := khmurvb1[1]
else
    gvrwlrs := khmurvb[1]
var float zudwnqp = na
//
var float cekzcvu = na
jrmhdmi = math.min(ta.lowest(close, pezywkm),ta.lowest(open, pezywkm))
jrmhdmi1 = math.min(ta.lowest(close, pezywkm + 1),ta.lowest(open, pezywkm + 1))
jrmhdmi2 = math.min(ta.lowest(close, pezywkm + 2),ta.lowest(open, pezywkm + 2))
jrmhdmi3 = math.min(ta.lowest(close, pezywkm + 3),ta.lowest(open, pezywkm + 3))
jrmhdmi4 = math.min(ta.lowest(close, pezywkm + 4),ta.lowest(open, pezywkm + 4))
jrmhdmi5 = math.min(ta.lowest(close, pezywkm + 5),ta.lowest(open, pezywkm + 5))
jrmhdmi6 = math.min(ta.lowest(close, pezywkm + 6),ta.lowest(open, pezywkm + 6))
jrmhdmi7 = math.min(ta.lowest(close, pezywkm + 7),ta.lowest(open, pezywkm + 7))
jrmhdmi8 = math.min(ta.lowest(close, pezywkm + 8),ta.lowest(open, pezywkm + 8))
jrmhdmi9 = math.min(ta.lowest(close, pezywkm + 9),ta.lowest(open, pezywkm + 9))
jrmhdmi10 = math.min(ta.lowest(close, pezywkm + 10),ta.lowest(open, pezywkm + 10))
jrmhdmi11 = math.min(ta.lowest(close, pezywkm + 11),ta.lowest(open, pezywkm + 11))
jrmhdmi12 = math.min(ta.lowest(close, pezywkm + 12),ta.lowest(open, pezywkm + 12))
jrmhdmi13 = math.min(ta.lowest(close, pezywkm + 13),ta.lowest(open, pezywkm + 13))
 
if jrmhdmi1[1] < jrmhdmi[1]
    if jrmhdmi2[1] < jrmhdmi1[1]
        if jrmhdmi3[1] < jrmhdmi2[1]
            if jrmhdmi4[1] < jrmhdmi3[1]  
                if jrmhdmi5[1] < jrmhdmi4[1]
                    if jrmhdmi6[1] < jrmhdmi5[1]
                        if jrmhdmi7[1] < jrmhdmi6[1]
                            if jrmhdmi8[1] < jrmhdmi7[1]
                                if jrmhdmi9[1] < jrmhdmi8[1]
                                    if jrmhdmi10[1] < jrmhdmi9[1]
                                        if jrmhdmi1[1] < jrmhdmi10[1]
                                            if jrmhdmi12[1] < jrmhdmi11[1]
                                                if jrmhdmi13[1] < jrmhdmi12[1]
                                                    cekzcvu := jrmhdmi13[1]
                                                else
                                                    cekzcvu := jrmhdmi12[1]
                                            else
                                                cekzcvu := jrmhdmi11[1]
                                        else
                                            cekzcvu := jrmhdmi10[1]
                                    else
                                        cekzcvu := jrmhdmi9[1]
                                else
                                    cekzcvu := jrmhdmi8[1]
                            else
                                cekzcvu := jrmhdmi7[1]
                        else
                            cekzcvu := jrmhdmi6[1]
                    else
                        cekzcvu := jrmhdmi5[1]
                else
                    cekzcvu := jrmhdmi4[1]
            else
                cekzcvu := jrmhdmi3[1]
        else
            cekzcvu := jrmhdmi2[1]
    else
        cekzcvu := jrmhdmi1[1]
else
    cekzcvu := jrmhdmi[1]
 
var float sfvmlgo = na
 
cteijyh = hlc3
slllpie = ta.sma(cteijyh, hbslpuv)
mmgraoe = (cteijyh - slllpie) / (0.015 * ta.dev(cteijyh, hbslpuv))
if iagcagd == 0
    mevkzoo := mmgraoe
if iagcagd == 1
    mevkzoo := (mmgraoe+mmgraoe[1])/2
if iagcagd == 2
    mevkzoo := (mmgraoe+mmgraoe[1]+mmgraoe[2])/3
if iagcagd == 3
    mevkzoo := (mmgraoe+mmgraoe[1]+mmgraoe[2]+mmgraoe[3])/4
if iagcagd == 4
    mevkzoo := (mmgraoe+mmgraoe[1]+mmgraoe[2]+mmgraoe[3]+mmgraoe[4])/5
if iagcagd == 5
    mevkzoo := (mmgraoe+mmgraoe[1]+mmgraoe[2]+mmgraoe[3]+mmgraoe[4]+mmgraoe[5])/6
 
wnwxafr = ta.atr(89)
 
if mevkzoo > 0 and mevkzoo[1] <= 0
    zudwnqp := gvrwlrs + wnwxafr*0.25
 
if mevkzoo < 0 and mevkzoo[1] >= 0
    sfvmlgo := cekzcvu - wnwxafr*0.25
 
var int hmyzgba = na
var int ugmuqhg = na
var int fotxuru = na
 
var int atcwqeq = 0
 
azldinz := color.gray
 
if mevkzoo > 0
    atcwqeq := 1
 
if mevkzoo < 0
    atcwqeq := 0
 
var int gxzvuyq = na
var int zuuyqhm = na
var int nxwheqt = na
var int kydzptp = na
pkxcpaa = ta.atr(180)
 
if nxwheqt > gxzvuyq and atcwqeq == 1
    if close > zudwnqp or pezywkm == 1
        ourLabel = label.new(x=bar_index, y=low - pkxcpaa*dev2, text="Long", color=color.green, textcolor=color.white, style=label.style_label_up, size=size.normal)
        alert(syminfo.ticker + " LONG signal", alert.freq_once_per_bar_close)
        azldinz := color.rgb(0, 255, 8)
        hmyzgba := 1
        gxzvuyq := bar_index
    else
        azldinz := color.gray
else
    if atcwqeq == 1 and atcwqeq[1] == 1
        azldinz := color.green
 
if kydzptp > zuuyqhm and atcwqeq == 0
    if close < sfvmlgo or pezywkm == 1
        ourLabel = label.new(x=bar_index, y=high + pkxcpaa*dev2, text="Short", color=color.red, textcolor=color.white, style=label.style_label_down, size=size.normal)
        alert(syminfo.ticker + " SHORT signal", alert.freq_once_per_bar_close)
        azldinz := color.red
        ugmuqhg := 1
        zuuyqhm := bar_index
    else
        azldinz := color.gray
else
    if atcwqeq == 0 and atcwqeq[1] == 0
        azldinz := color.red
 
if mevkzoo > 0 and mevkzoo[1] <= 0
    if close > zudwnqp or pezywkm == 1
        ourLabel = label.new(x=bar_index, y=low - pkxcpaa*dev2, text="Long", color=color.green, textcolor=color.white, style=label.style_label_up, size=size.normal)
        alert(syminfo.ticker + " LONG signal", alert.freq_once_per_bar_close)
        azldinz := color.green
        gxzvuyq := bar_index
        hmyzgba := 1
        nxwheqt := nxwheqt[1]
    else
        nxwheqt := bar_index
 
if mevkzoo < 0 and mevkzoo[1]>= 0
    if close < sfvmlgo or pezywkm == 1
        ourLabel = label.new(x=bar_index, y=high + pkxcpaa*dev2, text="Short", color=color.red, textcolor=color.white, style=label.style_label_down, size=size.normal)
        alert(syminfo.ticker + " SHORT signal", alert.freq_once_per_bar_close)
        azldinz := color.red
        ugmuqhg := 1
        zuuyqhm := bar_index
        kydzptp := kydzptp[1]
    else
        kydzptp := bar_index
 
[xeiauvh, avetmvr, iwkgipb] = ta.dmi(difcegz, difcegz)
var int auzxifw = na
var int ucposcy = na
var int wvzwzrz = na
 
if azldinz == color.green or azldinz == color.red
    if (iwkgipb[1] >= jcqwadb and iwkgipb[1] > iwkgipb and iwkgipb[2] <= iwkgipb[1] and iwkgipb[3] <= iwkgipb[2] and iwkgipb[4] <= iwkgipb[3])
        if (azldinz == color.green and xeiauvh > avetmvr) or (azldinz == color.red and xeiauvh < avetmvr)
            if auzxifw > 0
                if (bar_index - auzxifw) > 3
                    ucposcy := 1
                    auzxifw := bar_index
                    if azldinz == color.green
                        if gxzvuyq[1] > auzxifw[1]
                            wvzwzrz := 1
                        else
                            wvzwzrz := wvzwzrz + 1
                    if azldinz == color.red
                        if zuuyqhm[1] > auzxifw[1]
                            wvzwzrz := 1
                        else
                            wvzwzrz := wvzwzrz + 1
            else
                ucposcy := 1
                auzxifw := bar_index
 
if ucposcy == 1
    if azldinz == color.green
        ourLabel = label.new(x=bar_index, y=high + pkxcpaa*dev2, text="TP " + str.tostring(wvzwzrz), color=#FFFF00, textcolor=#000000, style=label.style_label_down, size=size.normal)
        alert(syminfo.ticker + " EXIT Long signal", alert.freq_once_per_bar_close)
        fotxuru := 1
        azldinz := #ffff00
 
    if azldinz == color.red
        ourLabel = label.new(x=bar_index, y=low - pkxcpaa*dev2, text="TP " + str.tostring(wvzwzrz), color=#FFFF00, textcolor=#000000, style=label.style_label_up, size=size.normal)
        alert(syminfo.ticker + " EXIT Short", alert.freq_once_per_bar_close)
        fotxuru := 1
        azldinz := #ffff00
 
alertcondition(hmyzgba == 1,'Buy Signal')
alertcondition(ugmuqhg == 1,'Sell Signal')
alertcondition(fotxuru == 1,'Take Profit Signal')
 
barcolor(azldinz)
plotcandle(open, high, low, close, title='Title', color = azldinz, wickcolor = azldinz, bordercolor = azldinz)
azldinz := na
ucposcy := na
hmyzgba := na
ugmuqhg := na
fotxuru := na
				
			

How to Install Code

To install a custom indicator using Pine Script in TradingView, follow these steps:

  1. Navigate to your desired chart on TradingView.
  2. At the bottom of the chart, locate and click on the Pine Editor tab.
  3. Open Pine Editor
  4. Choose “Blank indicator script” from the “New” dropdown menu at the top right corner of the editor.
  5. Copy the Pine Script code from above into the empty editor area.
  6. Press the Save icon near the upper left side of the editor panel.
  7. Enter a filename without spaces and press OK.
  8. Finally, hit the Add to Chart button next to the file selector box.

Your newly added indicator should display beneath the chart in a dedicated pane. Remember to refresh the browser occasionally while editing complex scripts since changes sometimes require refreshing to update properly.

Settings for the Indicator

MODE

The SYMPLE Algo operates in two modes: AUTO and MANUAL.

  • AUTO MODE: The algorithm automatically selects the best settings for all parameters. If you’re a beginner or prefer not to manually set the algorithm, use AUTO MODE.
    • Your Trading Style:
      • Dynamic Signals: Frequent, short, early, and less certain signals.
      • Balanced Signals: Moderately frequent, long, early, and certain signals.
      • Safe Signals: Least frequent, longest, latest, and most certain signals.
  • MANUAL MODE: Allows manual selection of preferred settings for one or more parameters. If you’re advanced or want manual control, use MANUAL MODE.
    • Entry Length: Determines entry signal generation based on past data. Smaller values for more, shorter, less certain, but early signals; larger values for fewer, longer, more certain, but later signals.
    • Entry Smooth: Determines how much data used for Entry Signals should be smoothed. Smaller values for more, shorter, less certain, but early signals; larger values for fewer, longer, more certain, but later signals.
    • Exit Length: Determines exit signal generation based on past data. Smaller values for more, shorter, less certain, but early signals; larger values for fewer, longer, more certain, but later signals.
    • Entry Value: Determines sensitivity of Exit Signals generating. Smaller values generate fewer Exit Signals; larger values generate more Exit Signals.
    • Fake Trend Detector: Determines sensitivity of false trend detection. Smaller values recognize fewer candles as false trends; larger values recognize more candles as false trends.

Explore different settings by clicking “SYMPLE Algo” on the top-left corner of the TradingView chart window.

When to Buy, Sell, Exit?

There’s no single correct way, but most traders follow these interpretations:

  • Long Signal (Green Candle): Open a long position/close a short position. (uptrend may begin)
  • Short Signal (Red Candle): Open a short position/close a long position. (downtrend may begin)
  • Take Profit Signal (Yellow Candle): Close current trend position. (trend may stop or reverse)
  • Fake Trend Detection (Gray Candle): Close all and don’t open new positions. (trend no longer identifiable)

For higher certainty, confirm signals using other trading methods.

Why “Take Profit” signal variation?

Multiple signals may appear as SYMPLE Algo detects potential trend reversal points. No signal doesn’t mean a loss.

Alerts

Built-in alerts notify Buy, Sell, or Exit signals.

  • Enable Alerts using Computer:
    • Open the chart, select timeframe.
    • Click the “clock” icon, create alerts, and choose notification preferences.
  • Enable Alerts using Mobile:
    • Open the chart, select timeframe.
    • Click the “+” icon, select “Alerts,” and set notification preferences.

You can have multiple alerts from different charts simultaneously, based on your TradingView plan.