Error creating a function  [SOLVED]

Questions about MultiCharts and user contributed studies.
Gary_MC
Posts: 7
Joined: 21 Dec 2021

Error creating a function

Postby Gary_MC » 21 Dec 2021

Hi,
I've just started using MultiCharts, after having access to TS for a little bit and there is a function in TS EasyLanguage that is associated with a strategy that TS have built in one of their paid learning classes.
I've tried to copy the function into PowerLanguage but I get an error that reads "assignment is allowed only for variables or array elements". This error refers to the very last line of the below code and I'm not sure what I need to do to fix this......... As an FYI coding is very new to me and I do not know what an array element is.

If anyone is able to please assist in getting this function working it would be much appreciated.

Code: Select all

Vars: int CurrentMonth(0), int TestDate(0), int StartingDate(0), int DaysLeftInMonth(0), int LoopCounter(0); If Month(Date) <> Month(Date[1]) then begin CurrentMonth = Month(Date); DaysLeftInMonth = 0; LoopCounter = 0; StartingDate = Date; TestDate = StartingDate; While Month(TestDate) = CurrentMonth begin TestDate = CalcDate(StartingDate,LoopCounter); If DayofWeek(TestDate) >= 1 and DayofWeek(TestDate) <= 5 then DaysLeftInMonth += 1; LoopCounter += 1; end; DaysLeftInMonth -= 1; end else begin DaysLeftInMonth -= 1; end; LWDaysLeftInTheMonth = DaysLeftInMonth;

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

Re: Error creating a function

Postby TJ » 22 Dec 2021

What name did you use for this function?

Gary_MC
Posts: 7
Joined: 21 Dec 2021

Re: Error creating a function  [SOLVED]

Postby Gary_MC » 22 Dec 2021

Thanks TJ,

You prompted an aha moment.

Problem sorted, it was a naming mismatch!


Return to “MultiCharts”