Functions
Define reusable functions with function, and custom indicators with indicator.
Parameters are type name (use type[] for an array); return hands back a value.
function float midpoint(float h, float l) {
return (h + l) / 2;
}
indicator float hl2(float h, float l) {
return (h + l) / 2;
}
onTick {
float m = midpoint(High(nifty, M5, 0), Low(nifty, M5, 0));
}Ready to run this? Build and backtest strategies in the SutraLipi algo trading platform — no-code builder, tick-level backtesting and one-click live execution. Browse all documentation topics.