简体   繁体   中英

Pinescript: Combining two indicators

Code and error message found here:

So i'm trying to combine two indicators into one so I may use conditional statement to make trades. But i'm getting this error message. Could it be because the source is defined differently for the two different indicators? is there a way to make it work while being defined differently?

At the very beginning you have:

source = hlc3

First of all, source is a build-in variable in pine-script and you shouldn't name your variables after build-in variables. Second, hlc3 is a series type.

Later you have: src = input(title="Source", type=source, defval=close)

type parameter of the input function can only be one of: bool , integer , float , string , symbol , resolution , session , source . When you say type=source , it tries to use your variable, instead of using the build-in variable.

This is what the error message is telling you:

Cannot call input with arguments (title=literal string, type=series , defval=series); available overloads: input(const bool, const string, const string, bool, const string) => bool; input(const integer, const string, const string, integer, integer, bool, integer, [const integer...], const string) => integer; input(const float, const string, const string, float, float, bool, float, [const float...], const string) => float; input(const string, const string, const string, bool, [const string...], const string) => string; input(series, const string, const string, const string) => series

You should rename your source variable.

Unfortunately modules/libraries are not yet supported in PineScript. So all you have to do is to rename 'source' variable in one of your scripts to say 'source2'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM