Username: Password:

Author Topic: Tradingviews script i ported back in time for 1000trades  (Read 10414 times)

Offline Gunthar

  • Administrator
  • *****
  • Posts: 287
    • View Profile
Tradingviews script i ported back in time for 1000trades
« on: April 14, 2017, 12:46:27 AM »
Code: [Select]
//@version=2
study("GUNBOT by Gunthar", overlay=true)

// GUNBOT by Gunthar 29 Nov 2016

src = input(title="Data Array",type=source,defval=ohlc4)
prd1=input(title="Short MA period", type=integer,defval=10)
prd2=input(title="Long MA period",type=integer,defval=20)
AP = ema(src,2)
Fast = ema(AP,prd1)
Slow = ema(AP,prd2)


Bullish = Fast>Slow
Bearish = Fast<Slow

Green = Bullish and AP>Fast
Red = Bearish and AP<Fast
Yellow = Bullish and AP<Fast
Blue = Bearish and AP>Fast

//Long Signal
Buy = Green and Green[1]==0
Sell = Red and Red[1]==0

//Short Signal
Short = Red and Red[1]==0
Cover = Red[1] and Red==0

//Plot

l1=plot(Fast, linewidth=1,color=red)
l2=plot(Slow, linewidth=2,color=blue)
bcolor = Green ? red : Red ? lime : Yellow ? gray : Blue ? gray : white
barcolor(color=bcolor)
fill(l1,l2,bcolor)

Offline PredaTorS

  • Rookie
  • *
  • Posts: 2
    • View Profile
Re: Tradingviews script i ported back in time for 1000trades
« Reply #1 on: April 18, 2017, 02:01:35 AM »
TY