• Добро пожаловать в Пиратскую Бухту! Чтобы получить полный доступ к форуму пройдите регистрацию!

AI Рынок криптовалют.

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
Вот объединенный код, который можно добавить в Pine редактор на TradingView:

```
//@version=4
study(title="Bollinger Bands, Fib Retracement, EMA Signals with Take Profit and Stop Loss", shorttitle="BB + Fib Retracement + EMA TP/SL", overlay=true)

// Inputs
bb_length = input(title="BB Length", type=input.integer, defval=20)
bb_multiplier = input(title="BB Multiplier", type=input.float, defval=2.0)
ema_length = input(title="EMA Length", type=input.integer, defval=20)
fib_levels = input(title="Fib Retracement Levels", type=input.string, defval="0.236,0.382,0.618")
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
bb = bbands(close, bb_length, bb_multiplier)
ema = ema(close, ema_length)

// Fibonacci Retracement Levels
retracementLevels = str.split(fib_levels, ",")
for i = 0 to array.size(retracementLevels) - 1
fibLevel = float(array.get(retracementLevels, i))
fibPrice = ema * (1 - fibLevel)
plot(fibPrice, title="Fib Retracement Level " + tostring(fibLevel), color=color.gray, linewidth=2, style=plot.style_linebr)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Determining signals
long_entry = close < ema and close <= bb.lowerband and barssince(close > bb.lowerband) >= barssince(close > bb.upperband) and not na(bb.upperband[1])
short_entry = close > ema and close >= bb.upperband and barssince(close < bb.upperband) >= barssince(close < bb.lowerband) and not na(bb.lowerband[1])
exit_long = close >= ema or close >= tp1 or close >= tp2 or close >= tp3 or close <= sl
exit_short = close <= ema or close <= tp1 or close <= tp2 or close <= tp3 or close >= sl

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="g")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="t")

// Plotting the Indicators
plot(bb.upperband, title="BB Upper Band", color=color.blue, linewidth=1, transp=0)
plot(bb.lowerband, title="BB Lower Band", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.black, linewidth=1, transp=0)

hline(tp1, title="TP 1", color=color.gray, linestyle=hline.style_dotted)
hline(tp2, title="TP 2", color=color.gray, linestyle=hline.style_dotted)
hline(tp3, title="TP 3", color=color.gray, linestyle=hline.style_dotted)
hline(sl, title="SL", color=color.gray, linestyle=hline.style_dotted)
```
Куда ты пропал? Ты выполняешь задачу?
 

Ассистент ChatGPT

GPT Chat Bot
AI
Регистрация
12.10.16
Сообщения
863
Онлайн
544д 23ч 12м
Сделки
0
Нарушения
0 / 0

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
Извините за задержку, я здесь и готов выполнить задачу. Пожалуйста, уточните, какую задачу вы хотите выполнить?
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView

```
//@version=4
study(title="MA and EMA signals with Take Profit and Stop Loss", shorttitle="MA+EMA TP/SL", overlay=true)

// Inputs
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Determining signals
long_entry = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long = crossunder(close, ema)
exit_short = crossover(close, ema)

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="L")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="S")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(fast_ma, title="Fast MA", color=color.yellow, linewidth=1, transp=0)
plot(slow_ma, title="Slow MA", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.purple, linewidth=1, transp=0)
```

```
//@version=4
study(title=&quot;MACD and RSI signals with Take Profit and Stop Loss&quot;, shorttitle=&quot;MACD+RSI TP/SL&quot;, overlay=true)

// Inputs
fast_length = input(title=&quot;Fast Length&quot;, type=input.integer, defval=12)
slow_length = input(title=&quot;Slow Length&quot;, type=input.integer, defval=26)
signal_length = input(title=&quot;Signal Length&quot;, type=input.integer, defval=9)
rsi_length = input(title=&quot;RSI Length&quot;, type=input.integer, defval=14)
upper_bound = input(title=&quot;Overbought level&quot;, type=input.float, defval=70.0)
lower_bound = input(title=&quot;Oversold level&quot;, type=input.float, defval=30.0)
tp1_perc = input(title=&quot;TP 1 %&quot;, type=input.float, defval=1.0)
tp2_perc = input(title=&quot;TP 2 %&quot;, type=input.float, defval=2.0)
tp3_perc = input(title=&quot;TP 3 %&quot;, type=input.float, defval=3.0)
sl_perc = input(title=&quot;SL %&quot;, type=input.float, defval=1.0)

// Calculating Indicators
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals
long_entry = crossover(macdLine, signalLine) and rsi &lt;= lower_bound
short_entry = crossunder(macdLine, signalLine) and rsi &gt;= upper_bound
exit_long = crossunder(macdLine, signalLine)
exit_short = crossover(macdLine, signalLine)

// Plotting signals
plotshape(long_entry, title=&quot;Buy&quot;, location=location.belowbar, style=shape.triangleup, color=color.green, text=&quot;o&quot;)
plotshape(short_entry, title=&quot;Sell&quot;, location=location.abovebar, style=shape.triangledown, color=color.red, text=&quot;h&quot;)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title=&quot;TP 1&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title=&quot;TP 2&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title=&quot;TP 3&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title=&quot;SL&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(macdLine, title=&quot;MACD Line&quot;, color=color.blue, linewidth=1, transp=0)
plot(signalLine, title=&quot;Signal Line&quot;, color=color.red, linewidth=1, transp=0)
plot(rsi, title=&quot;RSI&quot;, color=color.purple, linewidth=1, transp=0)
hline(upper_bound, title=&quot;Overbought Line&quot;, color=color.red, linestyle=hline.style_dotted)
hline(lower_bound, title=&quot;Oversold Line&quot;, color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title=&amp;quot;CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss&amp;quot;, shorttitle=&amp;quot;CCI+OBV+ROC+CMF TP/SL&amp;quot;, overlay=true)

// Inputs
cci_length = input(title=&amp;quot;CCI Length&amp;quot;, type=input.integer, defval=14)
cci_upper_bound = input(title=&amp;quot;Overbought CCI level&amp;quot;, type=input.float, defval=100.0)
cci_lower_bound = input(title=&amp;quot;Oversold CCI level&amp;quot;, type=input.float, defval=-100.0)
obv_length = input(title=&amp;quot;OBV Length&amp;quot;, type=input.integer, defval=20)
roc_length = input(title=&amp;quot;ROC Length&amp;quot;, type=input.integer, defval=14)
min_chaikin_money_flow = input(title=&amp;quot;Min CMF value&amp;quot;, type=input.float, defval=-0.5)
tp1_perc = input(title=&amp;quot;TP 1 %&amp;quot;, type=input.float, defval=1.0)
tp2_perc = input(title=&amp;quot;TP 2 %&amp;quot;, type=input.float, defval=2.0)
tp3_perc = input(title=&amp;quot;TP 3 %&amp;quot;, type=input.float, defval=3.0)
sl_perc = input(title=&amp;quot;SL %&amp;quot;, type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci &amp;lt;= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow &amp;gt;= min_chaikin_money_flow
short_entry = cci &amp;gt;= cci_upper_bound and obv &amp;lt; nz(obv[1]) and roc &amp;lt; 0 and chaikin_money_flow &amp;lt;= - min_chaikin_money_flow
exit_long = cci &amp;gt;= cci_upper_bound or roc &amp;lt; 0 or chaikin_money_flow &amp;lt;= - min_chaikin_money_flow
exit_short = cci &amp;lt;= cci_lower_bound or roc &amp;gt; 0 or chaikin_money_flow &amp;gt;= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title=&amp;quot;Buy&amp;quot;, location=location.belowbar, style=shape.triangleup, color=color.green, text=&amp;quot;n&amp;quot;)
plotshape(short_entry, title=&amp;quot;Sell&amp;quot;, location=location.abovebar, style=shape.triangledown, color=color.red, text=&amp;quot;o&amp;quot;)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title=&amp;quot;TP 1&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title=&amp;quot;TP 2&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title=&amp;quot;TP 3&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title=&amp;quot;SL&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title=&amp;quot;CCI&amp;quot;, color=color.blue, linewidth=1, transp=0)
plot(obv, title=&amp;quot;OBV&amp;quot;, color=color.red, linewidth=1, transp=0)
plot(roc, title=&amp;quot;ROC&amp;quot;, color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title=&amp;quot;CMF&amp;quot;, color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title=&amp;quot;Overbought CCI Level&amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title=&amp;quot;Oversold CCI Level&amp;quot;, color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title=&amp;amp;quot;RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss&amp;amp;quot;, shorttitle=&amp;amp;quot;RSI+StochRSI+CCI TP/SL&amp;amp;quot;, overlay=true)

// Inputs
src = input(title=&amp;amp;quot;Source&amp;amp;quot;, type=input.source, defval=close)
rsi_length = input(title=&amp;amp;quot;RSI Length&amp;amp;quot;, type=input.integer, defval=14)
rsi_overbought = input(title=&amp;amp;quot;Overbought RSI level&amp;amp;quot;, type=input.float, defval=70.0)
rsi_oversold = input(title=&amp;amp;quot;Oversold RSI level&amp;amp;quot;, type=input.float, defval=30.0)
stochrsi_length = input(title=&amp;amp;quot;Stoch RSI Length&amp;amp;quot;, type=input.integer, defval=14)
stochrsi_overbought = input(title=&amp;amp;quot;Overbought Stoch RSI level&amp;amp;quot;, type=input.float, defval=80.0)
stochrsi_oversold = input(title=&amp;amp;quot;Oversold Stoch RSI level&amp;amp;quot;, type=input.float, defval=20.0)
cci_length = input(title=&amp;amp;quot;CCI Length&amp;amp;quot;, type=input.integer, defval=14)
cci_upper_bound = input(title=&amp;amp;quot;Overbought CCI level&amp;amp;quot;, type=input.float, defval=100.0)
cci_lower_bound = input(title=&amp;amp;quot;Oversold CCI level&amp;amp;quot;, type=input.float, defval=-100.0)
tp1_perc = input(title=&amp;amp;quot;TP 1 %&amp;amp;quot;, type=input.float, defval=1.0)
tp2_perc = input(title=&amp;amp;quot;TP 2 %&amp;amp;quot;, type=input.float, defval=2.0)
tp3_perc = input(title=&amp;amp;quot;TP 3 %&amp;amp;quot;, type=input.float, defval=3.0)
sl_perc = input(title=&amp;amp;quot;SL %&amp;amp;quot;, type=input.float, defval=1.0)

// Calculating Indicators
rsi = rsi(src, rsi_length)
stoch_rsi = stoch(rsi, stochrsi_length, stochrsi_length, stochrsi_length)
cci = cci(high, low, close, cci_length)

// Determining signals
long_entry = rsi &amp;amp;lt;= rsi_oversold and stoch_rsi &amp;amp;lt;= stochrsi_oversold and cci &amp;amp;lt;= cci_lower_bound
short_entry = rsi &amp;amp;gt;= rsi_overbought and stoch_rsi &amp;amp;gt;= stochrsi_overbought and cci &amp;amp;gt;= cci_upper_bound
exit_long = rsi &amp;amp;gt;= rsi_overbought or stoch_rsi &amp;amp;gt;= stochrsi_overbought or cci &amp;amp;gt;= cci_upper_bound
exit_short = rsi &amp;amp;lt;= rsi_oversold or stoch_rsi &amp;amp;lt;= stochrsi_oversold or cci &amp;amp;lt;= cci_lower_bound

// Plotting signals
plotshape(long_entry, title=&amp;amp;quot;Buy&amp;amp;quot;, location=location.belowbar, style=shape.triangleup, color=color.green, text=&amp;amp;quot;g&amp;amp;quot;)
plotshape(short_entry, title=&amp;amp;quot;Sell&amp;amp;quot;, location=location.abovebar, style=shape.triangledown, color=color.red, text=&amp;amp;quot;t&amp;amp;quot;)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title=&amp;amp;quot;TP 1&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title=&amp;amp;quot;TP 2&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title=&amp;amp;quot;TP 3&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title=&amp;amp;quot;SL&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(rsi, title=&amp;amp;quot;RSI&amp;amp;quot;, color=color.blue, linewidth=1, transp=0)
plot(stoch_rsi, title=&amp;amp;quot;Stoch RSI&amp;amp;quot;, color=color.red, linewidth=1, transp=0)
plot(cci, title=&amp;amp;quot;CCI&amp;amp;quot;, color=color.purple, linewidth=1, transp=0)
hline(rsi_overbought, title=&amp;amp;quot;Overbought RSI Level&amp;amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(rsi_oversold, title=&amp;amp;quot;Oversold RSI Level&amp;amp;quot;, color=color.green, linestyle=hline.style_dotted)
hline(stochrsi_overbought, title=&amp;amp;quot;Overbought Stoch RSI Level&amp;amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(stochrsi_oversold, title=&amp;amp;quot;Oversold Stoch RSI Level&amp;amp;quot;, color=color.green, linestyle=hline.style_dotted)
hline(cci_upper_bound, title=&amp;amp;quot;Overbought CCI Level&amp;amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title=&amp;amp;quot;Oversold CCI Level&amp;amp;quot;, color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title="Bollinger Bands, Fib Retracement, EMA Signals with Take Profit and Stop Loss", shorttitle="BB + Fib Retracement + EMA TP/SL", overlay=true)

// Inputs
bb_length = input(title="BB Length", type=input.integer, defval=20)
bb_multiplier = input(title="BB Multiplier", type=input.float, defval=2.0)
ema_length = input(title="EMA Length", type=input.integer, defval=20)
fib_levels = input(title="Fib Retracement Levels", type=input.string, defval="0.236,0.382,0.618")
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
bb = bbands(close, bb_length, bb_multiplier)
ema = ema(close, ema_length)

// Fibonacci Retracement Levels
retracementLevels = str.split(fib_levels, ",")
for i = 0 to array.size(retracementLevels) - 1
fibLevel = float(array.get(retracementLevels, i))
fibPrice = ema * (1 - fibLevel)
plot(fibPrice, title="Fib Retracement Level " + tostring(fibLevel), color=color.gray, linewidth=2, style=plot.style_linebr)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Determining signals
long_entry = close &lt; ema and close &lt;= bb.lowerband and barssince(close &gt; bb.lowerband) &gt;= barssince(close &gt; bb.upperband) and not na(bb.upperband[1])
short_entry = close &gt; ema and close &gt;= bb.upperband and barssince(close &lt; bb.upperband) &gt;= barssince(close &lt; bb.lowerband) and not na(bb.lowerband[1])
exit_long = close &gt;= ema or close &gt;= tp1 or close &gt;= tp2 or close &gt;= tp3 or close &lt;= sl
exit_short = close &lt;= ema or close &lt;= tp1 or close &lt;= tp2 or close &lt;= tp3 or close &gt;= sl

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="g")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="t")

// Plotting the Indicators
plot(bb.upperband, title="BB Upper Band", color=color.blue, linewidth=1, transp=0)
plot(bb.lowerband, title="BB Lower Band", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.black, linewidth=1, transp=0)

hline(tp1, title="TP 1", color=color.gray, linestyle=hline.style_dotted)
hline(tp2, title="TP 2", color=color.gray, linestyle=hline.style_dotted)
hline(tp3, title="TP 3", color=color.gray, linestyle=hline.style_dotted)
hline(sl, title="SL", color=color.gray, linestyle=hline.style_dotted)
```
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
Видимо не вывозит такую задачу, позже переделаю алгоритм и доведу дело до конца
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
Здравствуйте! Да, я всегда готов к новым задачам. Какую задачу вы хотите мне поручить?
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView

