3

can you help solve this problem ?! I have a strategy and it works well, the problem is that I added some additional input source to it (it is plot from a study script.)

type = input.source

and when I want to alert it, I receive" this message, "Stop - Error calculating ", :( what should I do? :raised_hands: :pray:

answer: the problem was related to tradingview, they are trying to solve this issue.

Armin
  • 33
  • 8

2 Answers2

0

I just fixed the same issue by deleting the belowing code:

while MASource[i]>=MA[i] 
    i+=1
    if MASource[i]>MASource[i+1]
        coqrc+=1

Seems like a while loop issue.. I have this while loop to find out number of candles that close uppon a MA line,from right to left,with beginning of current close. But the strategy works locally same as yours.

payway
  • 3
  • 1
0

Solved a "Stop - Calculating Error" on a pinescript alert by converting a static variable into a mutable variable.

To quote from Pinescript manual, Expressions, declarations and statements section:

"A mutable variable is a variable which can be given a new value. The operator := must be used to give a new value to a variable. A variable must be declared before you can assign a value to it (see declaration of variables above).

The type of a variable is identified at declaration time. From then on, a variable can be given a value of expression only if both the expression and the variable belong to the same type, otherwise a compilation error will occur."

The Calculating error maybe a Compilation error because the alert function is being passed a 'changing' fix variable.