Red or Green on chop index


0
0

Pete

I use a chop index for my trading…I would be great to know the stocks that are below 38.2 for the ones That I want to trade….Would it be possible for a watch list column to be green if below 38.2 and red for anything above that…

 

Thanks

 

declare lower;
# Inputs: Len(13);
input Len = 14;
input CIx = {default CI3, CI2};
#Plot1(100 * Log(Summation(TrueRange,Len)/(Highest(C[1],Len) – Lowest(C[1],Len))/Log(Len)), “CI2”);
def CI2 = 100 * log( Sum( TrueRange(high,close,low),Len)
) / ( Highest(close[1],Len) – Lowest(close[1],Len))
/ log(Len);
def CI3 = ( ( log(Sum(TrueRange(high,close,low),Len) /
(
Highest(if high >= close[1] then high else
close[1],Len) –
Lowest( if low <= close[1] then low else close[1],Len)
)
) / log(10)
) / (log(Len)/log(10))
) * 100;
plot CI = if CIx == CIx.CI3 then CI3 else CI2;
CI.AssignValueColor( Color.YELLOW);
# Plot2(60,”60Li”);
plot line60 = 61.8;
line60.AssignValueColor(Color.White);
# Plot3(35,”35Li”);
plot line35 = 38.2;
line35.AssignValueColor(Color.White);

Marked as spam
Posted by (Questions: 27, Answers: 20)
Asked on July 14, 2019 11:39 am
24 views
Matches on mine perfectly. Have you checked your chart settings? https://www.hahn-tech.com/ans/hourly-watchlist-indicator-issue/
( at July 16, 2019 2:07 pm)
0
Private answer

Yes, very simple. You need to remove the plots for 61.8 and 38.2 (which means you delete the last 6 lines of code) and then add the following line to the bottom of the remaining code:

AssignBackgroundColor(if CI < 38.2 then Color.GREEN else Color.RED);

Screenshot below shows the result.

Attachments:
Marked as spam
Posted by (Questions: 36, Answers: 1978)
Answered on July 14, 2019 4:03 pm
Pete For some reason the numbers are not the on the between watch list and chart....Hope you can help
( at July 16, 2019 6:10 pm)
You didn't see my response to your previous comment??? Here it is again: "Matches on mine perfectly. Have you checked your chart settings? https://www.hahn-tech.com/ans/hourly-watchlist-indicator-issue/"
( at July 16, 2019 6:16 pm)
Got it
( at July 17, 2019 9:53 am)