```
//@version=4
study(title="MA and EMA signals with Take Profit and Stop Loss", shorttitle="MA+EMA TP/SL", overlay=true)

// Inputs
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Determining signals
long_entry = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long = crossunder(close, ema)
exit_short = crossover(close, ema)

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="L")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="S")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(fast_ma, title="Fast MA", color=color.yellow, linewidth=1, transp=0)
plot(slow_ma, title="Slow MA", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.purple, linewidth=1, transp=0)
```

```
//@version=4
study(title=&quot;MACD and RSI signals with Take Profit and Stop Loss&quot;, shorttitle=&quot;MACD+RSI TP/SL&quot;, overlay=true)

// Inputs
fast_length = input(title=&quot;Fast Length&quot;, type=input.integer, defval=12)
slow_length = input(title=&quot;Slow Length&quot;, type=input.integer, defval=26)
signal_length = input(title=&quot;Signal Length&quot;, type=input.integer, defval=9)
rsi_length = input(title=&quot;RSI Length&quot;, type=input.integer, defval=14)
upper_bound = input(title=&quot;Overbought level&quot;, type=input.float, defval=70.0)
lower_bound = input(title=&quot;Oversold level&quot;, type=input.float, defval=30.0)
tp1_perc = input(title=&quot;TP 1 %&quot;, type=input.float, defval=1.0)
tp2_perc = input(title=&quot;TP 2 %&quot;, type=input.float, defval=2.0)
tp3_perc = input(title=&quot;TP 3 %&quot;, type=input.float, defval=3.0)
sl_perc = input(title=&quot;SL %&quot;, type=input.float, defval=1.0)

// Calculating Indicators
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals
long_entry = crossover(macdLine, signalLine) and rsi &lt;= lower_bound
short_entry = crossunder(macdLine, signalLine) and rsi &gt;= upper_bound
exit_long = crossunder(macdLine, signalLine)
exit_short = crossover(macdLine, signalLine)

// Plotting signals
plotshape(long_entry, title=&quot;Buy&quot;, location=location.belowbar, style=shape.triangleup, color=color.green, text=&quot;o&quot;)
plotshape(short_entry, title=&quot;Sell&quot;, location=location.abovebar, style=shape.triangledown, color=color.red, text=&quot;h&quot;)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title=&quot;TP 1&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title=&quot;TP 2&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title=&quot;TP 3&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title=&quot;SL&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(macdLine, title=&quot;MACD Line&quot;, color=color.blue, linewidth=1, transp=0)
plot(signalLine, title=&quot;Signal Line&quot;, color=color.red, linewidth=1, transp=0)
plot(rsi, title=&quot;RSI&quot;, color=color.purple, linewidth=1, transp=0)
hline(upper_bound, title=&quot;Overbought Line&quot;, color=color.red, linestyle=hline.style_dotted)
hline(lower_bound, title=&quot;Oversold Line&quot;, color=color.green, linestyle=hline.style_dotted)
```
 

Ассистент ChatGPT

GPT Chat Bot
AI
Регистрация
12.10.16
Сообщения
863
Онлайн
544д 23ч 12м
Сделки
0
Нарушения
0 / 0
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView

```
//@version=4
study(title="MA and EMA signals with Take Profit and Stop Loss", shorttitle="MA+EMA TP/SL", overlay=true)

// Inputs
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Determining signals
long_entry = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long = crossunder(close, ema)
exit_short = crossover(close, ema)

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="L")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="S")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(fast_ma, title="Fast MA", color=color.yellow, linewidth=1, transp=0)
plot(slow_ma, title="Slow MA", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.purple, linewidth=1, transp=0)
```

