How is Lipi different from other Platform Languages
Lipi is a DSL on Golang while other platforms use their own language or DSL. For example, a popular platform uses Pinescript which is a DSL on some other native computer language such as Python. So fundamentally these scripting languages are different from each other in many aspects. While syntactically Lipi may be drawing some inspiration from Pinescript, they are semantically very different and blindly copy pasting Pinescripts on Lipi Editor may not give you the desired results always. So it is essential to understand the differences and the Lipi Manual is built to help you bridge that gap.
Having said that there are few broad samples of differences that you must keep in mind when trying to convert a Pine open source script into Lipi.
- Lipi uses syntax similar to Javascript, curly braces () are necessary for scoping.
- Types are very important in Lipi. You always need to declare a type that a function parameter accepts, dynamic type is not allowed.
- Lipi uses opacity as second parameter in color.new() function whose value ranges from 0.0 (transparent) to 1.0 (opaque).
- talib is the technical analysis library that Lipi uses such as talib.sma(close,10). It provides many builtin calculations to help you build your desired indicator.
- Lipi uses static keyword to declare a variable that will be initialised only once and intra to declare a variable that will be initialised only once per bar and reinitialised on the next bar.
- interval is the library used for all interval/timeframe related variables and functions.
There will be more differences that you must check from time to time as we evolve Lipi into the most powerful scripting language on the internet.
Finally, a reminder that if you are using an open source script from another platform, we would highly encourage you to check the License category in the source platform such as MIT, Apache etc. We would also recommend you to kindly attribute the source platform from which you have ported your script. An example is given below
// LipiScript conversion of the [Ehlers Adaptive Cyber Cycle Indicator]
// Original Pine Script by [Lazybear]
// Source: [https://www.tradingview.com/script/3lV1e3ci-Ehlers-Adaptive-Cyber-Cycle-Indicator-LazyBear/]
// License: [MIT]
// Disclaimer: This script is for educational purposes only and does not constitute financial advice. Use at your own risk.