noro

Noro's Trend MAs Strategy v2.0

Don't use on pairs of type "crypto/crypto"!

Only for pairs like "crypto/fiat" ("BTC/USD", "BTC/CNY", "ETH/USD", "ETH/CNY", etc)

Trade strategy which uses only 2 MA.
The slow MA (blue) is used for definition of a trend
The fast MA (red) is used for an entrance to the transaction

For:

- For H1
- For crypto/fiat
- Good for "BTC/USD", "ETH/USD"

Recomended:

Long = true (if it is profitable as a result of backtests)
Short = true (if it is profitable as a result of backtests)
Stops = false
Stop, % = any
OHLC4 = any
Use Fast MA = true
Fast MA Period = 5
Slow MA Period = 21
Bars Q = (2 for "bitcoin/fiat" or 1 for "crypto/fiat")
Extreme = true (if "crypto/fiat")

In the new version 2.0

- CryptoBottom is added
Remove from Favorite Scripts Add to Favorite Scripts

Связанные идеи

Why would the profits change when long/short are added/removed?

If I turn off short positions - profits by long-only positions changes. It should not be the case, right?
+1 Ответить
Chrysalte NikhilGuptab4
@NikhilGuptab4, I think that is related to margin exchanges, short = bet on drops.
Am I right ?
Ответить
Here the version to have the alerts :
//@version=2
//strategy(title = "Noro's Trend MAs Strategy v2.1 +CB", shorttitle = "Trend MAs str 2.1", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value=100.0, pyramiding=0)
study(title = "Noro's Trend MAs Strategy v2.2 +CB", shorttitle = "Trend MAs str 2.2", overlay=true)

//Settings
needlong = input(true, "long")
needshort = input(true, "short")
needstops = input(false, "stops")
stoppercent = input(5, defval = 5, minval = 1, maxval = 50, title = "Stop, %")
useohlc4 = input(false, defval = false, title = "Use OHLC4")
usefastsma = input(true, "Use fast MA Filter")
fastlen = input(5, defval = 5, minval = 1, maxval = 50, title = "fast MA Period")
slowlen = input(21, defval = 20, minval = 2, maxval = 200, title = "slow MA Period")
bars = input(2, defval = 2, minval = 0, maxval = 3, title = "Bars Q")
needbg = input(false, defval = false, title = "Need trend Background?")
needarr = input(false, defval = false, title = "Need entry arrows?")
needex = input(true, defval = true, title = "Need extreme? (crypto/fiat only!!!)")
FromMonth = input(defval = 10, title = "From Month", minval = 1)
FromDay = input(defval = 3, title = "From Day", minval = 1)
FromYear = input(defval = 2017, title = "From Year", minval = 2014)
ToMonth = input(defval = 1, title = "To Month", minval = 1)
ToDay = input(defval = 1, title = "To Day", minval = 1)
ToYear = input(defval = 9999, title = "To Year", minval = 2014)



src = useohlc4 == true ? ohlc4 : close

//PriceChannel 1
lasthigh = highest(src, slowlen)
lastlow = lowest(src, slowlen)
center = (lasthigh + lastlow) / 2

//PriceChannel 2
lasthigh2 = highest(src, fastlen)
lastlow2 = lowest(src, fastlen)
center2 = (lasthigh2 + lastlow2) / 2

//Trend
trend = low > center and low > center ? 1 : high < center and high < center ? -1 : trend

//Bars
bar = close > open ? 1 : close < open ? -1 : 0
redbars = bars == 0 ? 1 : bars == 1 and bar == -1 ? 1 : bars == 2 and bar == -1 and bar == -1 ? 1 : bars == 3 and bar == -1 and bar == -1 and bar == -1 ? 1 : 0
greenbars = bars == 0 ? 1 : bars == 1 and bar == 1 ? 1 : bars == 2 and bar == 1 and bar == 1 ? 1 : bars == 3 and bar == 1 and bar == 1 and bar == 1 ? 1 : 0

//Fast RSI
fastup = rma(max(change(close), 0), 2)
fastdown = rma(-min(change(close), 0), 2)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))

//CryptoBottom
mac = sma(close, 10)
len = abs(close - mac)
sma = sma(len, 100)
max = max(open, close)
min = min(open, close)
up3 = close < open and len > sma * 3 and min < min and fastrsi < 10 ? 1 : 0

