I am trying to create an indicator that colors the buy/sell candles if these conditions are met.
I have been testing this on a 15m TF and it is extremely accurate.
Condition is as follows:
#Buy Signal-
1) Must have a red candle.
2) next (Green) candle must open lower than high of RED candle, It must also move lower than RED candle Low, It Must close Higher than the close of Red Candle, It must Close Lower than the open of the RED candle.
3) 8EMA - Green Candle Must Close Above the 8EMA
4) Color Candle White.
#Sell Signal-
1) Must have a Green candle.
2) next (RED) candle must open Higher than Low of Green candle, It must also move Higher than Green candle high, It Must close Lower than the close of Green Candle, It must Close Higher than the open of the Green candle.
3) 8EMA - Green Candle Must Close Below the 8EMA
4) Color Candle Yellow.
This is what I have done so far. Can someone add the EMA condition
Also, Any input appreciated.
.
I would like it to be optional if possible. I would like to have a "Use EMA" Yes/No.
I have been testing this on a 15m TF and it is extremely accurate.
Condition is as follows:
#Buy Signal-
1) Must have a red candle.
2) next (Green) candle must open lower than high of RED candle, It must also move lower than RED candle Low, It Must close Higher than the close of Red Candle, It must Close Lower than the open of the RED candle.
3) 8EMA - Green Candle Must Close Above the 8EMA
4) Color Candle White.
#Sell Signal-
1) Must have a Green candle.
2) next (RED) candle must open Higher than Low of Green candle, It must also move Higher than Green candle high, It Must close Lower than the close of Green Candle, It must Close Higher than the open of the Green candle.
3) 8EMA - Green Candle Must Close Below the 8EMA
4) Color Candle Yellow.
This is what I have done so far. Can someone add the EMA condition
Also, Any input appreciated.
Code:
# Define conditions for the red candle
def isRedCandle = close < open;
def isRedCandleWithinGreen = high > high[1] and close < close[1] and close > open[1] and open > low[1] and low > low[1];
# Define conditions for the green candle
def isGreenCandle = close > open;
def isGreenCandleWithinRed = low < low[1] and close > close[1] and close < open[1] and open < high[1] and high < high[1];
#EMA Condition
#def ema =
# Assign colors to candles based on conditions
#Sell Signal
AssignPriceColor(if isGreenCandle then color.current else if isRedCandleWithinGreen then color.yellow else color.current);
#Buy Signal
AssignPriceColor(if isRedCandle then color.current else if isGreenCandleWithinRed then color.white else color.current);
I would like it to be optional if possible. I would like to have a "Use EMA" Yes/No.