-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
This message appears
[WARNING] const math = context.math syntax is deprecated. Use const { math, ta, input } = context.pine instead. This will be removed in a future version.
When I run
const pine = new PineTS(provider, "BTCUSDT", "1h", 100);
await pine.ready()
pine.run(code)
The code is
//@version=5
indicator("Signal Strategy 100 candles of 1H timeframe")
// Indicators - faster settings for 1H
rsi = ta.rsi(close, 10)
atr = ta.atr(10)
ema_fast = ta.ema(close, 7)
ema_slow = ta.ema(close, 16)
// Conditions
long_cond = ta.crossover(ema_fast, ema_slow) and rsi < 65
short_cond = ta.crossunder(ema_fast, ema_slow) and rsi > 35
// Levels - tighter SL, wider TP for better RR
sl_long = close - atr * 1.5
tp_long = close + atr * 3
sl_short = close + atr * 1.5
tp_short = close - atr * 3
// Plots for extraction
plot(close, "Close")
plot(long_cond ? 1 : short_cond ? -1 : 0, "Signal")
plot(long_cond ? sl_long : sl_short, "StopLoss")
plot(long_cond ? tp_long : tp_short, "TakeProfit")
plot(60, "EstimatedTime") // 1 hour in minutes
Metadata
Metadata
Assignees
Labels
No labels