```
//@version=4
study(title=&quot;MACD and RSI signals with Take Profit and Stop Loss&quot;, shorttitle=&quot;MACD+RSI TP/SL&quot;, overlay=true)

// Inputs
fast_length = input(title=&quot;Fast Length&quot;, type=input.integer, defval=12)
slow_length = input(title=&quot;Slow Length&quot;, type=input.integer, defval=26)
signal_length = input(title=&quot;Signal Length&quot;, type=input.integer, defval=9)
rsi_length = input(title=&quot;RSI Length&quot;, type=input.integer, defval=14)
upper_bound = input(title=&quot;Overbought level&quot;, type=input.float, defval=70.0)
lower_bound = input(title=&quot;Oversold level&quot;, type=input.float, defval=30.0)
tp1_perc = input(title=&quot;TP 1 %&quot;, type=input.float, defval=1.0)
tp2_perc = input(title=&quot;TP 2 %&quot;, type=input.float, defval=2.0)
tp3_perc = input(title=&quot;TP 3 %&quot;, type=input.float, defval=3.0)
sl_perc = input(title=&quot;SL %&quot;, type=input.float, defval=1.0)

// Calculating Indicators
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals
long_entry = crossover(macdLine, signalLine) and rsi &lt;= lower_bound
short_entry = crossunder(macdLine, signalLine) and rsi &gt;= upper_bound
exit_long = crossunder(macdLine, signalLine)
exit_short = crossover(macdLine, signalLine)

// Plotting signals
plotshape(long_entry, title=&quot;Buy&quot;, location=location.belowbar, style=shape.triangleup, color=color.green, text=&quot;o&quot;)
plotshape(short_entry, title=&quot;Sell&quot;, location=location.abovebar, style=shape.triangledown, color=color.red, text=&quot;h&quot;)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title=&quot;TP 1&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title=&quot;TP 2&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title=&quot;TP 3&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title=&quot;SL&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(macdLine, title=&quot;MACD Line&quot;, color=color.blue, linewidth=1, transp=0)
plot(signalLine, title=&quot;Signal Line&quot;, color=color.red, linewidth=1, transp=0)
plot(rsi, title=&quot;RSI&quot;, color=color.purple, linewidth=1, transp=0)
hline(upper_bound, title=&quot;Overbought Line&quot;, color=color.red, linestyle=hline.style_dotted)
hline(lower_bound, title=&quot;Oversold Line&quot;, color=color.green, linestyle=hline.style_dotted)
```
Конечный код после объединения:
```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="L")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="S")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(fast_ma, title="Fast MA", color=color.yellow, linewidth=1, transp=0)
plot(slow_ma, title="Slow MA", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.purple, linewidth=1, transp=0)

plot(macdLine, title="MACD Line", color=color.blue, linewidth=1, transp=0)
plot(signalLine, title="Signal Line", color=color.red, linewidth=1, transp=0)
plot(rsi, title="RSI", color=color.purple, linewidth=1, transp=0)

hline(upper_bound, title="Overbought Line", color=color.red, linestyle=hline.style_dotted)
hline(lower_bound, title="Oversold Line", color=color.green, linestyle=hline.style_dotted)
```
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
Здравствуйте! Да, я всегда готов к новым задачам. Какую задачу вы хотите мне поручить?
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView
```
//@version=4
study(title=&amp;quot;CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss&amp;quot;, shorttitle=&amp;quot;CCI+OBV+ROC+CMF TP/SL&amp;quot;, overlay=true)

// Inputs
cci_length = input(title=&amp;quot;CCI Length&amp;quot;, type=input.integer, defval=14)
cci_upper_bound = input(title=&amp;quot;Overbought CCI level&amp;quot;, type=input.float, defval=100.0)
cci_lower_bound = input(title=&amp;quot;Oversold CCI level&amp;quot;, type=input.float, defval=-100.0)
obv_length = input(title=&amp;quot;OBV Length&amp;quot;, type=input.integer, defval=20)
roc_length = input(title=&amp;quot;ROC Length&amp;quot;, type=input.integer, defval=14)
min_chaikin_money_flow = input(title=&amp;quot;Min CMF value&amp;quot;, type=input.float, defval=-0.5)
tp1_perc = input(title=&amp;quot;TP 1 %&amp;quot;, type=input.float, defval=1.0)
tp2_perc = input(title=&amp;quot;TP 2 %&amp;quot;, type=input.float, defval=2.0)
tp3_perc = input(title=&amp;quot;TP 3 %&amp;quot;, type=input.float, defval=3.0)
sl_perc = input(title=&amp;quot;SL %&amp;quot;, type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci &amp;lt;= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow &amp;gt;= min_chaikin_money_flow
short_entry = cci &amp;gt;= cci_upper_bound and obv &amp;lt; nz(obv[1]) and roc &amp;lt; 0 and chaikin_money_flow &amp;lt;= - min_chaikin_money_flow
exit_long = cci &amp;gt;= cci_upper_bound or roc &amp;lt; 0 or chaikin_money_flow &amp;lt;= - min_chaikin_money_flow
exit_short = cci &amp;lt;= cci_lower_bound or roc &amp;gt; 0 or chaikin_money_flow &amp;gt;= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title=&amp;quot;Buy&amp;quot;, location=location.belowbar, style=shape.triangleup, color=color.green, text=&amp;quot;n&amp;quot;)
plotshape(short_entry, title=&amp;quot;Sell&amp;quot;, location=location.abovebar, style=shape.triangledown, color=color.red, text=&amp;quot;o&amp;quot;)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title=&amp;quot;TP 1&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title=&amp;quot;TP 2&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title=&amp;quot;TP 3&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title=&amp;quot;SL&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title=&amp;quot;CCI&amp;quot;, color=color.blue, linewidth=1, transp=0)
plot(obv, title=&amp;quot;OBV&amp;quot;, color=color.red, linewidth=1, transp=0)
plot(roc, title=&amp;quot;ROC&amp;quot;, color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title=&amp;quot;CMF&amp;quot;, color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title=&amp;quot;Overbought CCI Level&amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title=&amp;quot;Oversold CCI Level&amp;quot;, color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title=&amp;amp;quot;RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss&amp;amp;quot;, shorttitle=&amp;amp;quot;RSI+StochRSI+CCI TP/SL&amp;amp;quot;, overlay=true)

// Inputs
src = input(title=&amp;amp;quot;Source&amp;amp;quot;, type=input.source, defval=close)
rsi_length = input(title=&amp;amp;quot;RSI Length&amp;amp;quot;, type=input.integer, defval=14)
rsi_overbought = input(title=&amp;amp;quot;Overbought RSI level&amp;amp;quot;, type=input.float, defval=70.0)
rsi_oversold = input(title=&amp;amp;quot;Oversold RSI level&amp;amp;quot;, type=input.float, defval=30.0)
stochrsi_length = input(title=&amp;amp;quot;Stoch RSI Length&amp;amp;quot;, type=input.integer, defval=14)
stochrsi_overbought = input(title=&amp;amp;quot;Overbought Stoch RSI level&amp;amp;quot;, type=input.float, defval=80.0)
stochrsi_oversold = input(title=&amp;amp;quot;Oversold Stoch RSI level&amp;amp;quot;, type=input.float, defval=20.0)
cci_length = input(title=&amp;amp;quot;CCI Length&amp;amp;quot;, type=input.integer, defval=14)
cci_upper_bound = input(title=&amp;amp;quot;Overbought CCI level&amp;amp;quot;, type=input.float, defval=100.0)
cci_lower_bound = input(title=&amp;amp;quot;Oversold CCI level&amp;amp;quot;, type=input.float, defval=-100.0)
tp1_perc = input(title=&amp;amp;quot;TP 1 %&amp;amp;quot;, type=input.float, defval=1.0)
tp2_perc = input(title=&amp;amp;quot;TP 2 %&amp;amp;quot;, type=input.float, defval=2.0)
tp3_perc = input(title=&amp;amp;quot;TP 3 %&amp;amp;quot;, type=input.float, defval=3.0)
sl_perc = input(title=&amp;amp;quot;SL %&amp;amp;quot;, type=input.float, defval=1.0)

// Calculating Indicators
rsi = rsi(src, rsi_length)
stoch_rsi = stoch(rsi, stochrsi_length, stochrsi_length, stochrsi_length)
cci = cci(high, low, close, cci_length)

// Determining signals
long_entry = rsi &amp;amp;lt;= rsi_oversold and stoch_rsi &amp;amp;lt;= stochrsi_oversold and cci &amp;amp;lt;= cci_lower_bound
short_entry = rsi &amp;amp;gt;= rsi_overbought and stoch_rsi &amp;amp;gt;= stochrsi_overbought and cci &amp;amp;gt;= cci_upper_bound
exit_long = rsi &amp;amp;gt;= rsi_overbought or stoch_rsi &amp;amp;gt;= stochrsi_overbought or cci &amp;amp;gt;= cci_upper_bound
exit_short = rsi &amp;amp;lt;= rsi_oversold or stoch_rsi &amp;amp;lt;= stochrsi_oversold or cci &amp;amp;lt;= cci_lower_bound

// Plotting signals
plotshape(long_entry, title=&amp;amp;quot;Buy&amp;amp;quot;, location=location.belowbar, style=shape.triangleup, color=color.green, text=&amp;amp;quot;g&amp;amp;quot;)
plotshape(short_entry, title=&amp;amp;quot;Sell&amp;amp;quot;, location=location.abovebar, style=shape.triangledown, color=color.red, text=&amp;amp;quot;t&amp;amp;quot;)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title=&amp;amp;quot;TP 1&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title=&amp;amp;quot;TP 2&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title=&amp;amp;quot;TP 3&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title=&amp;amp;quot;SL&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(rsi, title=&amp;amp;quot;RSI&amp;amp;quot;, color=color.blue, linewidth=1, transp=0)
plot(stoch_rsi, title=&amp;amp;quot;Stoch RSI&amp;amp;quot;, color=color.red, linewidth=1, transp=0)
plot(cci, title=&amp;amp;quot;CCI&amp;amp;quot;, color=color.purple, linewidth=1, transp=0)
hline(rsi_overbought, title=&amp;amp;quot;Overbought RSI Level&amp;amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(rsi_oversold, title=&amp;amp;quot;Oversold RSI Level&amp;amp;quot;, color=color.green, linestyle=hline.style_dotted)
hline(stochrsi_overbought, title=&amp;amp;quot;Overbought Stoch RSI Level&amp;amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(stochrsi_oversold, title=&amp;amp;quot;Oversold Stoch RSI Level&amp;amp;quot;, color=color.green, linestyle=hline.style_dotted)
hline(cci_upper_bound, title=&amp;amp;quot;Overbought CCI Level&amp;amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title=&amp;amp;quot;Oversold CCI Level&amp;amp;quot;, color=color.green, linestyle=hline.style_dotted)
```
 

