set column background based on VWAP and ema crossover


-1
0

Hello

please can you help me with creating custom column for watchlist. Looking for 2 column

  1.  if the current price is over the Vwap then background color to be green else red include pre market.
  2.  if EMA 8 crossover 20SMA then background color to green and if 20 Sma crossover to 8 EMA then red color ( include premarket).

Please help me with this trying from a long time still cant figure it out

 

Marked as spam
Posted by (Questions: 6, Answers: 3)
Asked on March 1, 2019 9:49 pm
21 views

Hi, I notice here that is says resolved but I don’t see the resolution……can you point me in the right direction?

( at March 15, 2019 9:24 am)
0
Private answer

Your original question title “watchlist column” was to vague and did not describe your request for other viewers. I have updated the title to better reflect the context of your request.

Here is the code for the VWAP column.

def data = reference VWAP().VWAP;
AssignBackgroundColor(if close > data then Color.GREEN else Color.RED);

Here is the code for the ema cross. (this has already been asked and posted elsewhere in the forum)

input lengthOne = 8;
input lengthTwo = 20;
input maTypeOne = AverageType.EXPONENTIAL;
input maTypeTwo = AverageType.EXPONENTIAL;
input priceOne = close;
input priceTwo = close;
def maOne = MovingAverage(maTypeOne, priceOne, lengthOne);
def maTwo = MovingAverage(maTypeTwo, priceTwo, lengthTwo);
AssignBackgroundColor(if maOne > maTwo then Color.GREEN else Color.RED);

Marked as spam
Posted by (Questions: 35, Answers: 1789)
Answered on April 5, 2019 7:34 am