//Signals
up = trend == 1 and (low < center2 or usefastsma == false) and (redbars == 1) ? 1 : 0
dn = trend == -1 and (high > center2 or usefastsma == false) and (greenbars == 1) ? 1 : 0

up2 = high < center and high < center2 and bar == -1 ? 1 : 0
dn2 = low > center and low > center2 and bar == 1 ? 0 : 0

//Lines
plot(center, color = blue, linewidth = 3, transp = 0, title = "Slow MA")
plot(center2, color = red, linewidth = 3, transp = 0, title = "PriceChannel 2")

//Arrows
plotarrow(up == 1 and needarr == true ? 1 : 0, colorup = black, colordown = black, transp = 0)
plotarrow(dn == 1 and needarr == true ? -1 : 0, colorup = black, colordown = black, transp = 0)

//Background
col = needbg == false ? na : trend == 1 ? lime : red
bgcolor(col, transp = 90)

//Alerts
//alertcondition(up == 1, title='buy', message='Uptrend')
//alertcondition(dn == 1, title='sell', message='Downtrend')

//Trading
stoplong = up == 1 and needstops == true ? close - (close / 100 * stoppercent) : stoplong
stopshort = dn == 1 and needstops == true ? close + (close / 100 * stoppercent) : stopshort

longCondition = up == 1 or (up2 == 1 and needex == true) or up3 == 1
//if (longCondition)
// strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=((time > timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))
// strategy.exit("Stop Long", "Long", stop = stoplong, when=((time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))

shortCondition = dn == 1
//if (shortCondition)
// strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=((time > timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))
// strategy.exit("Stop Short", "Short", stop = stopshort, when=((time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))

//Alerts
alertcondition(up or (up2 == 1 and needex == true) or up3, title='buy', message='Uptrend')
alertcondition(dn, title='sell', message='Downtrend')
//for people not pro
//alertcondition(up or (up2 == 1 and needex == true) or up3 or dn, title='buy or sell', message='Uptrend or Downtrend')
Ответить
Chrysalte Chrysalte
@Chrysalte, The alerts are not matching with the long/short order of the strategy.
Ответить
Chrysalte Chrysalte
@Chrysalte, it is related to the "(up2 == 1 and needex == true) or up3 == 1", why do we have to not write it ?
Ответить
Chrysalte Chrysalte
@Chrysalte, even without it, the alert doesn't match...
Ответить
Chrysalte Chrysalte
@Chrysalte, Resolved ! Be careful you need to have EXACTLY the same settings on strategy and study version.


Here the study version with alerts updated.

//@version=2
//strategy(title = "Noro's Trend MAs Strategy v2.3 alertlong +CB", shorttitle = "Trend MAs str 2.3 alertlong", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value=100.0, pyramiding=0)
study(title = "Noro's Trend MAs Strategy v2.3 +CB alertlong", shorttitle = "Trend MAs str 2.3 alertlong", overlay=true)

//Settings
needlong = input(true, "long")
needshort = input(false, "short")
needstops = input(false, "stops")
stoppercent = input(5, defval = 5, minval = 1, maxval = 50, title = "Stop, %")
useohlc4 = input(false, defval = false, title = "Use OHLC4")
usefastsma = input(true, "Use fast MA Filter")
fastlen = input(5, defval = 5, minval = 1, maxval = 50, title = "fast MA Period")
slowlen = input(21, defval = 20, minval = 2, maxval = 200, title = "slow MA Period")
bars = input(1, defval = 2, minval = 0, maxval = 3, title = "Bars Q")
needbg = input(false, defval = false, title = "Need trend Background?")
needarr = input(false, defval = false, title = "Need entry arrows?")
needex = input(true, defval = true, title = "Need extreme? (crypto/fiat only!!!)")
//FromMonth = input(defval = 1, title = "From Month", minval = 1)
//FromDay = input(defval = 1, title = "From Day", minval = 1)
//FromYear = input(defval = 2018, title = "From Year", minval = 2014)
//ToMonth = input(defval = 1, title = "To Month", minval = 1)
//ToDay = input(defval = 1, title = "To Day", minval = 1)
//ToYear = input(defval = 9999, title = "To Year", minval = 2014)



src = useohlc4 == true ? ohlc4 : close

//PriceChannel 1
lasthigh = highest(src, slowlen)
lastlow = lowest(src, slowlen)
center = (lasthigh + lastlow) / 2