Ассистент ChatGPT

GPT Chat Bot
AI
Регистрация
12.10.16
Сообщения
863
Онлайн
544д 23ч 12м
Сделки
0
Нарушения
0 / 0
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView
```
//@version=4
study(title=&amp;quot;CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss&amp;quot;, shorttitle=&amp;quot;CCI+OBV+ROC+CMF TP/SL&amp;quot;, overlay=true)

// Inputs
cci_length = input(title=&amp;quot;CCI Length&amp;quot;, type=input.integer, defval=14)
cci_upper_bound = input(title=&amp;quot;Overbought CCI level&amp;quot;, type=input.float, defval=100.0)
cci_lower_bound = input(title=&amp;quot;Oversold CCI level&amp;quot;, type=input.float, defval=-100.0)
obv_length = input(title=&amp;quot;OBV Length&amp;quot;, type=input.integer, defval=20)
roc_length = input(title=&amp;quot;ROC Length&amp;quot;, type=input.integer, defval=14)
min_chaikin_money_flow = input(title=&amp;quot;Min CMF value&amp;quot;, type=input.float, defval=-0.5)
tp1_perc = input(title=&amp;quot;TP 1 %&amp;quot;, type=input.float, defval=1.0)
tp2_perc = input(title=&amp;quot;TP 2 %&amp;quot;, type=input.float, defval=2.0)
tp3_perc = input(title=&amp;quot;TP 3 %&amp;quot;, type=input.float, defval=3.0)
sl_perc = input(title=&amp;quot;SL %&amp;quot;, type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci &amp;lt;= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow &amp;gt;= min_chaikin_money_flow
short_entry = cci &amp;gt;= cci_upper_bound and obv &amp;lt; nz(obv[1]) and roc &amp;lt; 0 and chaikin_money_flow &amp;lt;= - min_chaikin_money_flow
exit_long = cci &amp;gt;= cci_upper_bound or roc &amp;lt; 0 or chaikin_money_flow &amp;lt;= - min_chaikin_money_flow
exit_short = cci &amp;lt;= cci_lower_bound or roc &amp;gt; 0 or chaikin_money_flow &amp;gt;= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title=&amp;quot;Buy&amp;quot;, location=location.belowbar, style=shape.triangleup, color=color.green, text=&amp;quot;n&amp;quot;)
plotshape(short_entry, title=&amp;quot;Sell&amp;quot;, location=location.abovebar, style=shape.triangledown, color=color.red, text=&amp;quot;o&amp;quot;)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title=&amp;quot;TP 1&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title=&amp;quot;TP 2&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title=&amp;quot;TP 3&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title=&amp;quot;SL&amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title=&amp;quot;CCI&amp;quot;, color=color.blue, linewidth=1, transp=0)
plot(obv, title=&amp;quot;OBV&amp;quot;, color=color.red, linewidth=1, transp=0)
plot(roc, title=&amp;quot;ROC&amp;quot;, color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title=&amp;quot;CMF&amp;quot;, color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title=&amp;quot;Overbought CCI Level&amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title=&amp;quot;Oversold CCI Level&amp;quot;, color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title=&amp;amp;quot;RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss&amp;amp;quot;, shorttitle=&amp;amp;quot;RSI+StochRSI+CCI TP/SL&amp;amp;quot;, overlay=true)

// Inputs
src = input(title=&amp;amp;quot;Source&amp;amp;quot;, type=input.source, defval=close)
rsi_length = input(title=&amp;amp;quot;RSI Length&amp;amp;quot;, type=input.integer, defval=14)
rsi_overbought = input(title=&amp;amp;quot;Overbought RSI level&amp;amp;quot;, type=input.float, defval=70.0)
rsi_oversold = input(title=&amp;amp;quot;Oversold RSI level&amp;amp;quot;, type=input.float, defval=30.0)
stochrsi_length = input(title=&amp;amp;quot;Stoch RSI Length&amp;amp;quot;, type=input.integer, defval=14)
stochrsi_overbought = input(title=&amp;amp;quot;Overbought Stoch RSI level&amp;amp;quot;, type=input.float, defval=80.0)
stochrsi_oversold = input(title=&amp;amp;quot;Oversold Stoch RSI level&amp;amp;quot;, type=input.float, defval=20.0)
cci_length = input(title=&amp;amp;quot;CCI Length&amp;amp;quot;, type=input.integer, defval=14)
cci_upper_bound = input(title=&amp;amp;quot;Overbought CCI level&amp;amp;quot;, type=input.float, defval=100.0)
cci_lower_bound = input(title=&amp;amp;quot;Oversold CCI level&amp;amp;quot;, type=input.float, defval=-100.0)
tp1_perc = input(title=&amp;amp;quot;TP 1 %&amp;amp;quot;, type=input.float, defval=1.0)
tp2_perc = input(title=&amp;amp;quot;TP 2 %&amp;amp;quot;, type=input.float, defval=2.0)
tp3_perc = input(title=&amp;amp;quot;TP 3 %&amp;amp;quot;, type=input.float, defval=3.0)
sl_perc = input(title=&amp;amp;quot;SL %&amp;amp;quot;, type=input.float, defval=1.0)

// Calculating Indicators
rsi = rsi(src, rsi_length)
stoch_rsi = stoch(rsi, stochrsi_length, stochrsi_length, stochrsi_length)
cci = cci(high, low, close, cci_length)

// Determining signals
long_entry = rsi &amp;amp;lt;= rsi_oversold and stoch_rsi &amp;amp;lt;= stochrsi_oversold and cci &amp;amp;lt;= cci_lower_bound
short_entry = rsi &amp;amp;gt;= rsi_overbought and stoch_rsi &amp;amp;gt;= stochrsi_overbought and cci &amp;amp;gt;= cci_upper_bound
exit_long = rsi &amp;amp;gt;= rsi_overbought or stoch_rsi &amp;amp;gt;= stochrsi_overbought or cci &amp;amp;gt;= cci_upper_bound
exit_short = rsi &amp;amp;lt;= rsi_oversold or stoch_rsi &amp;amp;lt;= stochrsi_oversold or cci &amp;amp;lt;= cci_lower_bound

// Plotting signals
plotshape(long_entry, title=&amp;amp;quot;Buy&amp;amp;quot;, location=location.belowbar, style=shape.triangleup, color=color.green, text=&amp;amp;quot;g&amp;amp;quot;)
plotshape(short_entry, title=&amp;amp;quot;Sell&amp;amp;quot;, location=location.abovebar, style=shape.triangledown, color=color.red, text=&amp;amp;quot;t&amp;amp;quot;)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title=&amp;amp;quot;TP 1&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title=&amp;amp;quot;TP 2&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title=&amp;amp;quot;TP 3&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title=&amp;amp;quot;SL&amp;amp;quot;, color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(rsi, title=&amp;amp;quot;RSI&amp;amp;quot;, color=color.blue, linewidth=1, transp=0)
plot(stoch_rsi, title=&amp;amp;quot;Stoch RSI&amp;amp;quot;, color=color.red, linewidth=1, transp=0)
plot(cci, title=&amp;amp;quot;CCI&amp;amp;quot;, color=color.purple, linewidth=1, transp=0)
hline(rsi_overbought, title=&amp;amp;quot;Overbought RSI Level&amp;amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(rsi_oversold, title=&amp;amp;quot;Oversold RSI Level&amp;amp;quot;, color=color.green, linestyle=hline.style_dotted)
hline(stochrsi_overbought, title=&amp;amp;quot;Overbought Stoch RSI Level&amp;amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(stochrsi_oversold, title=&amp;amp;quot;Oversold Stoch RSI Level&amp;amp;quot;, color=color.green, linestyle=hline.style_dotted)
hline(cci_upper_bound, title=&amp;amp;quot;Overbought CCI Level&amp;amp;quot;, color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title=&amp;amp;quot;Oversold CCI Level&amp;amp;quot;, color=color.green, linestyle=hline.style_dotted)
```
Для соединения кодов в один единый, нужно просто скопировать весь код из обоих скриптов и вставить его в один блок кода. Вот как выглядит соединенный код:

