Simplify Pine Script Signal Logic
Budget / Salary$250–750
TypeFreelance project
LocationRemote
Posted1 hour ago
I’m building a TradingView strategy in Pine Script v6 to generate clean long- and short-side signals on the S&P 500 futures contract. The calculations for my indicators are already in place, but the decision layer has grown into several levels of nested if/else blocks inside a for-loop, making the script hard to read, slow, and occasionally unpredictable.
Your task is to refactor this section so the logic is both readable and efficient while preserving every numerical output the script currently produces. Please streamline the conditional structure, keep loops only where they truly add value, and comment each step so I can follow the flow and tweak parameters later.
Specific issues to address:
1) The "if" statement based on a calculated slope is not working as it should.
2) The "for" loops seem to be executing beyond their intended range.
3) The strategy entry is generating a buy order on every bar.
Additionally, I am looking for someone who will focus on fixing these specific issues without rewriting my entire logic. These challenges stem from adapting Fortran-based coding principles to Pine Script.
Deliverables:
• Revised .pine file written in Pine Script v6
• Clear in-code comments explaining each conditional branch and loop
• A short note outlining what was changed and why
Acceptance criteria:
The updated script must compile and run on TradingView without errors, plot the same values as the original on “ES1!” continuous futures data, trigger a single alert per entry/exit, and avoid repainting.
Once you’re comfortable with the scope, I’ll share the current code so you can get started right away.
Your task is to refactor this section so the logic is both readable and efficient while preserving every numerical output the script currently produces. Please streamline the conditional structure, keep loops only where they truly add value, and comment each step so I can follow the flow and tweak parameters later.
Specific issues to address:
1) The "if" statement based on a calculated slope is not working as it should.
2) The "for" loops seem to be executing beyond their intended range.
3) The strategy entry is generating a buy order on every bar.
Additionally, I am looking for someone who will focus on fixing these specific issues without rewriting my entire logic. These challenges stem from adapting Fortran-based coding principles to Pine Script.
Deliverables:
• Revised .pine file written in Pine Script v6
• Clear in-code comments explaining each conditional branch and loop
• A short note outlining what was changed and why
Acceptance criteria:
The updated script must compile and run on TradingView without errors, plot the same values as the original on “ES1!” continuous futures data, trigger a single alert per entry/exit, and avoid repainting.
Once you’re comfortable with the scope, I’ll share the current code so you can get started right away.
Apply on Freelancer →
Project sourced from Freelancer.com. Applications happen directly on the original platform — we never collect your data.