Strange compile error

Questions about MultiCharts and user contributed studies.
Squib
Posts: 17
Joined: 25 Nov 2011
Has thanked: 19 times
Been thanked: 6 times

Strange compile error

Postby Squib » 02 Jan 2012

Again a question...

When I try to compile this simple function...

Code: Select all

input:
PositionTP(NumericSimple),
PositionSize(NumericSimple);

if close >=PositionTP and PositionSize>0 then
begin
sell PositionSize contracts next bar at market;
end;
...I get following strange compiler error:
02.01.12 23:15:59
------ Build started: ------
Study: "wgfs_TestFunction" (Function)
Please wait ....
------ Compiled with error(s): ------
is not applicable to this type of study
errLine 0, errColumn 0, errLineEnd 0, errColumnEnd 0
causal study: (Function)
Keyword "Plot**" can't been used in this type of study
errLine 0, errColumn 0, errLineEnd 0, errColumnEnd 0
causal study: (Function)
I don't understand this at all.
Why Line 0 / Column 0?
Why "Plot**"? I don't use Plot in this function...
Can anybody help?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Strange compile error

Postby TJ » 02 Jan 2012

Again a question...

When I try to compile this simple function...

Code: Select all

input:
PositionTP(NumericSimple),
PositionSize(NumericSimple);

if close >=PositionTP and PositionSize>0 then
begin
sell PositionSize contracts next bar at market;
end;
...I get following strange compiler error:
02.01.12 23:15:59
------ Build started: ------
Study: "wgfs_TestFunction" (Function)
Please wait ....
------ Compiled with error(s): ------
is not applicable to this type of study
errLine 0, errColumn 0, errLineEnd 0, errColumnEnd 0
causal study: (Function)
Keyword "Plot**" can't been used in this type of study
errLine 0, errColumn 0, errLineEnd 0, errColumnEnd 0
causal study: (Function)
I don't understand this at all.
Why Line 0 / Column 0?
Why "Plot**"? I don't use Plot in this function...
Can anybody help?
actually it should read:
Keyword "Sell" can't been used in this type of study

Squib
Posts: 17
Joined: 25 Nov 2011
Has thanked: 19 times
Been thanked: 6 times

Re: Strange compile error

Postby Squib » 02 Jan 2012

actually it should read:
Keyword "Sell" can't been used in this type of study
This would make more sense. If I disable the line with the "sell"-instruction, the error disappears.
But why isn't it possible to code a function, which checks a take-profit and in case it is reached, closes the open long position?

Is it only possible to use "Sell" in signals?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Strange compile error

Postby TJ » 02 Jan 2012

actually it should read:
Keyword "Sell" can't been used in this type of study
This would make more sense. If I disable the line with the "sell"-instruction, the error disappears.
But why isn't it possible to code a function, which checks a take-profit and in case it is reached, closes the open long position?

Is it only possible to use "Sell" in signals?
Order related keywords can only be applied to signals.


For Function explanations, see

EasyLanguage Essentials Programmers Guide
Language Elements
EasyLanguage Functions.... pg. 35


Return to “MultiCharts”