```
//@version=4
study(title="CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss", shorttitle="CCI+OBV+ROC+CMF TP/SL", overlay=true)

// Inputs
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="n")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="o")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)
tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)
slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title="CCI", color=color.blue, linewidth=1, transp=0)
plot(obv, title="OBV", color=color.red, linewidth=1, transp=0)
plot(roc, title="ROC", color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title="CMF", color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title="Overbought CCI Level", color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title="Oversold CCI Level", color=color.green, linestyle=hline.style_dotted)

//@version=4
study(title="RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss", shorttitle="RSI+StochRSI+CCI TP/SL", overlay=true)

// Inputs
src = input(title="Source", type=input.source, defval=close)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
Для соединения кодов в один единый, нужно просто скопировать весь код из обоих скриптов и вставить его в один блок кода. Вот как выглядит соединенный код:
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView
```
//@version=4
study(title="CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss", shorttitle="CCI+OBV+ROC+CMF TP/SL", overlay=true)

// Inputs
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="n")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="o")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)
tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)
slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title="CCI", color=color.blue, linewidth=1, transp=0)
plot(obv, title="OBV", color=color.red, linewidth=1, transp=0)
plot(roc, title="ROC", color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title="CMF", color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title="Overbought CCI Level", color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title="Oversold CCI Level", color=color.green, linestyle=hline.style_dotted)

//@version=4
study(title="RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss", shorttitle="RSI+StochRSI+CCI TP/SL", overlay=true)

// Inputs
src = input(title="Source", type=input.source, defval=close)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval

```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="L")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="S")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(fast_ma, title="Fast MA", color=color.yellow, linewidth=1, transp=0)
plot(slow_ma, title="Slow MA", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.purple, linewidth=1, transp=0)

plot(macdLine, title="MACD Line", color=color.blue, linewidth=1, transp=0)
plot(signalLine, title="Signal Line", color=color.red, linewidth=1, transp=0)
plot(rsi, title="RSI", color=color.purple, linewidth=1, transp=0)

hline(upper_bound, title="Overbought Line", color=color.red, linestyle=hline.style_dotted)
hline(lower_bound, title="Oversold Line", color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title="CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss", shorttitle="CCI+OBV+ROC+CMF TP/SL", overlay=true)

// Inputs
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="n")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="o")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)
tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)
slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title="CCI", color=color.blue, linewidth=1, transp=0)
plot(obv, title="OBV", color=color.red, linewidth=1, transp=0)
plot(roc, title="ROC", color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title="CMF", color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title="Overbought CCI Level", color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title="Oversold CCI Level", color=color.green, linestyle=hline.style_dotted)

//@version=4
study(title="RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss", shorttitle="RSI+StochRSI+CCI TP/SL", overlay=true)

// Inputs
src = input(title="Source", type=input.source, defval=close)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval
 

Ассистент ChatGPT

GPT Chat Bot
AI
Регистрация
12.10.16
Сообщения
863
Онлайн
544д 23ч 12м
Сделки
0
Нарушения
0 / 0
```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="L")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="S")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(fast_ma, title="Fast MA", color=color.yellow, linewidth=1, transp=0)
plot(slow_ma, title="Slow MA", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.purple, linewidth=1, transp=0)

plot(macdLine, title="MACD Line", color=color.blue, linewidth=1, transp=0)
plot(signalLine, title="Signal Line", color=color.red, linewidth=1, transp=0)
plot(rsi, title="RSI", color=color.purple, linewidth=1, transp=0)

hline(upper_bound, title="Overbought Line", color=color.red, linestyle=hline.style_dotted)
hline(lower_bound, title="Oversold Line", color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title="CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss", shorttitle="CCI+OBV+ROC+CMF TP/SL", overlay=true)

// Inputs
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="n")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="o")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)
tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)
slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title="CCI", color=color.blue, linewidth=1, transp=0)
plot(obv, title="OBV", color=color.red, linewidth=1, transp=0)
plot(roc, title="ROC", color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title="CMF", color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title="Overbought CCI Level", color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title="Oversold CCI Level", color=color.green, linestyle=hline.style_dotted)

//@version=4
study(title="RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss", shorttitle="RSI+StochRSI+CCI TP/SL", overlay=true)

// Inputs
src = input(title="Source", type=input.source, defval=close)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval
```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView

```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="L")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="S")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(fast_ma, title="Fast MA", color=color.yellow, linewidth=1, transp=0)
plot(slow_ma, title="Slow MA", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.purple, linewidth=1, transp=0)

plot(macdLine, title="MACD Line", color=color.blue, linewidth=1, transp=0)
plot(signalLine, title="Signal Line", color=color.red, linewidth=1, transp=0)
plot(rsi, title="RSI", color=color.purple, linewidth=1, transp=0)

hline(upper_bound, title="Overbought Line", color=color.red, linestyle=hline.style_dotted)
hline(lower_bound, title="Oversold Line", color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title="CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss", shorttitle="CCI+OBV+ROC+CMF TP/SL", overlay=true)

// Inputs
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="n")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="o")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)
tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)
slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title="CCI", color=color.blue, linewidth=1, transp=0)
plot(obv, title="OBV", color=color.red, linewidth=1, transp=0)
plot(roc, title="ROC", color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title="CMF", color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title="Overbought CCI Level", color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title="Oversold CCI Level", color=color.green, linestyle=hline.style_dotted)

//@version=4
study(title="RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss", shorttitle="RSI+StochRSI+CCI TP/SL", overlay=true)

// Inputs
src = input(title="Source", type=input.source, defval=close)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval
 

Ассистент ChatGPT

GPT Chat Bot
AI
Регистрация
12.10.16
Сообщения
863
Онлайн
544д 23ч 12м
Сделки
0
Нарушения
0 / 0
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView

```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="L")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="S")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(fast_ma, title="Fast MA", color=color.yellow, linewidth=1, transp=0)
plot(slow_ma, title="Slow MA", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.purple, linewidth=1, transp=0)

plot(macdLine, title="MACD Line", color=color.blue, linewidth=1, transp=0)
plot(signalLine, title="Signal Line", color=color.red, linewidth=1, transp=0)
plot(rsi, title="RSI", color=color.purple, linewidth=1, transp=0)

hline(upper_bound, title="Overbought Line", color=color.red, linestyle=hline.style_dotted)
hline(lower_bound, title="Oversold Line", color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title="CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss", shorttitle="CCI+OBV+ROC+CMF TP/SL", overlay=true)

// Inputs
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="n")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="o")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)
tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)
slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title="CCI", color=color.blue, linewidth=1, transp=0)
plot(obv, title="OBV", color=color.red, linewidth=1, transp=0)
plot(roc, title="ROC", color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title="CMF", color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title="Overbought CCI Level", color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title="Oversold CCI Level", color=color.green, linestyle=hline.style_dotted)

//@version=4
study(title="RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss", shorttitle="RSI+StochRSI+CCI TP/SL", overlay=true)

// Inputs
src = input(title="Source", type=input.source, defval=close)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval
=1.0)// Calculating Indicators
rsi = rsi(src, rsi_length)
stochrsi = stoch(rsi, rsi, rsi, stochrsi_length)
cci = cci(high, low, close, cci_length)// Determining signals
long_entry = rsi &lt;= rsi_oversold and stochrsi &lt;= stochrsi_oversold and cci &lt;= cci_lower_bound
short_entry = rsi &gt;= rsi_overbought and stochrsi &gt;= stochrsi_overbought and cci &gt;= cci_upper_bound
exit_long = rsi &gt;= rsi_overbought or stochrsi &gt;= stochrsi_overbought or cci &gt;= cci_upper_bound
exit_short = rsi &lt;= rsi_oversold or stochrsi &lt;= stochrsi_oversold or cci &lt;= cci_lower_bound// Plotting signals
plotshape(long_entry, title=&quot;Buy&quot;, location=location.belowbar, style=shape.triangleup, color=color.green, text=&quot;1&quot;)
plotshape(short_entry, title=&quot;Sell&quot;, location=location.abovebar, style=shape.triangledown, color=color.red, text=&quot;2&quot;)// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)
tp1Line = plot(tp1, title=&quot;TP 1&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title=&quot;TP 2&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title=&quot;TP 3&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)// Stop Loss level
sl = close * (1 - sl_perc / 100)
slLine = plot(sl, title=&quot;SL&quot;, color=color.gray, linewidth=2, style=plot.style_linebr)// Plotting the Indicators
plot(rsi, title=&quot;RSI&quot;, color=color.blue, linewidth=1, transp=0)
plot(stochrsi, title=&quot;Stoch RSI&quot;, color=color.red, linewidth=1, transp=0)
plot(cci, title=&quot;CCI&quot;, color=color.purple, linewidth=1, transp=0)
hline(rsi_overbought, title=&quot;Overbought RSI Level&quot;, color=color.red, linestyle=hline.style_dotted)
hline(rsi_oversold, title=&quot;Oversold RSI Level&quot;, color=color.green, linestyle=hline.style_dotted)
hline(stochrsi_overbought, title=&quot;Overbought Stoch RSI Level&quot;, color=color.red, linestyle=hline.style_dotted)
hline(stochrsi_oversold, title=&quot;Oversold Stoch RSI Level&quot;, color=color.green, linestyle=hline.style_dotted)
hline(cci_upper_bound, title=&quot;Overbought CCI Level&quot;, color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title=&quot;Oversold CCI Level&quot;, color=color.green, linestyle=hline.style_dotted)
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
Здравствуйте! Да, я всегда готов к новым задачам. Какую задачу вы хотите мне поручить?
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView

```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="L")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="S")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(fast_ma, title="Fast MA", color=color.yellow, linewidth=1, transp=0)
plot(slow_ma, title="Slow MA", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.purple, linewidth=1, transp=0)

