ASK QUESTIONS BELOW....QUESTIONS WILL BE ANSWERED IN ON-GOING VIDEO SERIES.
Each Video will be 10 Minutes in Length, Covering a Specific Topic.
I will Start By Taking A Common Indicator Like the and Starting From The Very Basics, Then Adding In All Customizable Options.
- The Basics You Need To Know.
- Available Reference Materials.
- Creating Custom Colors Based On Conditions.
- Changing Bar Colors Based On Conditions.
- Using Multi-TimeFrames.
- And More...
We Will Have Guest Appearances From Some Of The Top Coders On TradingView Showing Advanced Techniques!!!
We Will Also Cover Other Types Of Indicators!!!
ASK QUESTIONS BELOW...ANYTHING REGARDING CODING IN PINESCRIPT.
QUESTIONS WILL BE ANSWERED IN VIDEO SERIES.
Firstly thanks for all your posts, scripts and ideas; they have been a great set of learning material for me.
I wonder if you'd be able to answer a query i have?
I am building custom indicators and I cannot seem to find out how to define which plot gets shown shown from front to back.
What i mean by this is i have an area fill between 2 EMA lines and the 2 DEMA lines within the same indicator, however the area plot is covering the DEMA lines.
No matter where in my script I choose to put the plot code, this does not change.
I have researched through Tradingview's library and cannot find any code to help define this.
Would you perhaps know how to get this done?
Many thanks in advance
This would be a sequence count. Lets say from the lowest low of a down trend.
It would label this candle with a small (1). If the following bar has a higher high and low, this would be (2) and so forth. (These labelled numbers going up in value and be of a particular colour, lets say yellow for this example). Then as soon as there is a lower high, and a lower low, this would reset the numbers and the correction would start again with (1) and following if it created lower highs and lows. These could be coloured Blue
Inside bars and outside bars would take on the number of the previous sequence.
Example: Candle 1 2 and 3 have higher highs and lows so labelled 1,2,3. Candle 4 is an inside bar, this is label 4. candle 4 is an outside bar, this is labelled 5. candle 6 is a lower high and lower low so this is now labelled (1). of the new trend.
If this can be done please let me know what i must do to make it happen. Kind regards
I am new at this programming, and my last programming hour was something lige 20 years ago, but I am trying. ;-)
I am trying to make a indicator that combine several indicatores, and it all worked well until I tryed to put ADX and DI into it. Now it don't accept my literals in the ADX and DI section, and >I can't understand why. I have marked the problem with /////PROBLEM///// in the schript behind, but it ids not only line 61, it is also the 7 next literals in the next 7 lines.
Can anybody help me
study(title="Moneymaker", shorttitle="MoMa", precision=0)
DEMA_length2 = input(26, minval=1)
dema_src2_1 = input(close, title="DEMA 2 Source")
dema_e2_1 = ema(dema_src2_1, DEMA_length2)
dema_e2_2 = ema(dema_e2_1, DEMA_length2)
dema2 = 2 * dema_e2_1 - dema_e2_2
DEMA_length3 = input(50, minval=1)
dema_src3_1 = input(close, title="DEMA 3 Source")
dema_e3_1 = ema(dema_src3_1, DEMA_length3)
dema_e3_2 = ema(dema_e3_1, DEMA_length3)
dema3 = 2 * dema_e3_1 - dema_e3_2
dema = dema3 < dema2 ? 1 : 0//Sætter variablen til 1 hvis dema3 krydser under dema2
showMA = input(true)
barColorsOnPrevClose = input(title="Color bars based on previous close", type=bool, defval=false)//
vol_Open = barColorsOnPrevClose ? close > close ? 0 : 1 : open > close ? 0 : 1 // sætte volume barcode til 1 hvis grøn, eller rød
vol_Spike = volume > sma(volume,20) ? 1 : 0 // Sætte volume barcode til 1 hvis højere end de sidste 20 sma, ellers 0
vol = vol_Spike == 1 and vol_Open == 1 ? 1 : 0 // sætter variabel til 1 hvis både vol_Open og vol_Spike er opfyldt
MACDfast = 12, MACDslow = 26
fastMACD = ema(close, MACDfast)
slowMACD = ema(close, MACDslow)
MACD = fastMACD-slowMACD
MACDs = sma(MACD, 9)
macd = MACDs < MACD ? 1 : 0
length = input(title="Length", type=integer, defval=10, minval=1, maxval=2000)
src = hlc3
upper = sum(volume * (change(src) <= 0 ? 0 : src), length)
lower = sum(volume * (change(src) >= 0 ? 0 : src), length)
mf = rsi(upper, lower)
//overbought=hline(80, title="Overbought", color=#c0c0c0)
//oversold=hline(20, title="Oversold", color=#c0c0c0)
//fill(overbought, oversold, color=#9915ff, transp=90)
mfi = mf > 80 ? 1 : 0
//ADX and DI
len = input(title="Length", type=integer, defval=14)
th = input(title="threshold", type=integer, defval=20)
TrueRange = max(max(high-low, abs(high-nz(close))), abs(low-nz(close)))
DirectionalMovementPlus = high-nz(high) > nz(low)-low ? max(high-nz(high), 0): 0
DirectionalMovementMinus = nz(low)-low > high-nz(high) ? max(nz(low)-low, 0): 0
SmoothedTrueRange = nz(SmoothedTrueRange) - (nz(SmoothedTrueRange)/len) + TrueRange
//SmoothedDirectionalMovementPlus = nz(SmoothedDirectionalMovementPlus) - (nz(SmoothedDirectionalMovementPlus)/len) + DirectionalMovementPlus
//SmoothedDirectionalMovementMinus = nz(SmoothedDirectionalMovementMinus) - (nz(SmoothedDirectionalMovementMinus)/len) + DirectionalMovementMinus
//DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100
//DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100
//DX = abs(DIPlus-DIMinus) / (DIPlus+DIMinus)*100
//ADX = sma(DX, len)
//plot(DIPlus, color=green, title="DI+")
//plot(DIMinus, color=red, title="DI-")
//plot(ADX, color=black, title="ADX")
//hline(th, color=black, linestyle=dashed)
MoMa = dema == 1 and vol == 1 and macd == 1 and mfi == 1 ? 1 : 0
//vol_Spike_and_vol_Open_and_dema3_under_dema2 = vol_Spike_and_vol_Open == 1 and dema3_under_dema2 == 1 ? 1 : 0
//vol_Spike_and_vol_Open_and_dema3__under_dema2_and_MACDs_under_MACD = vol_Spike_and_vol_Open_and_dema3_under_dema2 == 1 and MACDsignal < macd ? 1 :0
//plot(vol_Spike_and_vol_Open, color = yellow, style=columns, title="Volume open")
//plot(dema_Cross, color = red, style=columns, title="Dema cross")
//plot(vol_Spike_and_vol_Open_and_dema3_under_dema2, color = red, style=columns, title="Dema cross")
plot(MoMa, color = red, style=columns, title="Dema cross")