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)
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out