umdParticipant
New
Hi, Is there an indicator in prorealtime (as shown in below picture)?
It print green candles when close above EMA line, and red candles when close below EMA line. All candles will be either green or red.
EMA line also changes color green/red, depending on bar close above/below EMA line.
Does anyone have this indicator please? I use this on Tradingview charts, seems simple, but can’t find on prorealtime.
Thanks
There you go:
r = 0
g = 255
b = 0
t = 255
MyMA = average[Periods,Type](close)
IF close <= MyMA THEN
r = 255
g = 0
t = 255
ENDIF
DrawCandle(Open,High,Low,Close) coloured(r,g,b,t)
RETURN MyMA coloured(r,g,b,t) AS "My Moving Average"
umdParticipant
New
There you go:
1
2
3
4
5
6
7
8
9
10
11
12
|
r = 0
g = 255
b = 0
t = 255
MyMA = average[Periods,Type](close)
IF close <= MyMA THEN
r= 255
g= 0
t= 255
ENDIF
DrawCandle(Open,High,Low,Close) coloured(r,g,b,t)
RETURN MyMA coloured(r,g,b,t) AS “My Moving Average”
|
Thanks for reply. The above code is showing error “The following variable is undefined: Periods, Type”
umdParticipant
New
There you go:
1
2
3
4
5
6
7
8
9
10
11
12
|
r = 0
g = 255
b = 0
t = 255
MyMA = average[Periods,Type](close)
IF close <= MyMA THEN
r= 255
g= 0
t= 255
ENDIF
DrawCandle(Open,High,Low,Close) coloured(r,g,b,t)
RETURN MyMA coloured(r,g,b,t) AS “My Moving Average”
|
Thanks for reply. The above code is showing error “The following variable is undefined: Periods, Type”
Thanks a lot @robertogozzi, it works now.
Sorry, I forgot to post a couple of lines with the two settings:
Periods = 20 //any number greater than 0
Type = 1 //0-8 as from https://www.prorealcode.com/documentation/average/
I’m glad you could find a solution.
umdParticipant
New
Sorry, I forgot to post a couple of lines with the two settings:
|
|
Periods = 20 //any number greater than 0
|
I’m glad you could find a solution.
Thanks again robertgozzi. It works good, I appreciate your reply.
How can i draw a green candle if the indicator condition is true and red when indicator condition is fale. Its based on Weekly and daily data, and I intend to load it in 15m chart.
here is the code,
r = 0
g = 0
b = 0
t = 0
Timeframe (Weekly)
indicator1w, indicator2w, ignored, ignored = CALL DTOSC[1, 0](close)
cx1=(indicator1w >= indicator2w)
Rem STU Exit Conditions, trail stop when Daily DT > 75 or DT Bear
Timeframe (Daily)
indicator1d, indicator2d, ignored, ignored = CALL DTOSC[1, 0](close)
cx2=((indicator1d >= indicator2d) )
timeframe (15 minute)
If cx1=1 and cx2=1 then
r = 255
g = 0
t = 255
Endif
Drawcandle(open,high,low,close) bordercolor(r,g,b,t)
return
I tested this slightly modified version, which works like a charm:
Timeframe (Weekly,UpdateOnClose)
//indicator1w, indicator2w, ignored, ignored = CALL DTOSC[1, 0](close)
indicator1w = average[5,0](close)
indicator2w = average[10,0](close)
cx1=(indicator1w >= indicator2w)
Rem STU Exit Conditions, trail stop when Daily DT > 75 or DT Bear
Timeframe (Daily,UpdateOnClose)
//indicator1d, indicator2d, ignored, ignored = CALL DTOSC[1, 0](close)
indicator1d = average[5,0](close)
indicator2d = average[10,0](close)
cx2=(indicator1d >= indicator2d)
timeframe (15 minute)
r = 255
g = 0
b = 0
t = 255
If cx1=1 and cx2=1 then
r = 0
g = 255
Endif
Drawcandle(open,high,low,close) coloured(r,g,b,t) bordercolor(r,g,b,t)
return
I replaced DTOSC with SMAs, as I don’t have it installed.