♥ 0 |
Hello again and hopefully just 1 more question. I was trying to get this to work but I’m assuming you can’t have more than 2 conditions? when I Plot value = “…” is when i run into errors Here is the code: def LongTK = Ichimoku(“tenkan period” = 18, “kijun period” = 52).”Tenkan” is greater than Ichimoku(“tenkan period” = 18, “kijun period” = 52).”Kijun”; def ShortTK = Ichimoku(“tenkan period” = 18, “kijun period” = 52).”Tenkan” is less than Ichimoku(“tenkan period” = 18, “kijun period” = 52).”Kijun”; def LongX = Ichimoku(“tenkan period” = 18, “kijun period” = 52).”Tenkan” crosses above Ichimoku(“tenkan period” = 18, “kijun period” = 52).”Kijun”; Def ShortX = Ichimoku(“tenkan period” = 18, “kijun period” = 52).”Tenkan” crosses below Ichimoku(“tenkan period” = 18, “kijun period” = 52).”Kijun”;
Thanks again
Marked as spam
|
Private answer
def LongTK = Ichimoku("tenkan period" = 18, "kijun period" = 52)."Tenkan" is greater than Ichimoku("tenkan period" = 18, "kijun period" = 52)."Kijun"; def ShortTK = Ichimoku("tenkan period" = 18, "kijun period" = 52)."Tenkan" is less than Ichimoku("tenkan period" = 18, "kijun period" = 52)."Kijun"; def LongX = Ichimoku("tenkan period" = 18, "kijun period" = 52)."Tenkan" crosses above Ichimoku("tenkan period" = 18, "kijun period" = 52)."Kijun"; Def ShortX = Ichimoku("tenkan period" = 18, "kijun period" = 52)."Tenkan" crosses below Ichimoku("tenkan period" = 18, "kijun period" = 52)."Kijun"; plot value = if longTK then 1 else if longTK and longX then -1 else if shortTK then 2 else if shortTK and shortX then -2 else 0 ; AssignBackgroundColor(if value == 1 then color.DARK_GREEN else if value == -1 then(createColor(0,3,171)) else if value == 2 then color.DARK_RED else if value == -2 then(createColor(0,2,94)) else color.BLACK ); Marked as spam
|
|||||
Private answer
If I understand correctly what you mean by "...more than 2 conditions..." is actually "more than two plot statements". If that is correct, then the answer is no. Each custom quote column can only have a single plot statement. This has actually already been posted before: https://www.hahn-tech.com/ans/plots-exactly-one-plot-expected-error/ However if I am not understanding you correctly then you will need to provide a bit more detail. It seems logical that if you truly wanted to combine two conditions into a single plot statement you would have already tried:
So I am pretty sure I have covered both potential scenarios. But maybe I will be surprised and you have something completely different in mind. You can also use the AddLabel() statement to display a custom text value in the column instead of numerical values. TONS of examples of that already in this forum. Oh, I also wanted to mention that I see you were using the Condition Wizard to build your code. Nice work. Just wanted to provide a link for the rest of our viewers so they can get up to speed on how to use this amazing tool: https://www.hahn-tech.com/thinkorswim-condition-wizard-watchlist/
Marked as spam
|
Please log in to post questions.