FAQ

How to Know if Your Current Bar is in a Certain Session

FAQ

How to Know if Your Current Bar is in a Certain Session

You may sometimes need to add some session logic to your TradingView strategies and indicators. This can be useful especially when you want to execute your entries only within a certain time window and close all positions when this window is over. Check Session Status  The first step is to check that the current bar How to Know if Your Current Bar is in a Certain Session Read More →

How to Know if Your Current Bar is in a Certain Session Read More »

How to Enter/Exit Positions on Bar Close in Pine Script Strategies

Order placement commands are quite important to your TradingView strategy. But many people are surprised by the default behavior of PineScript when it executes market orders. Sample Strategy  For an illustration, the Pine Script code below highlights a super simple strategy.  In this strategy, we enter and exit long positions using market orders. We also

How to Enter/Exit Positions on Bar Close in Pine Script Strategies Read More »

How to fix “Value with NA type cannot be assigned to a variable that was defined without type keyword.”

You can receive this error by running this simple code: Add to Chart operation failed, reason: line 5: Value with NA type cannot be assigned to a variable that was defined without type keyword The issue is that PineScript doesn’t know what type should this variable be. It can’t guess the type from the NA

How to fix “Value with NA type cannot be assigned to a variable that was defined without type keyword.” Read More »