//PriceChannel 2
lasthigh2 = highest(src, fastlen)
lastlow2 = lowest(src, fastlen)
center2 = (lasthigh2 + lastlow2) / 2

//Trend
trend = low > center and low > center ? 1 : high < center and high < center ? -1 : trend

//Bars
bar = close > open ? 1 : close < open ? -1 : 0
redbars = bars == 0 ? 1 : bars == 1 and bar == -1 ? 1 : bars == 2 and bar == -1 and bar == -1 ? 1 : bars == 3 and bar == -1 and bar == -1 and bar == -1 ? 1 : 0
greenbars = bars == 0 ? 1 : bars == 1 and bar == 1 ? 1 : bars == 2 and bar == 1 and bar == 1 ? 1 : bars == 3 and bar == 1 and bar == 1 and bar == 1 ? 1 : 0

//Fast RSI
fastup = rma(max(change(close), 0), 2)
fastdown = rma(-min(change(close), 0), 2)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))

//CryptoBottom
mac = sma(close, 10)
len = abs(close - mac)
sma = sma(len, 100)
max = max(open, close)
min = min(open, close)
up3 = close < open and len > sma * 3 and min < min and fastrsi < 10 ? 1 : 0

//Signals
up = trend == 1 and (low < center2 or usefastsma == false) and (redbars == 1) ? 1 : 0
dn = trend == -1 and (high > center2 or usefastsma == false) and (greenbars == 1) ? 1 : 0

up2 = high < center and high < center2 and bar == -1 ? 1 : 0
dn2 = low > center and low > center2 and bar == 1 ? 0 : 0

//Lines
plot(center, color = blue, linewidth = 3, transp = 0, title = "Slow MA")
plot(center2, color = red, linewidth = 3, transp = 0, title = "PriceChannel 2")

//Arrows
plotarrow(up == 1 and needarr == true ? 1 : 0, colorup = black, colordown = black, transp = 0)
plotarrow(dn == 1 and needarr == true ? -1 : 0, colorup = black, colordown = black, transp = 0)

//Background
col = needbg == false ? na : trend == 1 ? lime : red
bgcolor(col, transp = 90)

//Trading
//stoplong = up == 1 and needstops == true ? close - (close / 100 * stoppercent) : stoplong
//stopshort = dn == 1 and needstops == true ? close + (close / 100 * stoppercent) : stopshort

longCondition = up == 1 or (up2 == 1 and needex == true) or up3 == 1
//if (longCondition)
// strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=((time > timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))
// strategy.exit("Stop Long", "Long", stop = stoplong, when=((time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))

shortCondition = dn == 1
//if (shortCondition)
// strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=((time > timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))
// strategy.exit("Stop Short", "Short", stop = stopshort, when=((time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))

//indicator buy/sell
plotchar(longCondition, char = "L", location=location.belowbar, color = green)
plotchar(shortCondition, char = "S", color = red)

//Alerts
alertcondition(longCondition ? true : false, title='buy', message='Uptrend')
alertcondition(shortCondition ? true : false, title='sell', message='Downtrend')


Ответить
Chrysalte Chrysalte
@Chrysalte, wrong copy paste...

//Alerts
alertcondition(longCondition ? true : false, title='buy', message='Uptrend')
alertcondition(shortCondition ? true : false, title='sell', message='Downtrend')
Ответить
Chrysalte Chrysalte
@Chrysalte, oh no, it doesn't display well the script

//Alerts
alertcondition(longCondition **write here without stars the symbol alt+091 then 1 then alt+093** ? true : false, title='buy', message='Uptrend')
alertcondition(shortCondition **write here without stars the symbol alt+091 then 1 then alt+093** ? true : false, title='sell', message='Downtrend')
Ответить
Hello,

I have done a change to get period :

//@version=2
strategy(title = "Noro's Trend MAs Strategy v2.0 +CB", shorttitle = "Trend MAs str 2.0", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value=100.0, pyramiding=0)

