0

I´m new in programming on Pine Scritp and I´m doing a strategy for opening long and sell positions. I have defined my conditions to enter to the market, but when i call strategy funtion, it executes on the next bar instead the current one, so, the result is not always good, because the idea is to enter the market as soon as the condition meets. enter image description here

So, this is the normal behavior of Pine Script language or there is a way to implement the strategy in the current bar no matter this bar hasn´t finished?

Thanks in advance, Jorge.

2 Answers2

0

Your strategy will execute as soon as the condition is met (On real time bar).

For backtesting, if you don't have a premium account, the script (and so your strategy) will execute only when the bar closes.
Then your strategy will enter after the bar close (if your conditions are met) = on the beginning of the next bar.

G.Lebret
  • 2,826
  • 2
  • 16
  • 27
0

It seems you need to set calc_on_every_tick=true

Read about it here

Rotem
  • 2,306
  • 3
  • 26
  • 44