MakisMooz

[PineScript] How to Select Color with ? Operator [MakisMooz]

Color Selection Depending On Two Variables Values

Detailed info inside script.

Happy Trading
Life is Art and Art is Life

Follow me to get updates of my tips.

public tradingview pinescripts
https://docs.google.com/document/d/1gGbuHY2ioHLNPQ_JYrWXzR0QNq9U7IBAL8PVcYYLnnE/edit#heading=h.33htkqwpn57j
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
// [PineScript] How to Select Color with ? Operator [MakisMooz]
// Color Selection Depending on two Variables Values
// @MakisMooz
// created  1444316545723 (miliseconds)
// updated  1444316545723 (miliseconds)
// v.1.0.1

// HOW TO USE
// Add to Favorite Scripts
// Inside chart window right-click
// Select Insert Indicator => Favorites => Script Name
// Click Format Chart icon
// Click Format gray icon next to script name
// Select Inputs Tab
// Change values a, b
// if a == 1 =>             color = lime
// if a != 1 and b == 2 =>  color = red
// if a != 1 and b != 2 =>  color = yellow
//
// TIP
// Inside Popup Window
// You can see color change if you
// click up or down arrows to change value or
// click inside other input box or
// click somewhere in the popup window
// Move window to see color change
//
// [MakisMooZ] public tradingview pinescripts
// https://docs.google.com/document/d/1gGbuHY2ioHLNPQ_JYrWXzR0QNq9U7IBAL8PVcYYLnnE/edit#heading=h.33htkqwpn57j
// follow me to get updates of my tips
//
// Happy Trading
// Life is Art and Art is Life
//
// (C) Oct 2015 Rights Free for Educational Use

study('[PineScript] How to Select Color with ? Operator [MakisMooz]', overlay=false)
a = input(2, title='a (lime => a=1)', type=integer)
b = input(1, title='b (red => b=2 and a !=1)', type=integer)
c = input(10, title='other (yellow a !=1 and b=!2)', type=integer)
c1 = a==1 ? lime : b==2 ? red : yellow // color
plot(close, color=c1)
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out