What changes do I have to make to compile this?

Questions about MultiCharts and user contributed studies.
Allan Pang
Posts: 7
Joined: 25 Aug 2007

What changes do I have to make to compile this?

Postby Allan Pang » 28 Sep 2007

Hi

I'm hoping someone here is kind enough to help me get this bit of TS code to work on MC. I'm not a programmer and actually thought TS code is fully compatible with MC.

Thanks in advance

=========================

[LegacyColorValue = true];


{ _SHME_Dynamic_SR - draw dynamic s/rlines for the period - periods auto calculated }


{Programmer: Avery T. Horton, Jr. aka TheRumpledOne}

inputs:


iMode("No"), { if "auto" code sets xPeriods, if not "auto" code uses iPeriods}

iPeriods(05),
HighColor( red),
LowColor( blue) ;

variables:

xPeriods(60),
xInterval(0),
sFirstPass(true),
HavePrevLines( false ),
TLHigh( 0 ),
TLLow( 0 ),
PushHigh( 0 ),
PushLow( 0 ),
OldPushHigh( 0 ),
OldPushLow( 0 ),
PrevPushHigh( 0 ),
PrevPushLow( 0 ) ;


{first time through}

if sFirstPass
then begin

sFirstPass = false;

{bar test}

If bartype = 4
then xInterval = 94
else
If bartype = 3
then xInterval = 93
else
If bartype = 2
then xInterval = 92
else
If bartype = 1
then begin
xInterval = BarInterval;
end; { If bartype = 1 }

{mode test}

If iMode <> "Auto" and iMode <> "auto" and iMode <> "AUTO"
then xPeriods = iPeriods
else xPeriods = _fPushPeriods(xInterval);

end; {if sFirstPass}

{save old values}

If PushHigh <> PrevPushHigh
then OldPushHigh = PrevPushHigh;

If PushLow <> PrevPushLow
then OldPushLow = PrevPushLow ;

OldPushHigh = PrevPushHigh ;
OldPushLow = PrevPushLow ;

PrevPushHigh = PushHigh ;
PrevPushLow = PushLow ;

{ high / low for period }

PushHigh = Highest( H, xPeriods);
PushLow = Lowest( L, xPeriods) ;

If PushHigh <> H
and PushHigh < PrevPushHigh
then PushHigh = PrevPushHigh;

If PushLow <> L
and PushLow > PrevPushLow
then PushLow = PrevPushLow;

plot1(PushLow, "PushLow", LowColor);

plot2(PushHigh, "PushHigh", HighColor);

==================================

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Postby ABC » 28 Sep 2007

Allan,
it seems that you are missing the function "_fPushPeriods", that's why you are getting a compiler error. Commenting this out makes the code compile without problems.

Regards,

ABC

dougm_tx
Posts: 16
Joined: 15 Aug 2006

Postby dougm_tx » 28 Sep 2007

here is the function

Code: Select all

{ _fPushPeriods }

inputs:

iInterval(numericsimple );

variables:

xPeriods(60);


{ calculations }


If iInterval < 5
then xPeriods = 60
else
If iInterval < 10
then xPeriods = 45
else
If iInterval = 10
then xPeriods = 6
else
If iInterval = 15
then xPeriods = 12
else
If iInterval = 30
then xPeriods = 4
else
If iInterval = 60
then xPeriods = 6
else
If iInterval > 60
then xPeriods = 10;

_fPushPeriods = xPeriods;

Allan Pang
Posts: 7
Joined: 25 Aug 2007

Postby Allan Pang » 28 Sep 2007

Thanks doug, abc... but it's still not compiling and it stops at iMode("No"). Also, do i have your suggested changes in the correct locations? Please see below:

========================
[LegacyColorValue = true];


{ _SHME_Dynamic_SR - draw dynamic s/rlines for the period - periods auto calculated }


{Programmer: Avery T. Horton, Jr. aka TheRumpledOne}

{ _fPushPeriods }

inputs:


iMode("No"), { if "auto" code sets xPeriods, if not "auto" code uses iPeriods}

iPeriods(05),
HighColor( red),
LowColor( blue) ;

variables:

xPeriods(60),
xInterval(0),
sFirstPass(true),
HavePrevLines( false ),
TLHigh( 0 ),
TLLow( 0 ),
PushHigh( 0 ),
PushLow( 0 ),
OldPushHigh( 0 ),
OldPushLow( 0 ),
PrevPushHigh( 0 ),
PrevPushLow( 0 ) ;


{first time through}

if sFirstPass
then begin

sFirstPass = false;

{bar test}

If bartype = 4
then xInterval = 94
else
If bartype = 3
then xInterval = 93
else
If bartype = 2
then xInterval = 92
else
If bartype = 1
then begin
xInterval = BarInterval;
end; { If bartype = 1 }

_fPushPeriods = xPeriods;

{mode test}

If iMode <> "Auto" and iMode <> "auto" and iMode <> "AUTO"
then xPeriods = iPeriods
else xPeriods = _fPushPeriods(xInterval);

end; {if sFirstPass}

{save old values}

If PushHigh <> PrevPushHigh
then OldPushHigh = PrevPushHigh;

If PushLow <> PrevPushLow
then OldPushLow = PrevPushLow ;

OldPushHigh = PrevPushHigh ;
OldPushLow = PrevPushLow ;

PrevPushHigh = PushHigh ;
PrevPushLow = PushLow ;

{ high / low for period }

PushHigh = Highest( H, xPeriods);
PushLow = Lowest( L, xPeriods) ;

If PushHigh <> H
and PushHigh < PrevPushHigh
then PushHigh = PrevPushHigh;

If PushLow <> L
and PushLow > PrevPushLow
then PushLow = PrevPushLow;

plot1(PushLow, "PushLow", LowColor);

plot2(PushHigh, "PushHigh", HighColor);

_fPushPeriods = xPeriods;

==============================

dougm_tx
Posts: 16
Joined: 15 Aug 2006

Postby dougm_tx » 28 Sep 2007

Allan,

You need to compile the function separately (or convert to inline).

Seemed to me the quickest fix is to just attach all of TRO's showme's in an ELD that you can just import.

The one you were trying is included as well as many others.
Attachments
TROS SHOWME.ELD
(97.49 KiB) Downloaded 407 times

Allan Pang
Posts: 7
Joined: 25 Aug 2007

Postby Allan Pang » 29 Sep 2007

Thanks Doug.

It's clear I have much to learn to understand what you have advised here. I need to read up (if there is supporting documentation on MC) before I can get this running.

svifx
Posts: 7
Joined: 18 Aug 2007

Compiling TS ELD on multicharts

Postby svifx » 01 Oct 2007

Hi allan,

basically if you get this error :
------ Compiled with error(s): ------
Types are not compatible
errLine -1, errColumn -1, errLineEnd -1, errColumnEnd -1


you need to comment out the part for Radarscreen, mostly transform :
if xAppType = 2
then begin
.....
end;
----------------------
{
if xAppType = 2
then begin
.....
end;
}
----------------------
or delete the section...

Some ELDS are only for Radarscreen and do not check type you have to
look at the plot(statements) or read the manual if there's one...

regards


Return to “MultiCharts”