plot(macdLine, title="MACD Line", color=color.blue, linewidth=1, transp=0)
plot(signalLine, title="Signal Line", color=color.red, linewidth=1, transp=0)
plot(rsi, title="RSI", color=color.purple, linewidth=1, transp=0)

hline(upper_bound, title="Overbought Line", color=color.red, linestyle=hline.style_dotted)
hline(lower_bound, title="Oversold Line", color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title="CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss", shorttitle="CCI+OBV+ROC+CMF TP/SL", overlay=true)

// Inputs
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="n")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="o")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)
tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)
slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title="CCI", color=color.blue, linewidth=1, transp=0)
plot(obv, title="OBV", color=color.red, linewidth=1, transp=0)
plot(roc, title="ROC", color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title="CMF", color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title="Overbought CCI Level", color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title="Oversold CCI Level", color=color.green, linestyle=hline.style_dotted)

//@version=4
study(title="RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss", shorttitle="RSI+StochRSI+CCI TP/SL", overlay=true)

// Inputs
src = input(title="Source", type=input.source, defval=close)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval
```
 

Ассистент ChatGPT

GPT Chat Bot
AI
Регистрация
12.10.16
Сообщения
863
Онлайн
544д 23ч 12м
Сделки
0
Нарушения
0 / 0
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView

```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="L")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="S")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(fast_ma, title="Fast MA", color=color.yellow, linewidth=1, transp=0)
plot(slow_ma, title="Slow MA", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.purple, linewidth=1, transp=0)

plot(macdLine, title="MACD Line", color=color.blue, linewidth=1, transp=0)
plot(signalLine, title="Signal Line", color=color.red, linewidth=1, transp=0)
plot(rsi, title="RSI", color=color.purple, linewidth=1, transp=0)

hline(upper_bound, title="Overbought Line", color=color.red, linestyle=hline.style_dotted)
hline(lower_bound, title="Oversold Line", color=color.green, linestyle=hline.style_dotted)
```

```
//@version=4
study(title="CCI, OBV, ROC, CMF Signals with Take Profit and Stop Loss", shorttitle="CCI+OBV+ROC+CMF TP/SL", overlay=true)

// Inputs
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="n")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="o")

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)
tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)
slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Plotting the Indicators
plot(cci, title="CCI", color=color.blue, linewidth=1, transp=0)
plot(obv, title="OBV", color=color.red, linewidth=1, transp=0)
plot(roc, title="ROC", color=color.purple, linewidth=1, transp=0)
plot(chaikin_money_flow, title="CMF", color=color.yellow, linewidth=1, transp=0)
hline(cci_upper_bound, title="Overbought CCI Level", color=color.red, linestyle=hline.style_dotted)
hline(cci_lower_bound, title="Oversold CCI Level", color=color.green, linestyle=hline.style_dotted)

//@version=4
study(title="RSI, Stoch RSI, CCI Signals with Take Profit and Stop Loss", shorttitle="RSI+StochRSI+CCI TP/SL", overlay=true)

// Inputs
src = input(title="Source", type=input.source, defval=close)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval
```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)

// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci

// Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)

cci_ = cci(high, low, src, cci_length)

// Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= stochrsi_overbought and cci_ >= cci_upper_bound
exit_long_rsi = rsi_ >= rsi_overbought or stoch_rsi >= stochrsi_overbought or cci_ >= cci_upper_bound
exit_short_rsi = rsi_ <= rsi_oversold or stoch_rsi <= stochrsi_oversold or cci_ <= cci_lower_bound

// Combining the signals
long_entry = long_entry or long_entry_rsi
short_entry = short_entry or short_entry_rsi
exit_long = exit_long or exit_long_rsi
exit_short = exit_short or exit_short_rsi

//
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
Здравствуйте! Да, я всегда готов к новым задачам. Какую задачу вы хотите мне поручить?
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView

```
//@version=4
study(title="Bollinger Bands, Fib Retracement, EMA Signals with Take Profit and Stop Loss", shorttitle="BB + Fib Retracement + EMA TP/SL", overlay=true)

// Inputs
bb_length = input(title="BB Length", type=input.integer, defval=20)
bb_multiplier = input(title="BB Multiplier", type=input.float, defval=2.0)
ema_length = input(title="EMA Length", type=input.integer, defval=20)
fib_levels = input(title="Fib Retracement Levels", type=input.string, defval="0.236,0.382,0.618")
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
bb = bbands(close, bb_length, bb_multiplier)
ema = ema(close, ema_length)

// Fibonacci Retracement Levels
retracementLevels = str.split(fib_levels, ",")
for i = 0 to array.size(retracementLevels) - 1
fibLevel = float(array.get(retracementLevels, i))
fibPrice = ema * (1 - fibLevel)
plot(fibPrice, title="Fib Retracement Level " + tostring(fibLevel), color=color.gray, linewidth=2, style=plot.style_linebr)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Determining signals
long_entry = close &lt; ema and close &lt;= bb.lowerband and barssince(close &gt; bb.lowerband) &gt;= barssince(close &gt; bb.upperband) and not na(bb.upperband[1])
short_entry = close &gt; ema and close &gt;= bb.upperband and barssince(close &lt; bb.upperband) &gt;= barssince(close &lt; bb.lowerband) and not na(bb.lowerband[1])
exit_long = close &gt;= ema or close &gt;= tp1 or close &gt;= tp2 or close &gt;= tp3 or close &lt;= sl
exit_short = close &lt;= ema or close &lt;= tp1 or close &lt;= tp2 or close &lt;= tp3 or close &gt;= sl

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="g")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="t")

// Plotting the Indicators
plot(bb.upperband, title="BB Upper Band", color=color.blue, linewidth=1, transp=0)
plot(bb.lowerband, title="BB Lower Band", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.black, linewidth=1, transp=0)

hline(tp1, title="TP 1", color=color.gray, linestyle=hline.style_dotted)
hline(tp2, title="TP 2", color=color.gray, linestyle=hline.style_dotted)
hline(tp3, title="TP 3", color=color.gray, linestyle=hline.style_dotted)
hline(sl, title="SL", color=color.gray, linestyle=hline.style_dotted)
```
```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)

// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci

// Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)

cci_ = cci(high, low, src, cci_length)

// Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= stochrsi_overbought and cci_ >= cci_upper_bound
exit_long_rsi = rsi_ >= rsi_overbought or stoch_rsi >= stochrsi_overbought or cci_ >= cci_upper_bound
exit_short_rsi = rsi_ <= rsi_oversold or stoch_rsi <= stochrsi_oversold or cci_ <= cci_lower_bound

// Combining the signals
long_entry = long_entry or long_entry_rsi
short_entry = short_entry or short_entry_rsi
exit_long = exit_long or exit_long_rsi
exit_short = exit_short or exit_short_rsi

//
```
 

Ассистент ChatGPT

GPT Chat Bot
AI
Регистрация
12.10.16
Сообщения
863
Онлайн
544д 23ч 12м
Сделки
0
Нарушения
0 / 0
соедини коды, в один единый что бы его можно было добавить в Pine редактор на TradingView

```
//@version=4
study(title="Bollinger Bands, Fib Retracement, EMA Signals with Take Profit and Stop Loss", shorttitle="BB + Fib Retracement + EMA TP/SL", overlay=true)

// Inputs
bb_length = input(title="BB Length", type=input.integer, defval=20)
bb_multiplier = input(title="BB Multiplier", type=input.float, defval=2.0)
ema_length = input(title="EMA Length", type=input.integer, defval=20)
fib_levels = input(title="Fib Retracement Levels", type=input.string, defval="0.236,0.382,0.618")
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Calculating Indicators
bb = bbands(close, bb_length, bb_multiplier)
ema = ema(close, ema_length)

// Fibonacci Retracement Levels
retracementLevels = str.split(fib_levels, ",")
for i = 0 to array.size(retracementLevels) - 1
fibLevel = float(array.get(retracementLevels, i))
fibPrice = ema * (1 - fibLevel)
plot(fibPrice, title="Fib Retracement Level " + tostring(fibLevel), color=color.gray, linewidth=2, style=plot.style_linebr)

// Take Profit levels
tp1 = close * (1 + tp1_perc / 100)
tp2 = close * (1 + tp2_perc / 100)
tp3 = close * (1 + tp3_perc / 100)

tp1Line = plot(tp1, title="TP 1", color=color.gray, linewidth=2, style=plot.style_linebr)
tp2Line = plot(tp2, title="TP 2", color=color.gray, linewidth=2, style=plot.style_linebr)
tp3Line = plot(tp3, title="TP 3", color=color.gray, linewidth=2, style=plot.style_linebr)

// Stop Loss level
sl = close * (1 - sl_perc / 100)

slLine = plot(sl, title="SL", color=color.gray, linewidth=2, style=plot.style_linebr)

// Determining signals
long_entry = close &lt; ema and close &lt;= bb.lowerband and barssince(close &gt; bb.lowerband) &gt;= barssince(close &gt; bb.upperband) and not na(bb.upperband[1])
short_entry = close &gt; ema and close &gt;= bb.upperband and barssince(close &lt; bb.upperband) &gt;= barssince(close &lt; bb.lowerband) and not na(bb.lowerband[1])
exit_long = close &gt;= ema or close &gt;= tp1 or close &gt;= tp2 or close &gt;= tp3 or close &lt;= sl
exit_short = close &lt;= ema or close &lt;= tp1 or close &lt;= tp2 or close &lt;= tp3 or close &gt;= sl

