Downloads · 30 days
20
11% of all-time downloads
anthonym21/pinescript-v5-instructions-merged
pinescript-v5-instructions-merged is a text generation model from anthonym21. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A fine-tuned CodeGemma 7B model specialized in generating TradingView PineScript v5 code for trading indicators, strategies, and libraries.
Downloads · 30 days
20
11% of all-time downloads
All-time downloads
175
Public
Parameters
8.5B
17.1 GB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors17.1 GB · 100%
From the Hugging Face model README
A fine-tuned CodeGemma 7B model specialized in generating TradingView PineScript v5 code for trading indicators, strategies, and libraries.
This model was fine-tuned on 5,000+ PineScript v5 examples from the PineScripts-Permissive dataset, which contains high-quality, permissively-licensed scripts from TradingView.
Generate PineScript v5 code for:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "anthonym21/pinescript-v5-instructions-merged"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
def generate_pinescript(prompt, max_tokens=1024):
formatted = f"### Human: {prompt}\n### Assistant:"
inputs = tokenizer(formatted, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=max_tokens,
temperature=0.7,
top_p=0.9,
do_sample=True,
pad_token_id=tokenizer.eos_token_id,
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response.split("### Assistant:")[-1].strip()
# Example
code = generate_pinescript("Write a PineScript v5 RSI indicator with overbought/oversold zones")
print(code)
| Prompt | Description |
|---|---|
| "Write a PineScript v5 indicator that shows RSI with dynamic overbought/oversold levels" | RSI with adaptive levels |
| "Create a MACD crossover strategy with stop loss and take profit" | Complete trading strategy |
| "Write a Bollinger Bands indicator with squeeze detection" | Volatility indicator |
| "Create a multi-timeframe moving average indicator" | MTF analysis tool |
| Parameter | Value |
|---|---|
| Epochs | 3 |
| Batch Size | 2 |
| Gradient Accumulation | 8 |
| Learning Rate | 2e-4 |
| LoRA r | 64 |
| LoRA alpha | 128 |
| Max Seq Length | 4096 |
| Quantization | 4-bit (nf4) |
Training data sourced from mrmegatelo/PineScripts-Permissive:
@misc{pinescript-v5-instructions-merged,
author = {Anthony Maio},
title = {PineScript v5 Code Generator},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/anthonym21/pinescript-v5-instructions-merged}
}
Apache 2.0 (same as base model)