need help whit an indicator
#1
hi, anyone can write this indicator on javascript? work great but i don't have any knowledge on javascript

if we want i can post the link of the tradingview page of the script

thanks a lot




Code:
study(title="WaveTrend with Crosses [LazyBear]", shorttitle="WT_CROSS_LB")
n1 = input(10, "Channel Length")
n2 = input(21, "Average Length")
obLevel1 = input(60, "Over Bought Level 1")
obLevel2 = input(53, "Over Bought Level 2")
osLevel1 = input(-60, "Over Sold Level 1")
osLevel2 = input(-53, "Over Sold Level 2")

ap = hlc3
esa = ema(ap, n1)
d = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ema(ci, n2)

wt1 = tci
wt2 = sma(wt1,4)

plot(0, color=gray)
plot(obLevel1, color=red)
plot(osLevel1, color=green)
plot(obLevel2, color=red)
plot(osLevel2, color=green)

plot(wt1, color=green)
plot(wt2, color=red)
plot(wt1-wt2, color=blue, style=area, transp=80)
plot(cross(wt1, wt2) ? wt2 : na, color = black , style = circles, linewidth = 3)
plot(cross(wt1, wt2) ? wt2 : na, color = (wt2 - wt1 > 0 ? red : lime) , style = circles, linewidth = 2)
barcolor(cross(wt1, wt2) ? (wt2 - wt1 > 0 ? aqua : yellow) : na)
  Reply
#2
(10-11-2018, 11:14 PM)fraser Wrote: hi, anyone can write this indicator on javascript? work great but i don't have any knowledge on javascript

if we want i can post the link of the tradingview page of the script

thanks a lot

The Pinescript uses standard ema, sma and absolute calculations, it should be straight forward to convert it to a gekko indicator/strategy - I came accross this Lazybear indicator also some days ago.

But did you see a strategy using this indicator which really performs better than any existing one using stoch/stochrsi/macd for example, so it is worth to implement this indicator?
  Reply
#3
(10-12-2018, 09:48 AM)mark.sch Wrote:
(10-11-2018, 11:14 PM)fraser Wrote: hi, anyone can write this indicator on javascript? work great but i don't have any knowledge on javascript

if we want i can post the link of the tradingview page of the script

thanks a lot

The Pinescript uses standard ema, sma and absolute calculations, it should be straight forward to convert it to a gekko indicator/strategy - I came accross this Lazybear indicator also some days ago.

But did you see a strategy using this indicator which really performs better than any existing one using stoch/stochrsi/macd for example, so it is worth to implement this indicator?

thanks a lot for the answer.
I use this indicator manually and i have made some good profit, especially on higher timeframe. Example: the indicator tell me to sell BTC  2 hours before the crash of the other day. if you can transform in javascript i made some backtesting and i see if i have to combine whit other indicator, but i think this is already good. Can you translate in javascript? i'm trying but i have absolutely no knowledge in javascript. If this indicator work i absolutely reward you. thanks
  Reply
#4
I concentrate on other things right now, like multi timeframe hopping inside a strategy. And I personally think that this indicator alone is not a very good strategy. Maybe you can write a Pinescript strategy using this indicator and backtest first to get some figures?
  Reply
#5
If you want to try my transformation into that indicator's strategy. Unfortunately, the openings of the operations take place at the closing of the previous candles (obviously) and this is the difference between automatic strategies and indicators. Of course, I do not know if my code is correct, I'm just an amateur, maybe the experts of this forum will be able to improve my work ...

However, for me, the outcome is not bad on high timeframe (Daily / 4 hours), even if I did not have time to find optimized parameters ...


Code:
//@version=3
Code:
//
// @author LazyBear  -> (mod)
//
// If you use this code in its original/modified form, do drop me a note.
//
strategy("WaveTrend with Crosses [LazyBear] mod",pyramiding = 0, shorttitle="WT_CROSS_LB mod",
    initial_capital = 10000,
        currency = "EUR",
            default_qty_type = strategy.percent_of_equity,
                default_qty_value = 100,
                    commission_type = strategy.commission.percent,
                        commission_value = 0.1,
                            overlay=true)