//Settings
needlong = input(true, "long")
needshort = input(true, "short")
needstops = input(false, "stops")
stoppercent = input(5, defval = 5, minval = 1, maxval = 50, title = "Stop, %")
useohlc4 = input(false, defval = false, title = "Use OHLC4")
usefastsma = input(true, "Use fast MA Filter")
fastlen = input(5, defval = 5, minval = 1, maxval = 50, title = "fast MA Period")
slowlen = input(21, defval = 20, minval = 2, maxval = 200, title = "slow MA Period")
bars = input(2, defval = 2, minval = 0, maxval = 3, title = "Bars Q")
needbg = input(false, defval = false, title = "Need trend Background?")
needarr = input(false, defval = false, title = "Need entry arrows?")
needex = input(true, defval = true, title = "Need extreme? (crypto/fiat only!!!)")
FromMonth = input(defval = 10, title = "From Month", minval = 1)
FromDay = input(defval = 3, title = "From Day", minval = 1)
FromYear = input(defval = 2017, title = "From Year", minval = 2014)
ToMonth = input(defval = 1, title = "To Month", minval = 1)
ToDay = input(defval = 1, title = "To Day", minval = 1)
ToYear = input(defval = 9999, title = "To Year", minval = 2014)



src = useohlc4 == true ? ohlc4 : close

//PriceChannel 1
lasthigh = highest(src, slowlen)
lastlow = lowest(src, slowlen)
center = (lasthigh + lastlow) / 2

//PriceChannel 2
lasthigh2 = highest(src, fastlen)
lastlow2 = lowest(src, fastlen)
center2 = (lasthigh2 + lastlow2) / 2

//Trend
trend = low > center and low > center ? 1 : high < center and high < center ? -1 : trend

//Bars
bar = close > open ? 1 : close < open ? -1 : 0
redbars = bars == 0 ? 1 : bars == 1 and bar == -1 ? 1 : bars == 2 and bar == -1 and bar == -1 ? 1 : bars == 3 and bar == -1 and bar == -1 and bar == -1 ? 1 : 0
greenbars = bars == 0 ? 1 : bars == 1 and bar == 1 ? 1 : bars == 2 and bar == 1 and bar == 1 ? 1 : bars == 3 and bar == 1 and bar == 1 and bar == 1 ? 1 : 0

//Fast RSI
fastup = rma(max(change(close), 0), 2)
fastdown = rma(-min(change(close), 0), 2)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))

//CryptoBottom
mac = sma(close, 10)
len = abs(close - mac)
sma = sma(len, 100)
max = max(open, close)
min = min(open, close)
up3 = close < open and len > sma * 3 and min < min and fastrsi < 10 ? 1 : 0

//Signals
up = trend == 1 and (low < center2 or usefastsma == false) and (redbars == 1) ? 1 : 0
dn = trend == -1 and (high > center2 or usefastsma == false) and (greenbars == 1) ? 1 : 0

up2 = high < center and high < center2 and bar == -1 ? 1 : 0
dn2 = low > center and low > center2 and bar == 1 ? 0 : 0

//Lines
plot(center, color = blue, linewidth = 3, transp = 0, title = "Slow MA")
plot(center2, color = red, linewidth = 3, transp = 0, title = "PriceChannel 2")

//Arrows
plotarrow(up == 1 and needarr == true ? 1 : 0, colorup = black, colordown = black, transp = 0)
plotarrow(dn == 1 and needarr == true ? -1 : 0, colorup = black, colordown = black, transp = 0)

//Background
col = needbg == false ? na : trend == 1 ? lime : red
bgcolor(col, transp = 90)

//Alerts
alertcondition(up == 1, title='buy', message='Uptrend')
alertcondition(dn == 1, title='sell', message='Downtrend')

//Trading
stoplong = up == 1 and needstops == true ? close - (close / 100 * stoppercent) : stoplong
stopshort = dn == 1 and needstops == true ? close + (close / 100 * stoppercent) : stopshort

longCondition = up == 1 or (up2 == 1 and needex == true) or up3 == 1
if (longCondition)
strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=((time > timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))
strategy.exit("Stop Long", "Long", stop = stoplong, when=((time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))

shortCondition = dn == 1
if (shortCondition)
strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=((time > timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))
strategy.exit("Stop Short", "Short", stop = stopshort, when=((time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))


+3 Ответить
RU Русский
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Домой Скринер акций Сигналы для Форекс пар Сигналы для криптовалют Экономический календарь О проекте Особенности Правила поведения Модераторы Решения для сайтов и брокеров Виджеты Компонент графиков Отзывы и предложения Блог и новости ЧаВо Справка и Wiki Твиттер
Профиль Настройки профиля Счёт и оплата Мои запросы в поддержку Связаться с поддержкой Опубликовано идей Подписчики Подписан Личные сообщения Чат Выйти