I am totally new to pine script. i am totally unaware of how to do any changes in it. I have taken this strategy from trading view which i want to backtest. which is working fine but the only problem is it is taking 1990 as start date. i am unable to change the dates. and i dont know how to select dates manually. It is not visible in the script anywhere so i dont know how to do it. is there anyone who can explain to me how. and if you know from where i can get detail documentation of pine script so that i can learn it from the scratch. if you know please let me know.
//@version=3
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 19/06/2019
// This is combo strategies for get a cumulative signal.
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
// The strategy sells at market, if close price is lower than the previous close price
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// This indicator plots the oscillator as a histogram where blue denotes
// periods suited for buying and red . for selling. If the current value
// of AO (Awesome Oscillator) is above previous, the period is considered
// suited for buying and the period is marked blue. If the AO value is not
// above previous, the period is considered suited for selling and the
// indicator marks it as red.
// You can make changes in the property for set calculating strategy MA, EMA, WMA
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
vFast = sma(stoch(close, high, low, Length), KSmoothing)
vSlow = sma(vFast, DLength)
pos = 0.0
pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0)))
pos
BillWilliamsAC(nLengthSlow, nLengthFast,nLengthMA, nLengthEMA, nLengthWMA, bShowWMA, bShowMA, bShowEMA) =>
pos = 0
xSMA1_hl2 = sma(hl2, nLengthFast)
xSMA2_hl2 = sma(hl2, nLengthSlow)
xSMA1_SMA2 = xSMA1_hl2 - xSMA2_hl2
xSMA_hl2 = sma(xSMA1_SMA2, nLengthFast)
nRes = xSMA1_SMA2 - xSMA_hl2
xResWMA = wma(nRes, nLengthWMA)
xResMA = sma(nRes, nLengthMA)
xResEMA = ema(nRes, nLengthEMA)
xSignalSeries = iff(bShowWMA, xResWMA,
iff(bShowMA, xResMA,
iff(bShowEMA, xResEMA, na)))
cClr = nRes > nRes[1] ? blue : red
pos := iff(xSignalSeries[2] < 0 and xSignalSeries[1] > 0, 1,
iff(xSignalSeries[2] > 0 and xSignalSeries[1] < 0, -1, nz(pos[1], 0)))
pos
study(title="Combo Strategy 123 Reversal & Bill Williams. Awesome Oscillator (AC) with Signal Line", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
nLengthSlow = input(34, minval=1, title="Length Slow")
nLengthFast = input(5, minval=1, title="Length Fast")
nLengthMA = input(15, minval=1, title="MA")
nLengthEMA = input(15, minval=1, title="EMA")
nLengthWMA = input(15, minval=1, title="WMA")
bShowWMA = input(type=bool, defval=true, title="Show and trading WMA")
bShowMA = input(type=bool, defval=false, title="Show and trading MA")
bShowEMA = input(type=bool, defval=false, title="Show and trading EMA")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posBillWilliamsAC = BillWilliamsAC(nLengthSlow, nLengthFast,nLengthMA, nLengthEMA, nLengthWMA, bShowWMA, bShowMA, bShowEMA)
pos = iff(posReversal123 == 1 and posBillWilliamsAC == 1 , 1,
iff(posReversal123 == -1 and posBillWilliamsAC == -1, -1, 0))
barcolor(pos == -1 ? red: pos == 1 ? green : blue )