Function Question

Questions about MultiCharts and user contributed studies.
Tradewithme
Posts: 1
Joined: 16 Aug 2011

Function Question

Postby Tradewithme » 19 Aug 2011

Hello, I like to insert a function from EL to PL and get an error message. The function is to count the daily entries and get called by a strategy.
Can you help?

The function is:

Code: Select all

Inputs: Date(NumericSimple);
Variables: Loop(0), Count(0);
Count = 0;
For Loop = 0 To 10 Begin
If EntryDate(Loop) = Date and (MarketPosition(Loop) = 1 or MarketPosition = -1) Then
Count = Count + 1;
End;
------ Compiled with error(s): ------
this word has already been defined
errLine 3, errColumn 8, errLineEnd 3, errColumnEnd 12
causal study: (Function)

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Function Question

Postby bowlesj3 » 19 Aug 2011

Hi Tradewithme,

Date is a reserve word for the bar's date. I have never tried but I do not think you can use it as the name for an input. Try replacing all reference to Date with MyDate.

John.

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Function Question

Postby Dave Masalov » 25 Aug 2011

Tradewithme,

John is right. Please do not use reserved words as the names of the inputs. Renaming the inputs should fix the issue.


Return to “MultiCharts”