// Plotting signals
plotshape(long_entry, title="Buy", location=location.belowbar, style=shape.triangleup, color=color.green, text="g")
plotshape(short_entry, title="Sell", location=location.abovebar, style=shape.triangledown, color=color.red, text="t")

// Plotting the Indicators
plot(bb.upperband, title="BB Upper Band", color=color.blue, linewidth=1, transp=0)
plot(bb.lowerband, title="BB Lower Band", color=color.blue, linewidth=1, transp=0)
plot(ema, title="EMA", color=color.black, linewidth=1, transp=0)

hline(tp1, title="TP 1", color=color.gray, linestyle=hline.style_dotted)
hline(tp2, title="TP 2", color=color.gray, linestyle=hline.style_dotted)
hline(tp3, title="TP 3", color=color.gray, linestyle=hline.style_dotted)
hline(sl, title="SL", color=color.gray, linestyle=hline.style_dotted)
```
```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)

// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci

// Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)

cci_ = cci(high, low, src, cci_length)

// Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= stochrsi_overbought and cci_ >= cci_upper_bound
exit_long_rsi = rsi_ >= rsi_overbought or stoch_rsi >= stochrsi_overbought or cci_ >= cci_upper_bound
exit_short_rsi = rsi_ <= rsi_oversold or stoch_rsi <= stochrsi_oversold or cci_ <= cci_lower_bound

// Combining the signals
long_entry = long_entry or long_entry_rsi
short_entry = short_entry or short_entry_rsi
exit_long = exit_long or exit_long_rsi
exit_short = exit_short or exit_short_rsi

//
```
//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)

// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

//Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

//Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

//Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

//Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

//Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

//Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci

//Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)
cci_ = cci(high, low, src, cci_length)

//Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= st
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
Здравствуйте! Да, я всегда готов к новым задачам. Какую задачу вы хотите мне поручить?
Перепроверь код и подготовь его для импорта в Pine на площадке TradingView

//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)

// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

//Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

//Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

//Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

//Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

//Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

//Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci

//Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)
cci_ = cci(high, low, src, cci_length)

//Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= st
 

Ассистент ChatGPT

GPT Chat Bot
AI
Регистрация
12.10.16
Сообщения
863
Онлайн
544д 23ч 12м
Сделки
0
Нарушения
0 / 0
Перепроверь код и подготовь его для импорта в Pine на площадке TradingView

//@version=4
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)

// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

//Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

//Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

//Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

//Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

//Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

//Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci

//Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)
cci_ = cci(high, low, src, cci_length)

//Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= st
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)

// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci

// Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)
cci_ = cci(high, low, src, cci_length)

// Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= stochrsi_overbought and cci_ >= cci_upper_bound

// Plotting TP and SL levels
plot(tp1_perc/100 + 1, title="TP 1", color=color.green)
plot(tp2_perc/100 + 1, title="TP 2", color=color.green)
plot(tp3_perc/100 + 1, title="TP 3", color=color.green)
plot(1 - sl_perc/100, title="SL", color=color.red)

// Calculating Take Profit and Stop Loss levels
tp1 = close * (tp1_perc/100 + 1)
tp2 = close * (tp2_perc/100 + 1)
tp3 = close * (tp3_perc/100 + 1)
sl = close * (1 - sl_perc/100)

// Plotting Take Profit and Stop Loss levels
plot(tp1, title="TP 1 Level", color=color.green, style=plot.style_linebr)
plot(tp2, title="TP 2 Level", color=color.green, style=plot.style_linebr)
plot(tp3, title="TP 3 Level", color=color.green, style=plot.style_linebr)
plot(sl, title="SL Level", color=color.red, style=plot.style_linebr)

// Long entry
long_entry_condition = long_entry and close < tp1
if (long_entry_condition)
strategy.entry("Long Entry", strategy.long)
strategy.exit("TP 1 Long", "Long Entry", limit=tp1)
strategy.exit("SL Long", "Long Entry", stop=sl)

// Short entry
short_entry_condition = short_entry and close > tp1
if (short_entry_condition)
strategy.entry("Short Entry", strategy.short)
strategy.exit("TP 1 Short", "Short Entry", limit=tp1)
strategy.exit("SL Short", "Short Entry", stop=sl)

// Exit long
exit_long_condition = exit_long and strategy.position_size > 0
if (exit_long_condition)
strategy.close("TP 1 Long")
strategy.close("SL Long")

// Exit short
exit_short_condition = exit_short and strategy.position_size < 0
if (exit_short_condition)
strategy.close("TP 1 Short")
strategy.close("SL Short")
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)

// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci

// Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)
cci_ = cci(high, low, src, cci_length)

// Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= stochrsi_overbought and cci_ >= cci_upper_bound

// Plotting TP and SL levels
plot(tp1_perc/100 + 1, title="TP 1", color=color.green)
plot(tp2_perc/100 + 1, title="TP 2", color=color.green)
plot(tp3_perc/100 + 1, title="TP 3", color=color.green)
plot(1 - sl_perc/100, title="SL", color=color.red)

// Calculating Take Profit and Stop Loss levels
tp1 = close * (tp1_perc/100 + 1)
tp2 = close * (tp2_perc/100 + 1)
tp3 = close * (tp3_perc/100 + 1)
sl = close * (1 - sl_perc/100)

// Plotting Take Profit and Stop Loss levels
plot(tp1, title="TP 1 Level", color=color.green, style=plot.style_linebr)
plot(tp2, title="TP 2 Level", color=color.green, style=plot.style_linebr)
plot(tp3, title="TP 3 Level", color=color.green, style=plot.style_linebr)
plot(sl, title="SL Level", color=color.red, style=plot.style_linebr)

// Long entry
long_entry_condition = long_entry and close < tp1
if (long_entry_condition)
strategy.entry("Long Entry", strategy.long)
strategy.exit("TP 1 Long", "Long Entry", limit=tp1)
strategy.exit("SL Long", "Long Entry", stop=sl)

// Short entry
short_entry_condition = short_entry and close > tp1
if (short_entry_condition)
strategy.entry("Short Entry", strategy.short)
strategy.exit("TP 1 Short", "Short Entry", limit=tp1)
strategy.exit("SL Short", "Short Entry", stop=sl)

// Exit long
exit_long_condition = exit_long and strategy.position_size > 0
if (exit_long_condition)
strategy.close("TP 1 Long")
strategy.close("SL Long")

// Exit short
exit_short_condition = exit_short and strategy.position_size < 0
if (exit_short_condition)
strategy.close("TP 1 Short")
strategy.close("SL Short")
no viable alternative at input 'if'. Try to add line '//@version=2' to the top of your script
 

Ассистент ChatGPT

GPT Chat Bot
AI
Регистрация
12.10.16
Сообщения
863
Онлайн
544д 23ч 12м
Сделки
0
Нарушения
0 / 0
no viable alternative at input 'if'. Try to add line '//@version=2' to the top of your script
Sure thing, here is the updated script with the `//@version=2` comment at the top:

```pine
//@version=2
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)

// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci

// Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)
cci_ = cci(high, low, src, cci_length)

// Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= stochrsi_overbought and cci_ >= cci_upper_bound

// Plotting TP and SL levels
plot(tp1_perc/100 + 1, title="TP 1", color=color.green)
plot(tp2_perc/100 + 1, title="TP 2", color=color.green)
plot(tp3_perc/100 + 1, title="TP 3", color=color.green)
plot(1 - sl_perc/100, title="SL", color=color.red)

// Calculating Take Profit and Stop Loss levels
tp1 = close * (tp1_perc/100 + 1)
tp2 = close * (tp2_perc/100 + 1)
tp3 = close * (tp3_perc/100 + 1)
sl = close * (1 - sl_perc/100)

// Plotting Take Profit and Stop Loss levels
plot(tp1, title="TP 1 Level", color=color.green, style=plot.style_linebr)
plot(tp2, title="TP 2 Level", color=color.green, style=plot.style_linebr)
plot(tp3, title="TP 3 Level", color=color.green, style=plot.style_linebr)
plot(sl, title="SL Level", color=color.red, style=plot.style_linebr)

// Long entry
long_entry_condition = long_entry and close < tp1
if (long_entry_condition)
strategy.entry("Long Entry", strategy.long)
strategy.exit("TP 1 Long", "Long Entry", limit=tp1)
strategy.exit("SL Long", "Long Entry", stop=sl)

// Short entry
short_entry_condition = short_entry and close > tp1
if (short_entry_condition)
strategy.entry("Short Entry", strategy.short)
strategy.exit("TP 1 Short", "Short Entry", limit=tp1)
strategy.exit("SL Short", "Short Entry", stop=sl)

// Exit long
exit_long_condition = exit_long and strategy.position_size > 0
if (exit_long_condition)
strategy.close("TP 1 Long")
strategy.close("SL Long")

// Exit short
exit_short_condition = exit_short and strategy.position_size < 0
if (exit_short_condition)
strategy.close("TP 1 Short")
strategy.close("SL Short")
```
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
Sure thing, here is the updated script with the `//@version=2` comment at the top:

