Compiling Error with MultiCharts Version 7.0 Release (Build

Questions about MultiCharts and user contributed studies.
designer01
Posts: 80
Joined: 02 Feb 2010

Compiling Error with MultiCharts Version 7.0 Release (Build

Postby designer01 » 05 Nov 2011

When I compile the code in MultiCharts Version 7.0 Release (Build 4510) (see code below) I get this error...
Compile error
errLine 0, errColumn 0, errLineEnd 0, errColumnEnd 0
causal study: (Function)
I can compile the same code in Multicharts v6 successfully. Can you please explain what the problem may be?
Thanks

Code: Select all

inputs:
   NeckSwStrength( 2 ),
   HnSSwStrength( 2 ),
   VertProportionLimit( 0.33 ), { neckline tilt / max neck to head distance }
   HiLo( 1 ), { pass in 1 for H&S Top, -1 for H&S Bottom }
   ConfirmVolume( true ),
   DrawNeckline( true ), { if this is "false", no neckline will be drawn and no
    ShowMe's will be plotted }
   BarsPast( 10 ), { for a given H&S, a ShowMe is plotted only if the Close crosses
    it's neckline within BarsPast bars of H&S confirmation }
   Color1( Yellow ),
   Color2( Cyan ) , { Color1 and Color2 are used in an alternating fashion each time
    a new H&S is found; for a given H&S, the text labels, volume message, neckline,
    and ShowMe are all drawn in the same color }
    Length( 70 );

variables:
   BarNum( 0 ),
   NeckSwBar( 0 ),
   HnSSwBar( 0 ),
   NeckSwLength( NeckSwStrength + 1 ),
   HnSSwLength( HnSSwStrength + 1 ),
   NeckSwPrice( 0 ),
   HnSSwPrice( 0 ),
   HnSSwStrengthX2( HnSSwStrength * 2 ),
   HorOrder( false ),
   VertOrder_HvsS( false ),
   VertOrder_NvsS( false ),
   NecklineLimit( 0 ),
   MaxNeckToHeadDist( 0 ),
   NecklineTilt( 0 ),
   VertProportion( false ),
   Color( Color2 ),
   TextRef( -1 ),
   TLRef( -1 ),
   AvgVolFast( 0 ),
   Msg( "" ),
   ConfirmBarNum( 0 ),
   TL_Value( 0 ),
   LastCrossedTL( -1 ),
   CCIVal (0) ;
   
   
   CCIVal = CCI( Length ) ;

arrays:
   NeckSwings[ 1, 3 ]( 0 ),
   HnSSwings[ 2, 4 ]( 0 ) ;

BarNum = BarNumber ;

if HiLo = 1 then
   begin
   NeckSwBar = SwingLowBar( 1, CCIVal, NeckSwStrength, NeckSwLength ) ;
   HnSSwBar = SwingHighBar( 1, CCIVal, HnSSwStrength, HnSSwLength ) ;
   NeckSwPrice = CCIVal ;
   HnSSwPrice = CCIVal ;
   end
else if HiLo = -1 then
   begin
   NeckSwBar = SwingHighBar( 1, CCIVal, NeckSwStrength, NeckSwLength ) ;
   HnSSwBar = SwingLowBar( 1, CCIVal, HnSSwStrength, HnSSwLength ) ;
   NeckSwPrice = CCIVal ;
   HnSSwPrice = CCIVal ;
   end ;

if NeckSwBar = NeckSwStrength then
{ ie, if just confirmed NeckSwing }
   begin

   { push NeckSwings array back }
   NeckSwings[ 1, 0 ] = NeckSwings[ 0, 0 ] ;
   NeckSwings[ 1, 1 ] = NeckSwings[ 0, 1 ] ;
   NeckSwings[ 1, 2 ] = NeckSwings[ 0, 2 ] ;
   NeckSwings[ 1, 3 ] = NeckSwings[ 0, 3 ] ;

   { read in parameters of new NeckSwing into 0-elements of NeckSwings array }
   NeckSwings[ 0, 0 ] = BarNum[NeckSwStrength] ;
   NeckSwings[ 0, 1 ] = Date[NeckSwStrength] ;
   NeckSwings[ 0, 2 ] = Time[NeckSwStrength] ;
   NeckSwings[ 0, 3 ] = NeckSwPrice[NeckSwStrength] ;
   end ;

if HnSSwBar = HnSSwStrength then
{ ie, if just confirmed HnSSwing }
   begin

   { push HnSSwings array back }
   for Value1 = 1 downto 0
      begin
      HnSSwings[ Value1 + 1, 0 ] = HnSSwings[ Value1, 0 ] ;
      HnSSwings[ Value1 + 1, 1 ] = HnSSwings[ Value1, 1 ] ;
      HnSSwings[ Value1 + 1, 2 ] = HnSSwings[ Value1, 2 ] ;
      HnSSwings[ Value1 + 1, 3 ] = HnSSwings[ Value1, 3 ] ;
      HnSSwings[ Value1 + 1, 4 ] = HnSSwings[ Value1, 4 ] ;
      end ;

   { read in parameters of new HnSSwing into 0-elements of HnSSwings array }
   HnSSwings[ 0, 0 ] = BarNum[HnSSwStrength] ;
   HnSSwings[ 0, 1 ] = Date[HnSSwStrength] ;
   HnSSwings[ 0, 2 ] = Time[HnSSwStrength] ;
   HnSSwings[ 0, 3 ] = HnSSwPrice[HnSSwStrength] ;
   if BarType >= 2 and BarType < 5 then { not tick/minute data nor an advanced chart
     type (Kagi, Renko, Kase, etc.) }
      HnSSwings[ 0, 4 ] = Average( Volume, HnSSwStrengthX2 )
   else { if tick/minute data or an advanced chart type;  in the case of minute data,
 also set the "For volume, use:" field in the Format Symbol dialog to Trade Vol or
 Tick Count, as desired;  when using advanced chart types, Ticks returns volume if
 the chart is built from 1-tick interval data }
      HnSSwings[ 0, 4 ] = Average( Ticks, HnSSwStrengthX2 ) ;

   { evaluate conditions for H&S }
   HorOrder = HnSSwings[ 0, 0 ] > NeckSwings[ 0, 0 ]
    and NeckSwings[ 0, 0 ] > HnSSwings[ 1, 0 ]
    and HnSSwings[ 1, 0 ] > NeckSwings[ 1, 0 ]
    and NeckSwings[ 1, 0 ] > HnSSwings[ 2, 0 ] ;
   if HiLo = 1 then
      begin
      VertOrder_HvsS = HnSSwings[ 1, 3 ] > HnSSwings[ 2, 3 ]
       and HnSSwings[ 1, 3 ] > HnSSwings[ 0, 3 ] ;
      VertOrder_NvsS = NeckSwings[0, 3] < HnSSwings[2, 3]
       and NeckSwings[ 1, 3 ] < HnSSwings[ 0, 3 ] ;
      NecklineLimit = MinList( NeckSwings[ 0, 3 ],  NeckSwings[ 1, 3 ] ) ;
      MaxNeckToHeadDist = HnSSwings[ 1, 3 ] - NecklineLimit ;
      end
   else if HiLo = -1 then
      begin
      VertOrder_HvsS = HnSSwings[ 1, 3 ] < HnSSwings[ 2, 3 ]
       and HnSSwings[ 1, 3 ] < HnSSwings[ 0, 3 ] ;
      VertOrder_NvsS = NeckSwings[0, 3] > HnSSwings[2, 3]
       and NeckSwings[ 1, 3 ] > HnSSwings[ 0, 3 ] ;
      NecklineLimit = MaxList( NeckSwings[ 0, 3 ],  NeckSwings[ 1, 3 ] ) ;
      MaxNeckToHeadDist = NecklineLimit - HnSSwings[ 1, 3 ] ;
      end ;
   NecklineTilt = AbsValue( NeckSwings[ 0, 3 ] - NeckSwings[ 1, 3 ] ) ;
   if MaxNeckToHeadDist <> 0 then
      VertProportion = NecklineTilt / MaxNeckToHeadDist < VertProportionLimit
   else
      VertProportion = false ;

   { if have H&S, then process further }
   if HorOrder and VertOrder_HvsS and VertOrder_NvsS and VertProportion then
      begin

      { switch to alternate color }
      if Color = Color2 then
         Color = Color1
      else
         Color = Color2 ;

      { insert Head and Shoulder text labels, and set their colors/styles }
      TextRef = Text_New( HnSSwings[ 0, 1 ], HnSSwings[ 0, 2 ], HnSSwings[ 0, 3 ],
       "SH" ) ;
      Text_SetColor( TextRef, Color ) ;
      Text_SetStyle( TextRef, 2, 0 ) ;
      TextRef = Text_New( HnSSwings[ 1, 1 ], HnSSwings[ 1, 2 ], HnSSwings[ 1, 3 ],
       "HD" ) ;
      Text_SetColor( TextRef, Color ) ;
      Text_SetStyle( TextRef, 2, 0 ) ;
      TextRef = Text_New( HnSSwings[ 2, 1 ], HnSSwings[ 2, 2 ], HnSSwings[ 2, 3 ],
       "SH" ) ;
      Text_SetColor( TextRef, Color ) ;
      Text_SetStyle( TextRef, 2, 0 ) ;

      if ConfirmVolume then
         { check if have volume confirmation, insert appropriate text message, and
           set it's color/style }
         begin
         if BarType >= 2 and BarType < 5 then { not tick/minute data nor an
          advanced chart type (Kagi, Renko, Kase, etc.) }
            AvgVolFast = Average( Volume, HnSSwStrength )
         else { if tick/minute data or an advanced chart type;  in the case of minute data,
           also set the "For volume, use:" field in the Format Symbol dialog to Trade Vol or
           Tick Count, as desired;  when using advanced chart types, Ticks returns volume if
           the chart is built from 1-tick interval data }
            AvgVolFast = Average( Ticks, HnSSwStrength ) ;
         if AvgVolFast > HnSSwings[ 0, 4 ] and AvgVolFast >  HnSSwings[ 2, 4 ] then
         { comparing AvgVolFast at end of current shoulder to "AvgVolSlow" at end
           of current shoulder and "AvgVolSlow" at end of first shoulder }
            Msg = "Volume confirm"
         else
            Msg = "Vol non-confirm" ;
         TextRef = Text_New( NeckSwings[ 1, 1 ], NeckSwings[ 1, 2 ], NecklineLimit,
          Msg ) ;
         Text_SetColor( TextRef, Color ) ;
         Text_SetStyle( TextRef, 0, 1 ) ;
         end ;

      if DrawNeckline then
         { draw neckline, set it's extents/color, and save current bar number, ie,
           bar number at which the H&S was confirmed }
         begin
         TLRef = TL_New( NeckSwings[ 1, 1 ], NeckSwings[ 1, 2 ], NeckSwings[ 1, 3 ],
          NeckSwings[ 0, 1 ], NeckSwings[ 0, 2 ], NeckSwings[ 0, 3 ] ) ;
         TL_SetExtLeft( TLRef, false ) ;
         TL_SetExtRight( TLRef, false ) ;
         TL_SetColor( TLRef, Color ) ;
         ConfirmBarNum = BarNum ;
         end ;
      end ;
   end ;

{ plot the ShowMe if the price is below/above the neckline at confirmation, else wait
  upto BarsPast bars for it to crosses under/over the neckline; note that ShowMe's
  will be plotted only if the DrawNeckline input is set to "true" }
if TLRef >= 0 and LastCrossedTL <> TLRef and BarNum - ConfirmBarNum <= BarsPast then
   begin
   TL_Value = TL_GetValue( TLRef, Date, Time ) ;
   if ( HiLo = 1 and Close < TL_Value ) or ( HiLo = -1 and Close > TL_Value ) then
      begin
      Plot1( NeckSwPrice, "H&S", Color ) ;
      Alert ;
      LastCrossedTL = TLRef ;
      end
   else
      NoPlot( 1 ) ; { remove the marker }
   end ;


{ ** Copyright (c) 2001 - 2010 TS Technologies, Inc. All rights reserved. **
  ** TS reserves the right to modify or overwrite this analysis technique
     with each release. ** }

User avatar
JoshM
Posts: 2089
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1525 times
Been thanked: 1485 times
Contact:

Re: Compiling Error with MultiCharts Version 7.0 Release (Bu

Postby JoshM » 06 Nov 2011

I think you have some other, uncompiled script that causes that error, since the code you provided works here:

Code: Select all

06.11.11 11:35:57
------ Build started: ------
Study: "MyTestIndicator4" (Indicator)
Please wait ....
06.11.11 11:36:01
------ Compiled successfully  ------

(MultiCharts Version 7.0 Release (Build 4510))

And...

Code: Select all

06.11.11 11:39:45
------ Build started: ------
Study: "TestIndicator2" (Indicator)
Please wait ....
06.11.11 11:39:51
------ Compiled successfully  ------

..on the latest Beta (MultiCharts Version 7.2 Beta (Build 4776)).

Regards,
Josh

designer01
Posts: 80
Joined: 02 Feb 2010

Re: Compiling Error with MultiCharts Version 7.0 Release (Bu

Postby designer01 » 06 Nov 2011

I'm not sure why... if I close the program and re-open it then it compiles OK...

User avatar
Henry MultiСharts
Posts: 8503
Joined: 25 Aug 2011
Has thanked: 1213 times
Been thanked: 2731 times

Re: Compiling Error with MultiCharts Version 7.0 Release (Bu

Postby Henry MultiСharts » 07 Nov 2011

designer01 wrote:When I compile the code in MultiCharts Version 7.0 Release (Build 4510) (see code below) I get this error...
Compile error
errLine 0, errColumn 0, errLineEnd 0, errColumnEnd 0
causal study: (Function)
I can compile the same code in Multicharts v6 successfully. Can you please explain what the problem may be?
Thanks

Hello Sir.
Please try to compile an empty study.
Do you still have the compilation error?


Return to “MultiCharts”