Hi everyone!
I am trying to put a score for every green/bullish on my indicator namely, MA20, MA50 and MA200.
I am getting a score if the value is not null but, if it is null, I am getting a blank score.
Any help would be appreciated.
Thank you!
//
// Code is not originally mine
// Credits goes to the original uploader/coder
//
i=0;
//Longterm Bullish or Bearish
Bull = C > MA(C,200);
Bear= C < MA(C,200);
IIf(Bull,i+1,i);
lt_status= WriteIf(Bull, "Bullish", WriteIf(Bear, "Bearish", "Neutral"));
lt_Col=IIf(Bull, colorGreen, IIf(bear, colorRed, colorLightGrey));
//Midterm Bullish or Bearish
mBull = C > MA(C,50);
mBear= C < MA(C,50);
IIf(mBull,i+1,i);
mt_status= WriteIf(mBull, "Bullish", WriteIf(mBear, "Bearish", "Neutral"));
mt_Col=IIf(mBull, colorGreen, IIf(mbear, colorRed, colorLightGrey));
//Shortterm Bullish or Bearish
sBull = C > MA(C,20);
sBear= C < MA(C,20);
IIf(sBull,i+1,i);
st_status= WriteIf(sBull, "Bullish", WriteIf(sBear, "Bearish", "Neutral"));
st_Col=IIf(sBull, colorGreen, IIf(sbear, colorRed, colorLightGrey));
TrendScore=
IIf(Bull,1,0)+
IIf(mBull,1,0)+
IIf(sBull,1,0);
Filter = 1;
AddTextColumn(st_status, "Short-term", 1, colorWhite, st_Col);
AddTextColumn(mt_status, "Medium-term", 1, colorWhite, mt_Col);
AddTextColumn(lt_status, "Long-term", 1, colorWhite, lt_Col);
AddColumn(TrendScore,"Score",1.0);