TradingView
Cambo_Guru
6 apr 2022 03:07

Simple Calculator 

NZD/USDCapital.com

Descrizione

For all those who don't want to pull out the calculator
Commenti
farhatizakaria
Thanks buddy <3 but how can I use it?
Cambo_Guru
@farhatizakaria, You can input the numbers and operation in the settings of the indicator!
MarcosEmmiMFP
nice, It would be interesting to add average prices to know what the average price of 2 or more purchases is.
I have the formula but I have a hard time applying it with pine script v5
Cambo_Guru
@MarcosEmmiMFP, try this

// Replace the Operators variable with this:
operator = input.string(defval = "+", title = "Operators", options=["+","-","x","÷","x^y","AVG(x,y)"], group = "Calculate:")

// add this to the if else argument:
else if operator == "AVG(x,y)"
cal := (Num1 + Num2) / 2
result := "Average of (" + str.tostring(Num1) + ", " + str.tostring(Num2) + ")" + " = " + str.tostring(cal)
Altro