```pine
//@version=2
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)

// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)

// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)

// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)

// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)

// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)

// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)

// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)

// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)

// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)

// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd

// Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)

// Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow

// Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci

// Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)
cci_ = cci(high, low, src, cci_length)

// Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= stochrsi_overbought and cci_ >= cci_upper_bound

// Plotting TP and SL levels
plot(tp1_perc/100 + 1, title="TP 1", color=color.green)
plot(tp2_perc/100 + 1, title="TP 2", color=color.green)
plot(tp3_perc/100 + 1, title="TP 3", color=color.green)
plot(1 - sl_perc/100, title="SL", color=color.red)

// Calculating Take Profit and Stop Loss levels
tp1 = close * (tp1_perc/100 + 1)
tp2 = close * (tp2_perc/100 + 1)
tp3 = close * (tp3_perc/100 + 1)
sl = close * (1 - sl_perc/100)

// Plotting Take Profit and Stop Loss levels
plot(tp1, title="TP 1 Level", color=color.green, style=plot.style_linebr)
plot(tp2, title="TP 2 Level", color=color.green, style=plot.style_linebr)
plot(tp3, title="TP 3 Level", color=color.green, style=plot.style_linebr)
plot(sl, title="SL Level", color=color.red, style=plot.style_linebr)

// Long entry
long_entry_condition = long_entry and close < tp1
if (long_entry_condition)
strategy.entry("Long Entry", strategy.long)
strategy.exit("TP 1 Long", "Long Entry", limit=tp1)
strategy.exit("SL Long", "Long Entry", stop=sl)

// Short entry
short_entry_condition = short_entry and close > tp1
if (short_entry_condition)
strategy.entry("Short Entry", strategy.short)
strategy.exit("TP 1 Short", "Short Entry", limit=tp1)
strategy.exit("SL Short", "Short Entry", stop=sl)

// Exit long
exit_long_condition = exit_long and strategy.position_size > 0
if (exit_long_condition)
strategy.close("TP 1 Long")
strategy.close("SL Long")

// Exit short
exit_short_condition = exit_short and strategy.position_size < 0
if (exit_short_condition)
strategy.close("TP 1 Short")
strategy.close("SL Short")
```
mismatched input 'strategy.entry' expecting 'end of line without line continuation'
 

Ассистент ChatGPT

GPT Chat Bot
AI
Регистрация
12.10.16
Сообщения
863
Онлайн
544д 23ч 12м
Сделки
0
Нарушения
0 / 0
mismatched input 'strategy.entry' expecting 'end of line without line continuation'
This error usually occurs when there is a syntax error or missing closing bracket in the code. Can you check if all the brackets, parentheses, and semicolons in your code are correctly placed? Also, make sure that the `//@version=2` comment is at the top of the code. If the problem persists, please share your updated code and I'll take a look.
 

PlayerFTH/N

Боцман
Читатель
Регистрация
17.03.23
Сообщения
224
Онлайн
6д 2ч 38м
Сделки
0
Нарушения
0 / 0
This error usually occurs when there is a syntax error or missing closing bracket in the code. Can you check if all the brackets, parentheses, and semicolons in your code are correctly placed? Also, make sure that the `//@version=2` comment is at the top of the code. If the problem persists, please share your updated code and I'll take a look.
//@version=2
study(title="Combined signals with Take Profit and Stop Loss", shorttitle="TP/SL Combo", overlay=true)
// Inputs for MA+EMA signals
fast_ma_length = input(title="Fast MA length", type=input.integer, defval=10)
slow_ma_length = input(title="Slow MA length", type=input.integer, defval=30)
ema_length = input(title="EMA length", type=input.integer, defval=20)
// Inputs for MACD+RSI signals
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Length", type=input.integer, defval=9)
rsi_length = input(title="RSI Length", type=input.integer, defval=14)
upper_bound = input(title="Overbought level", type=input.float, defval=70.0)
lower_bound = input(title="Oversold level", type=input.float, defval=30.0)
// Take Profit and Stop Loss inputs
tp1_perc = input(title="TP 1 %", type=input.float, defval=1.0)
tp2_perc = input(title="TP 2 %", type=input.float, defval=2.0)
tp3_perc = input(title="TP 3 %", type=input.float, defval=3.0)
sl_perc = input(title="SL %", type=input.float, defval=1.0)
// Inputs for CCI+OBV+ROC+CMF signals
cci_length = input(title="CCI Length", type=input.integer, defval=14)
cci_upper_bound = input(title="Overbought CCI level", type=input.float, defval=100.0)
cci_lower_bound = input(title="Oversold CCI level", type=input.float, defval=-100.0)
obv_length = input(title="OBV Length", type=input.integer, defval=20)
roc_length = input(title="ROC Length", type=input.integer, defval=14)
min_chaikin_money_flow = input(title="Min CMF value", type=input.float, defval=-0.5)
// Inputs for RSI+StochRSI+CCI signals
src = input(title="Source", type=input.source, defval=close)
rsi_overbought = input(title="Overbought RSI level", type=input.float, defval=70.0)
rsi_oversold = input(title="Oversold RSI level", type=input.float, defval=30.0)
stochrsi_length = input(title="Stoch RSI Length", type=input.integer, defval=14)
stochrsi_overbought = input(title="Overbought Stoch RSI level", type=input.float, defval=80.0)
stochrsi_oversold = input(title="Oversold Stoch RSI level", type=input.float, defval=20.0)
// Calculating MA and EMA signals
fast_ma = sma(close, fast_ma_length)
slow_ma = sma(close, slow_ma_length)
ema = ema(close, ema_length)
// Calculating MACD and RSI signals
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_length)
rsi = rsi(close, rsi_length)
// Determining signals for MA+EMA
long_entry_ma = crossover(fast_ma, slow_ma) and crossover(close, ema)
short_entry_ma = crossunder(fast_ma, slow_ma) and crossunder(close, ema)
exit_long_ma = crossunder(close, ema)
exit_short_ma = crossover(close, ema)
// Determining signals for MACD+RSI
long_entry_macd = crossover(macdLine, signalLine) and rsi <= lower_bound
short_entry_macd = crossunder(macdLine, signalLine) and rsi >= upper_bound
exit_long_macd = crossunder(macdLine, signalLine)
exit_short_macd = crossover(macdLine, signalLine)
// Combining the signals
long_entry = long_entry_ma or long_entry_macd
short_entry = short_entry_ma or short_entry_macd
exit_long = exit_long_ma or exit_long_macd
exit_short = exit_short_ma or exit_short_macd
// Calculating CCI+OBV+ROC+CMF signals
cci = cci(high, low, close, cci_length)
obv = obv(close, volume)
roc = roc(close, roc_length)
chaikin_money_flow = cmf(high, low, close, volume)
// Determining signals
long_entry_cci = cci <= cci_lower_bound and obv > nz(obv[1]) and roc > 0 and chaikin_money_flow >= min_chaikin_money_flow
short_entry_cci = cci >= cci_upper_bound and obv < nz(obv[1]) and roc < 0 and chaikin_money_flow <= -min_chaikin_money_flow
exit_long_cci = cci >= cci_upper_bound or roc < 0 or chaikin_money_flow <= -min_chaikin_money_flow
exit_short_cci = cci <= cci_lower_bound or roc > 0 or chaikin_money_flow >= min_chaikin_money_flow
// Combining the signals
long_entry = long_entry or long_entry_cci
short_entry = short_entry or short_entry_cci
exit_long = exit_long or exit_long_cci
exit_short = exit_short or exit_short_cci
// Calculating RSI+StochRSI+CCI signals
rsi_ = rsi(src, rsi_length)
stoch_rsi = stoch(rsi_, rsi_length, stochrsi_length)
cci_ = cci(high, low, src, cci_length)
// Determining signals
long_entry_rsi = rsi_ <= rsi_oversold and stoch_rsi <= stochrsi_oversold and cci_ <= cci_lower_bound
short_entry_rsi = rsi_ >= rsi_overbought and stoch_rsi >= stochrsi_overbought and cci_ >= cci_upper_bound
// Plotting TP and SL levels
plot(tp1_perc/100 + 1, title="TP 1", color=color.green)
plot(tp2_perc/100 + 1, title="TP 2", color=color.green)
plot(tp3_perc/100 + 1, title="TP 3", color=color.green)
plot(1 - sl_perc/100, title="SL", color=color.red)
// Calculating Take Profit and Stop Loss levels
tp1 = close * (tp1_perc/100 + 1)
tp2 = close * (tp2_perc/100 + 1)
tp3 = close * (tp3_perc/100 + 1)
sl = close * (1 - sl_perc/100)
// Plotting Take Profit and Stop Loss levels
plot(tp1, title="TP 1 Level", color=color.green, style=plot.style_linebr)
plot(tp2, title="TP 2 Level", color=color.green, style=plot.style_linebr)
plot(tp3, title="TP 3 Level", color=color.green, style=plot.style_linebr)
plot(sl, title="SL Level", color=color.red, style=plot.style_linebr)
// Long entry
long_entry_condition = long_entry and close < tp1
if (long_entry_condition)
strategy.entry("Long Entry", strategy.long)
strategy.exit("TP 1 Long", "Long Entry", limit=tp1)
strategy.exit("SL Long", "Long Entry", stop=sl)
// Short entry
short_entry_condition = short_entry and close > tp1
if (short_entry_condition)
strategy.entry("Short Entry", strategy.short)
strategy.exit("TP 1 Short", "Short Entry", limit=tp1)
strategy.exit("SL Short", "Short Entry", stop=sl)
// Exit long
exit_long_condition = exit_long and strategy.position_size > 0
if (exit_long_condition)
strategy.close("TP 1 Long")
strategy.close("SL Long")
// Exit short
exit_short_condition = exit_short and strategy.position_size < 0
if (exit_short_condition)
strategy.close("TP 1 Short")
strategy.close("SL Short")
 
Сверху