FromYear  = input(title = "From Year", type = integer, defval = 2018, minval = 2011, maxval = 2050)
FromMonth = input(title = "From Month", type = integer, defval = 2, minval = 1, maxval = 12)
FromDay   = input(title = "From Day", type = integer, defval = 6, minval = 1, maxval = 31)
ToYear    = input(title = "To Year", type = integer, defval = 2050, minval = 2011, maxval = 2050)
ToMonth   = input(title = "To Month", type = integer, defval = 12, minval = 1, maxval = 12)
ToDay     = input(title = "To Day", type = integer, defval = 31, minval = 1, maxval = 31)

start = timestamp(FromYear, FromMonth, FromDay, 00, 00)
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59)
itsTime = time >= start and time < finish ? true : false

n1 = input(10, "Channel Length")
n2 = input(21, "Average Length")
LongEntryLevel = input(-50, "Long Entry Level")
LongExitLevel = input(30, "Long Exit Level")
ShortEnabled = input (title="Short Enabled?", defval = false)
ShortEntryLevel = input(50, "Short Entry Level")
ShortExitLevel = input(-30, "Short Exit Level")

Stoploss = input(0, "StopLoss % (0=disabled)", type=float)/100
Takeprofit = input(0, "TakeProfit % (0=disabled)", type=float)/100


ap = hlc3
esa = ema(ap, n1)
d = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ema(ci, n2)

wt1 = tci
wt2 = sma(wt1,4)

plot(0, color=gray, title="zeroline")
plot(LongEntryLevel, color=green, title="LongEntryLevel")
plot(LongExitLevel, color=red, title="LongExitLevel")
plot(ShortEntryLevel, color=green, title="ShortEntryLevel")
plot(ShortExitLevel, color=red, title="ShortExitLevel")

plot(wt1, color=green, title="wt1")           // media verde
plot(wt2, color=red, title="wt2")             // media rossa
diff = wt1-wt2                                // differenza fra le due medie
plot(diff, color=blue, style=area, transp=80, title="wt1-wt2")
plot(cross(wt1, wt2) ? wt2 : na, color = black , style = circles, linewidth = 3)
plot(cross(wt1, wt2) ? wt2 : na, color = (diff < 0 ? red : lime) , style = circles, linewidth = 2)
barcolor(cross(wt1, wt2) ? (diff < 0 ? aqua : yellow) : na)

// Operatività
LongCondition = crossover(wt1,wt2) and wt2 < LongEntryLevel
ExitLongCondition = wt2 > LongExitLevel
ShortCondition = crossunder(wt1,wt2) and wt2 > ShortEntryLevel
ExitShortCondition = wt2 < ShortExitLevel

stoploss_level_long = Stoploss > 0 ? strategy.position_avg_price * (1 - Stoploss) : na
stoploss_level_short = Stoploss > 0 ? strategy.position_avg_price * (1 + Stoploss) : na
takeprofit_level_long = Takeprofit > 0 ? strategy.position_avg_price * (1 + Takeprofit) : na
takeprofit_level_short = Takeprofit > 0 ? strategy.position_avg_price * (1 - Takeprofit) : na

if (itsTime)
   strategy.entry(id="Long",long=true,when=LongCondition)
   strategy.close(id="Long",when=ExitLongCondition)
   strategy.exit(id="Long SL/TP", from_entry = "Long", limit = takeprofit_level_long, stop = stoploss_level_long)
   if (ShortEnabled)
       strategy.entry(id="Short",long=false,when=ShortCondition)
       strategy.close(id="Short",when=ExitShortCondition)
       strategy.exit(id="Short SL/TP", from_entry = "Short", limit = takeprofit_level_short, stop = stoploss_level_short)


ps. : thx Askmike for whitelist ;-)
  Reply


Forum Jump:


Users browsing this thread: