[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: TJ; RE: AB 4.37 Release Bug Clarification



PureBytes Links

Trading Reference Links

Hello,

In your VBScript section replace:
' Initialize Variables
  FirstBar = UBound(Trades) - (TestPeriod(0) - 1)

with

' Initialize Variables
  FirstBar = UBound(Trades) - (TestPeriod - 1)

(you get type mismatch because you are referencing TestPeriod
as array while it is just scalar)

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "jnk1997" <jnk1997@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, May 18, 2003 6:26 PM
Subject: [amibroker] Re: TJ; RE: AB 4.37 Release Bug Clarification


> I apologize, I had a little trouble with my desktop AB after the 4.37 
> install and the following indicators (fired up my laptop, older AB to 
> see which ones the were)
> This IS accurate now complete with error codes, the firs code is 
> rather long but please scroll down to see the second indicator error 
> also.
> 
> Thanks
> Jim
> 
> 1) The error is reported as :
> 
> Source: Microsoft VBScript runtime error
> Line:   13   Char:   3
> Error:  0  - Type mismatch: 'TestPeriod'
> 
> --^
> The Code:
> 
> // Optimized ZigZag by Steve Dugas ( sjdugas@xxxxxxxxx )
> 
> TestPeriods  = 126;   // # of periods to use for backtest
> SignalArray  = Close; // array used to determine trade signals and 
> also plot Zig
> AcctEquity   = 20000; // initial equity
> Commission   = 11;    // dollars per trade
> TradeDelay   = 1;     // number of days after signal to execute trade
> ExecuteArray = Open;  // array used for executing trades
> AmtPerTrade  = 100;   // specify amount to risk per trade (see 
> PctOrUnits, next)
> PctOrUnits   = 1;     // for AmtPerTrade (above), 1 = %, 0 = units of 
> currency
> Margin       = 100;    // % equity to use (1-100), 100 = no margin, 
> 50 = 50% margin
> 
> ZigValue01 = Zig(SignalArray,1);
> ZigValue02 = Zig(SignalArray,2);
> ZigValue03 = Zig(SignalArray,3);
> ZigValue04 = Zig(SignalArray,4);
> ZigValue05 = Zig(SignalArray,5);
> ZigValue06 = Zig(SignalArray,6);
> ZigValue07 = Zig(SignalArray,7);
> ZigValue08 = Zig(SignalArray,8);
> ZigValue09 = Zig(SignalArray,9);
> ZigValue10 = Zig(SignalArray,10);
> ZigValue11 = Zig(SignalArray,11);
> ZigValue12 = Zig(SignalArray,12);
> ZigValue13 = Zig(SignalArray,13);
> ZigValue14 = Zig(SignalArray,14);
> ZigValue15 = Zig(SignalArray,15);
> ZigValue16 = Zig(SignalArray,16);
> ZigValue17 = Zig(SignalArray,17);
> ZigValue18 = Zig(SignalArray,18);
> ZigValue19 = Zig(SignalArray,19);
> ZigValue20 = Zig(SignalArray,20);
> ZigValue21 = Zig(SignalArray,21);
> ZigValue22 = Zig(SignalArray,22);
> ZigValue23 = Zig(SignalArray,23);
> ZigValue24 = Zig(SignalArray,24);
> ZigValue25 = Zig(SignalArray,25);
> ZigValue26 = Zig(SignalArray,26);
> ZigValue27 = Zig(SignalArray,27);
> ZigValue28 = Zig(SignalArray,28);
> ZigValue29 = Zig(SignalArray,29);
> ZigValue30 = Zig(SignalArray,30);
> ZigValue31 = Zig(SignalArray,31);
> ZigValue32 = Zig(SignalArray,32);
> ZigValue33 = Zig(SignalArray,33);
> ZigValue34 = Zig(SignalArray,34);
> ZigValue35 = Zig(SignalArray,35);
> ZigValue36 = Zig(SignalArray,36);
> ZigValue37 = Zig(SignalArray,37);
> ZigValue38 = Zig(SignalArray,38);
> ZigValue39 = Zig(SignalArray,39);
> ZigValue40 = Zig(SignalArray,40);
> ZigValue41 = Zig(SignalArray,41);
> ZigValue42 = Zig(SignalArray,42);
> ZigValue43 = Zig(SignalArray,43);
> ZigValue44 = Zig(SignalArray,44);
> ZigValue45 = Zig(SignalArray,45);
> ZigValue46 = Zig(SignalArray,46);
> ZigValue47 = Zig(SignalArray,47);
> ZigValue48 = Zig(SignalArray,48);
> 
> PeakSigs01 = ZigValue01 < Ref(ZigValue01,-1) AND Ref(ZigValue01,-1) > 
> Ref(ZigValue01,-2);
> PeakSigs02 = ZigValue02 < Ref(ZigValue02,-1) AND Ref(ZigValue02,-1) > 
> Ref(ZigValue02,-2);
> PeakSigs03 = ZigValue03 < Ref(ZigValue03,-1) AND Ref(ZigValue03,-1) > 
> Ref(ZigValue03,-2);
> PeakSigs04 = ZigValue04 < Ref(ZigValue04,-1) AND Ref(ZigValue04,-1) > 
> Ref(ZigValue04,-2);
> PeakSigs05 = ZigValue05 < Ref(ZigValue05,-1) AND Ref(ZigValue05,-1) > 
> Ref(ZigValue05,-2);
> PeakSigs06 = ZigValue06 < Ref(ZigValue06,-1) AND Ref(ZigValue06,-1) > 
> Ref(ZigValue06,-2);
> PeakSigs07 = ZigValue07 < Ref(ZigValue07,-1) AND Ref(ZigValue07,-1) > 
> Ref(ZigValue07,-2);
> PeakSigs08 = ZigValue08 < Ref(ZigValue08,-1) AND Ref(ZigValue08,-1) > 
> Ref(ZigValue08,-2);
> PeakSigs09 = ZigValue09 < Ref(ZigValue09,-1) AND Ref(ZigValue09,-1) > 
> Ref(ZigValue09,-2);
> PeakSigs10 = ZigValue10 < Ref(ZigValue10,-1) AND Ref(ZigValue10,-1) > 
> Ref(ZigValue10,-2);
> PeakSigs11 = ZigValue11 < Ref(ZigValue11,-1) AND Ref(ZigValue11,-1) > 
> Ref(ZigValue11,-2);
> PeakSigs12 = ZigValue12 < Ref(ZigValue12,-1) AND Ref(ZigValue12,-1) > 
> Ref(ZigValue12,-2);
> PeakSigs13 = ZigValue13 < Ref(ZigValue13,-1) AND Ref(ZigValue13,-1) > 
> Ref(ZigValue13,-2);
> PeakSigs14 = ZigValue14 < Ref(ZigValue14,-1) AND Ref(ZigValue14,-1) > 
> Ref(ZigValue14,-2);
> PeakSigs15 = ZigValue15 < Ref(ZigValue15,-1) AND Ref(ZigValue15,-1) > 
> Ref(ZigValue15,-2);
> PeakSigs16 = ZigValue16 < Ref(ZigValue16,-1) AND Ref(ZigValue16,-1) > 
> Ref(ZigValue16,-2);
> PeakSigs17 = ZigValue17 < Ref(ZigValue17,-1) AND Ref(ZigValue17,-1) > 
> Ref(ZigValue17,-2);
> PeakSigs18 = ZigValue18 < Ref(ZigValue18,-1) AND Ref(ZigValue18,-1) > 
> Ref(ZigValue18,-2);
> PeakSigs19 = ZigValue19 < Ref(ZigValue19,-1) AND Ref(ZigValue19,-1) > 
> Ref(ZigValue19,-2);
> PeakSigs20 = ZigValue20 < Ref(ZigValue20,-1) AND Ref(ZigValue20,-1) > 
> Ref(ZigValue20,-2);
> PeakSigs21 = ZigValue21 < Ref(ZigValue21,-1) AND Ref(ZigValue21,-1) > 
> Ref(ZigValue21,-2);
> PeakSigs22 = ZigValue22 < Ref(ZigValue22,-1) AND Ref(ZigValue22,-1) > 
> Ref(ZigValue22,-2);
> PeakSigs23 = ZigValue23 < Ref(ZigValue23,-1) AND Ref(ZigValue23,-1) > 
> Ref(ZigValue23,-2);
> PeakSigs24 = ZigValue24 < Ref(ZigValue24,-1) AND Ref(ZigValue24,-1) > 
> Ref(ZigValue24,-2);
> PeakSigs25 = ZigValue25 < Ref(ZigValue25,-1) AND Ref(ZigValue25,-1) > 
> Ref(ZigValue25,-2);
> PeakSigs26 = ZigValue26 < Ref(ZigValue26,-1) AND Ref(ZigValue26,-1) > 
> Ref(ZigValue26,-2);
> PeakSigs27 = ZigValue27 < Ref(ZigValue27,-1) AND Ref(ZigValue27,-1) > 
> Ref(ZigValue27,-2);
> PeakSigs28 = ZigValue28 < Ref(ZigValue28,-1) AND Ref(ZigValue28,-1) > 
> Ref(ZigValue28,-2);
> PeakSigs29 = ZigValue29 < Ref(ZigValue29,-1) AND Ref(ZigValue29,-1) > 
> Ref(ZigValue29,-2);
> PeakSigs30 = ZigValue30 < Ref(ZigValue30,-1) AND Ref(ZigValue30,-1) > 
> Ref(ZigValue30,-2);
> PeakSigs31 = ZigValue31 < Ref(ZigValue31,-1) AND Ref(ZigValue31,-1) > 
> Ref(ZigValue31,-2);
> PeakSigs32 = ZigValue32 < Ref(ZigValue32,-1) AND Ref(ZigValue32,-1) > 
> Ref(ZigValue32,-2);
> PeakSigs33 = ZigValue33 < Ref(ZigValue33,-1) AND Ref(ZigValue33,-1) > 
> Ref(ZigValue33,-2);
> PeakSigs34 = ZigValue34 < Ref(ZigValue34,-1) AND Ref(ZigValue34,-1) > 
> Ref(ZigValue34,-2);
> PeakSigs35 = ZigValue35 < Ref(ZigValue35,-1) AND Ref(ZigValue35,-1) > 
> Ref(ZigValue35,-2);
> PeakSigs36 = ZigValue36 < Ref(ZigValue36,-1) AND Ref(ZigValue36,-1) > 
> Ref(ZigValue36,-2);
> PeakSigs37 = ZigValue37 < Ref(ZigValue37,-1) AND Ref(ZigValue37,-1) > 
> Ref(ZigValue37,-2);
> PeakSigs38 = ZigValue38 < Ref(ZigValue38,-1) AND Ref(ZigValue38,-1) > 
> Ref(ZigValue38,-2);
> PeakSigs39 = ZigValue39 < Ref(ZigValue39,-1) AND Ref(ZigValue39,-1) > 
> Ref(ZigValue39,-2);
> PeakSigs40 = ZigValue40 < Ref(ZigValue40,-1) AND Ref(ZigValue40,-1) > 
> Ref(ZigValue40,-2);
> PeakSigs41 = ZigValue41 < Ref(ZigValue41,-1) AND Ref(ZigValue41,-1) > 
> Ref(ZigValue41,-2);
> PeakSigs42 = ZigValue42 < Ref(ZigValue42,-1) AND Ref(ZigValue42,-1) > 
> Ref(ZigValue42,-2);
> PeakSigs43 = ZigValue43 < Ref(ZigValue43,-1) AND Ref(ZigValue43,-1) > 
> Ref(ZigValue43,-2);
> PeakSigs44 = ZigValue44 < Ref(ZigValue44,-1) AND Ref(ZigValue44,-1) > 
> Ref(ZigValue44,-2);
> PeakSigs45 = ZigValue45 < Ref(ZigValue45,-1) AND Ref(ZigValue45,-1) > 
> Ref(ZigValue45,-2);
> PeakSigs46 = ZigValue46 < Ref(ZigValue46,-1) AND Ref(ZigValue46,-1) > 
> Ref(ZigValue46,-2);
> PeakSigs47 = ZigValue47 < Ref(ZigValue47,-1) AND Ref(ZigValue47,-1) > 
> Ref(ZigValue47,-2);
> PeakSigs48 = ZigValue48 < Ref(ZigValue48,-1) AND Ref(ZigValue48,-1) > 
> Ref(ZigValue48,-2);
> 
> TroughSigs01 = ZigValue01 > Ref(ZigValue01,-1) AND Ref(ZigValue01,-1) 
> < Ref(ZigValue01,-2);
> TroughSigs02 = ZigValue02 > Ref(ZigValue02,-1) AND Ref(ZigValue02,-1) 
> < Ref(ZigValue02,-2);
> TroughSigs03 = ZigValue03 > Ref(ZigValue03,-1) AND Ref(ZigValue03,-1) 
> < Ref(ZigValue03,-2);
> TroughSigs04 = ZigValue04 > Ref(ZigValue04,-1) AND Ref(ZigValue04,-1) 
> < Ref(ZigValue04,-2);
> TroughSigs05 = ZigValue05 > Ref(ZigValue05,-1) AND Ref(ZigValue05,-1) 
> < Ref(ZigValue05,-2);
> TroughSigs06 = ZigValue06 > Ref(ZigValue06,-1) AND Ref(ZigValue06,-1) 
> < Ref(ZigValue06,-2);
> TroughSigs07 = ZigValue07 > Ref(ZigValue07,-1) AND Ref(ZigValue07,-1) 
> < Ref(ZigValue07,-2);
> TroughSigs08 = ZigValue08 > Ref(ZigValue08,-1) AND Ref(ZigValue08,-1) 
> < Ref(ZigValue08,-2);
> TroughSigs09 = ZigValue09 > Ref(ZigValue09,-1) AND Ref(ZigValue09,-1) 
> < Ref(ZigValue09,-2);
> TroughSigs10 = ZigValue10 > Ref(ZigValue10,-1) AND Ref(ZigValue10,-1) 
> < Ref(ZigValue10,-2);
> TroughSigs11 = ZigValue11 > Ref(ZigValue11,-1) AND Ref(ZigValue11,-1) 
> < Ref(ZigValue11,-2);
> TroughSigs12 = ZigValue12 > Ref(ZigValue12,-1) AND Ref(ZigValue12,-1) 
> < Ref(ZigValue12,-2);
> TroughSigs13 = ZigValue13 > Ref(ZigValue13,-1) AND Ref(ZigValue13,-1) 
> < Ref(ZigValue13,-2);
> TroughSigs14 = ZigValue14 > Ref(ZigValue14,-1) AND Ref(ZigValue14,-1) 
> < Ref(ZigValue14,-2);
> TroughSigs15 = ZigValue15 > Ref(ZigValue15,-1) AND Ref(ZigValue15,-1) 
> < Ref(ZigValue15,-2);
> TroughSigs16 = ZigValue16 > Ref(ZigValue16,-1) AND Ref(ZigValue16,-1) 
> < Ref(ZigValue16,-2);
> TroughSigs17 = ZigValue17 > Ref(ZigValue17,-1) AND Ref(ZigValue17,-1) 
> < Ref(ZigValue17,-2);
> TroughSigs18 = ZigValue18 > Ref(ZigValue18,-1) AND Ref(ZigValue18,-1) 
> < Ref(ZigValue18,-2);
> TroughSigs19 = ZigValue19 > Ref(ZigValue19,-1) AND Ref(ZigValue19,-1) 
> < Ref(ZigValue19,-2);
> TroughSigs20 = ZigValue20 > Ref(ZigValue20,-1) AND Ref(ZigValue20,-1) 
> < Ref(ZigValue20,-2);
> TroughSigs21 = ZigValue21 > Ref(ZigValue21,-1) AND Ref(ZigValue21,-1) 
> < Ref(ZigValue21,-2);
> TroughSigs22 = ZigValue22 > Ref(ZigValue22,-1) AND Ref(ZigValue22,-1) 
> < Ref(ZigValue22,-2);
> TroughSigs23 = ZigValue23 > Ref(ZigValue23,-1) AND Ref(ZigValue23,-1) 
> < Ref(ZigValue23,-2);
> TroughSigs24 = ZigValue24 > Ref(ZigValue24,-1) AND Ref(ZigValue24,-1) 
> < Ref(ZigValue24,-2);
> TroughSigs25 = ZigValue25 > Ref(ZigValue25,-1) AND Ref(ZigValue25,-1) 
> < Ref(ZigValue25,-2);
> TroughSigs26 = ZigValue26 > Ref(ZigValue26,-1) AND Ref(ZigValue26,-1) 
> < Ref(ZigValue26,-2);
> TroughSigs27 = ZigValue27 > Ref(ZigValue27,-1) AND Ref(ZigValue27,-1) 
> < Ref(ZigValue27,-2);
> TroughSigs28 = ZigValue28 > Ref(ZigValue28,-1) AND Ref(ZigValue28,-1) 
> < Ref(ZigValue28,-2);
> TroughSigs29 = ZigValue29 > Ref(ZigValue29,-1) AND Ref(ZigValue29,-1) 
> < Ref(ZigValue29,-2);
> TroughSigs30 = ZigValue30 > Ref(ZigValue30,-1) AND Ref(ZigValue30,-1) 
> < Ref(ZigValue30,-2);
> TroughSigs31 = ZigValue31 > Ref(ZigValue31,-1) AND Ref(ZigValue31,-1) 
> < Ref(ZigValue31,-2);
> TroughSigs32 = ZigValue32 > Ref(ZigValue32,-1) AND Ref(ZigValue32,-1) 
> < Ref(ZigValue32,-2);
> TroughSigs33 = ZigValue33 > Ref(ZigValue33,-1) AND Ref(ZigValue33,-1) 
> < Ref(ZigValue33,-2);
> TroughSigs34 = ZigValue34 > Ref(ZigValue34,-1) AND Ref(ZigValue34,-1) 
> < Ref(ZigValue34,-2);
> TroughSigs35 = ZigValue35 > Ref(ZigValue35,-1) AND Ref(ZigValue35,-1) 
> < Ref(ZigValue35,-2);
> TroughSigs36 = ZigValue36 > Ref(ZigValue36,-1) AND Ref(ZigValue36,-1) 
> < Ref(ZigValue36,-2);
> TroughSigs37 = ZigValue37 > Ref(ZigValue37,-1) AND Ref(ZigValue37,-1) 
> < Ref(ZigValue37,-2);
> TroughSigs38 = ZigValue38 > Ref(ZigValue38,-1) AND Ref(ZigValue38,-1) 
> < Ref(ZigValue38,-2);
> TroughSigs39 = ZigValue39 > Ref(ZigValue39,-1) AND Ref(ZigValue39,-1) 
> < Ref(ZigValue39,-2);
> TroughSigs40 = ZigValue40 > Ref(ZigValue40,-1) AND Ref(ZigValue40,-1) 
> < Ref(ZigValue40,-2);
> TroughSigs41 = ZigValue41 > Ref(ZigValue41,-1) AND Ref(ZigValue41,-1) 
> < Ref(ZigValue41,-2);
> TroughSigs42 = ZigValue42 > Ref(ZigValue42,-1) AND Ref(ZigValue42,-1) 
> < Ref(ZigValue42,-2);
> TroughSigs43 = ZigValue43 > Ref(ZigValue43,-1) AND Ref(ZigValue43,-1) 
> < Ref(ZigValue43,-2);
> TroughSigs44 = ZigValue44 > Ref(ZigValue44,-1) AND Ref(ZigValue44,-1) 
> < Ref(ZigValue44,-2);
> TroughSigs45 = ZigValue45 > Ref(ZigValue45,-1) AND Ref(ZigValue45,-1) 
> < Ref(ZigValue45,-2);
> TroughSigs46 = ZigValue46 > Ref(ZigValue46,-1) AND Ref(ZigValue46,-1) 
> < Ref(ZigValue46,-2);
> TroughSigs47 = ZigValue47 > Ref(ZigValue47,-1) AND Ref(ZigValue47,-1) 
> < Ref(ZigValue47,-2);
> TroughSigs48 = ZigValue48 > Ref(ZigValue48,-1) AND Ref(ZigValue48,-1) 
> < Ref(ZigValue48,-2);
> 
> Trades01 = IIf(Ref(PeakSigs01,-TradeDelay),1,IIf(Ref(TroughSigs01,-
> TradeDelay),-1,0));
> Trades02 = IIf(Ref(PeakSigs02,-TradeDelay),1,IIf(Ref(TroughSigs02,-
> TradeDelay),-1,0));
> Trades03 = IIf(Ref(PeakSigs03,-TradeDelay),1,IIf(Ref(TroughSigs03,-
> TradeDelay),-1,0));
> Trades04 = IIf(Ref(PeakSigs04,-TradeDelay),1,IIf(Ref(TroughSigs04,-
> TradeDelay),-1,0));
> Trades05 = IIf(Ref(PeakSigs05,-TradeDelay),1,IIf(Ref(TroughSigs05,-
> TradeDelay),-1,0));
> Trades06 = IIf(Ref(PeakSigs06,-TradeDelay),1,IIf(Ref(TroughSigs06,-
> TradeDelay),-1,0));
> Trades07 = IIf(Ref(PeakSigs07,-TradeDelay),1,IIf(Ref(TroughSigs07,-
> TradeDelay),-1,0));
> Trades08 = IIf(Ref(PeakSigs08,-TradeDelay),1,IIf(Ref(TroughSigs08,-
> TradeDelay),-1,0));
> Trades09 = IIf(Ref(PeakSigs09,-TradeDelay),1,IIf(Ref(TroughSigs09,-
> TradeDelay),-1,0));
> Trades10 = IIf(Ref(PeakSigs10,-TradeDelay),1,IIf(Ref(TroughSigs10,-
> TradeDelay),-1,0));
> Trades11 = IIf(Ref(PeakSigs11,-TradeDelay),1,IIf(Ref(TroughSigs11,-
> TradeDelay),-1,0));
> Trades12 = IIf(Ref(PeakSigs12,-TradeDelay),1,IIf(Ref(TroughSigs12,-
> TradeDelay),-1,0));
> Trades13 = IIf(Ref(PeakSigs13,-TradeDelay),1,IIf(Ref(TroughSigs13,-
> TradeDelay),-1,0));
> Trades14 = IIf(Ref(PeakSigs14,-TradeDelay),1,IIf(Ref(TroughSigs14,-
> TradeDelay),-1,0));
> Trades15 = IIf(Ref(PeakSigs15,-TradeDelay),1,IIf(Ref(TroughSigs15,-
> TradeDelay),-1,0));
> Trades16 = IIf(Ref(PeakSigs16,-TradeDelay),1,IIf(Ref(TroughSigs16,-
> TradeDelay),-1,0));
> Trades17 = IIf(Ref(PeakSigs17,-TradeDelay),1,IIf(Ref(TroughSigs17,-
> TradeDelay),-1,0));
> Trades18 = IIf(Ref(PeakSigs18,-TradeDelay),1,IIf(Ref(TroughSigs18,-
> TradeDelay),-1,0));
> Trades19 = IIf(Ref(PeakSigs19,-TradeDelay),1,IIf(Ref(TroughSigs19,-
> TradeDelay),-1,0));
> Trades20 = IIf(Ref(PeakSigs20,-TradeDelay),1,IIf(Ref(TroughSigs20,-
> TradeDelay),-1,0));
> Trades21 = IIf(Ref(PeakSigs21,-TradeDelay),1,IIf(Ref(TroughSigs21,-
> TradeDelay),-1,0));
> Trades22 = IIf(Ref(PeakSigs22,-TradeDelay),1,IIf(Ref(TroughSigs22,-
> TradeDelay),-1,0));
> Trades23 = IIf(Ref(PeakSigs23,-TradeDelay),1,IIf(Ref(TroughSigs23,-
> TradeDelay),-1,0));
> Trades24 = IIf(Ref(PeakSigs24,-TradeDelay),1,IIf(Ref(TroughSigs24,-
> TradeDelay),-1,0));
> Trades25 = IIf(Ref(PeakSigs25,-TradeDelay),1,IIf(Ref(TroughSigs25,-
> TradeDelay),-1,0));
> Trades26 = IIf(Ref(PeakSigs26,-TradeDelay),1,IIf(Ref(TroughSigs26,-
> TradeDelay),-1,0));
> Trades27 = IIf(Ref(PeakSigs27,-TradeDelay),1,IIf(Ref(TroughSigs27,-
> TradeDelay),-1,0));
> Trades28 = IIf(Ref(PeakSigs28,-TradeDelay),1,IIf(Ref(TroughSigs28,-
> TradeDelay),-1,0));
> Trades29 = IIf(Ref(PeakSigs29,-TradeDelay),1,IIf(Ref(TroughSigs29,-
> TradeDelay),-1,0));
> Trades30 = IIf(Ref(PeakSigs30,-TradeDelay),1,IIf(Ref(TroughSigs30,-
> TradeDelay),-1,0));
> Trades31 = IIf(Ref(PeakSigs31,-TradeDelay),1,IIf(Ref(TroughSigs31,-
> TradeDelay),-1,0));
> Trades32 = IIf(Ref(PeakSigs32,-TradeDelay),1,IIf(Ref(TroughSigs32,-
> TradeDelay),-1,0));
> Trades33 = IIf(Ref(PeakSigs33,-TradeDelay),1,IIf(Ref(TroughSigs33,-
> TradeDelay),-1,0));
> Trades34 = IIf(Ref(PeakSigs34,-TradeDelay),1,IIf(Ref(TroughSigs34,-
> TradeDelay),-1,0));
> Trades35 = IIf(Ref(PeakSigs35,-TradeDelay),1,IIf(Ref(TroughSigs35,-
> TradeDelay),-1,0));
> Trades36 = IIf(Ref(PeakSigs36,-TradeDelay),1,IIf(Ref(TroughSigs36,-
> TradeDelay),-1,0));
> Trades37 = IIf(Ref(PeakSigs37,-TradeDelay),1,IIf(Ref(TroughSigs37,-
> TradeDelay),-1,0));
> Trades38 = IIf(Ref(PeakSigs38,-TradeDelay),1,IIf(Ref(TroughSigs38,-
> TradeDelay),-1,0));
> Trades39 = IIf(Ref(PeakSigs39,-TradeDelay),1,IIf(Ref(TroughSigs39,-
> TradeDelay),-1,0));
> Trades40 = IIf(Ref(PeakSigs40,-TradeDelay),1,IIf(Ref(TroughSigs40,-
> TradeDelay),-1,0));
> Trades41 = IIf(Ref(PeakSigs41,-TradeDelay),1,IIf(Ref(TroughSigs41,-
> TradeDelay),-1,0));
> Trades42 = IIf(Ref(PeakSigs42,-TradeDelay),1,IIf(Ref(TroughSigs42,-
> TradeDelay),-1,0));
> Trades43 = IIf(Ref(PeakSigs43,-TradeDelay),1,IIf(Ref(TroughSigs43,-
> TradeDelay),-1,0));
> Trades44 = IIf(Ref(PeakSigs44,-TradeDelay),1,IIf(Ref(TroughSigs44,-
> TradeDelay),-1,0));
> Trades45 = IIf(Ref(PeakSigs45,-TradeDelay),1,IIf(Ref(TroughSigs45,-
> TradeDelay),-1,0));
> Trades46 = IIf(Ref(PeakSigs46,-TradeDelay),1,IIf(Ref(TroughSigs46,-
> TradeDelay),-1,0));
> Trades47 = IIf(Ref(PeakSigs47,-TradeDelay),1,IIf(Ref(TroughSigs47,-
> TradeDelay),-1,0));
> Trades48 = IIf(Ref(PeakSigs48,-TradeDelay),1,IIf(Ref(TroughSigs48,-
> TradeDelay),-1,0));
> 
> EnableScript("vbscript");
> <%
> function CalcProfit(ZigValue,Trades,TestPeriod,ExecArray,AcctEquity, _
>                     Commission,AmtPerTrade,PctOrUnits,Margin)
> 
> ' Mark the trade that closes the final Open position
>   if ZigValue(UBound(ZigValue)) > ZigValue(UBound(ZigValue)-1) Then
>     Trades(UBound(Trades)) = 1
>   else
>     Trades(UBound(Trades)) = -1
>   End if
> 
> ' Initialize Variables
>   FirstBar = UBound(Trades) - (TestPeriod(0) - 1)
>   TotalProfit = 0
>   PricePriorTrade = ExecArray(FirstBar)
>   if PctOrUnits Then
>     EquityToUse = AcctEquity*(AmtPerTrade/100)
>   else
>     EquityToUse = AmtPerTrade
>   End if
> 
> ' Calculate profit for this Zig % change
>   for Bar = (FirstBar + 1) To UBound(Trades)
>     if Trades(Bar) = 1 Then
>       Shares = int((EquityToUse*(100/Margin))/PricePriorTrade)
>       TradeProfit = ((ExecArray(Bar)-PricePriorTrade)*Shares)-
> (Commision*2)
>       TotalProfit = TotalProfit + TradeProfit
>       AcctEquity = AcctEquity + TradeProfit
>       PricePriorTrade = ExecArray(Bar)
>     ElseIf Trades(Bar) = -1 Then
>       Shares = int((EquityToUse*(100/Margin))/PricePriorTrade)
>       TradeProfit = ((PricePriorTrade-ExecArray(Bar))*Shares)-
> (Commision*2)
>       TotalProfit = TotalProfit + TradeProfit
>       AcctEquity = AcctEquity + TradeProfit
>       PricePriorTrade = ExecArray(Bar)
>     End if
>   Next
> 
>   CalcProfit = TotalProfit
> 
> End function
> %>
> 
> TestPeriod  = Min(TestPeriods,LastValue(Cum(1)));
> 
> Script   = GetScriptObject();
> Profit01 = script.CalcProfit
> (ZigValue01,Trades01,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit02 = script.CalcProfit
> (ZigValue02,Trades02,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit03 = script.CalcProfit
> (ZigValue03,Trades03,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit04 = script.CalcProfit
> (ZigValue04,Trades04,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit05 = script.CalcProfit
> (ZigValue05,Trades05,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit06 = script.CalcProfit
> (ZigValue06,Trades06,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit07 = script.CalcProfit
> (ZigValue07,Trades07,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit08 = script.CalcProfit
> (ZigValue08,Trades08,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit09 = script.CalcProfit
> (ZigValue09,Trades09,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit10 = script.CalcProfit
> (ZigValue10,Trades10,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit11 = script.CalcProfit
> (ZigValue11,Trades11,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit12 = script.CalcProfit
> (ZigValue12,Trades12,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit13 = script.CalcProfit
> (ZigValue13,Trades13,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit14 = script.CalcProfit
> (ZigValue14,Trades14,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit15 = script.CalcProfit
> (ZigValue15,Trades15,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit16 = script.CalcProfit
> (ZigValue16,Trades16,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit17 = script.CalcProfit
> (ZigValue17,Trades17,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit18 = script.CalcProfit
> (ZigValue18,Trades18,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit19 = script.CalcProfit
> (ZigValue19,Trades19,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit20 = script.CalcProfit
> (ZigValue20,Trades20,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit21 = script.CalcProfit
> (ZigValue21,Trades21,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit22 = script.CalcProfit
> (ZigValue22,Trades22,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit23 = script.CalcProfit
> (ZigValue23,Trades23,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit24 = script.CalcProfit
> (ZigValue24,Trades24,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit25 = script.CalcProfit
> (ZigValue25,Trades25,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit26 = script.CalcProfit
> (ZigValue26,Trades26,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit27 = script.CalcProfit
> (ZigValue27,Trades27,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit28 = script.CalcProfit
> (ZigValue28,Trades28,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit29 = script.CalcProfit
> (ZigValue29,Trades29,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit30 = script.CalcProfit
> (ZigValue30,Trades30,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit31 = script.CalcProfit
> (ZigValue31,Trades31,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit32 = script.CalcProfit
> (ZigValue32,Trades32,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit33 = script.CalcProfit
> (ZigValue33,Trades33,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit34 = script.CalcProfit
> (ZigValue34,Trades34,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit35 = script.CalcProfit
> (ZigValue35,Trades35,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit36 = script.CalcProfit
> (ZigValue36,Trades36,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit37 = script.CalcProfit
> (ZigValue37,Trades37,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit38 = script.CalcProfit
> (ZigValue38,Trades38,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit39 = script.CalcProfit
> (ZigValue39,Trades39,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit40 = script.CalcProfit
> (ZigValue40,Trades40,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit41 = script.CalcProfit
> (ZigValue41,Trades41,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit42 = script.CalcProfit
> (ZigValue42,Trades42,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit43 = script.CalcProfit
> (ZigValue43,Trades43,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit44 = script.CalcProfit
> (ZigValue44,Trades44,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit45 = script.CalcProfit
> (ZigValue45,Trades45,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit46 = script.CalcProfit
> (ZigValue46,Trades46,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit47 = script.CalcProfit
> (ZigValue47,Trades47,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> Profit48 = script.CalcProfit
> (ZigValue48,Trades48,TestPeriod,ExecuteArray,
>                              
> AcctEquity,Commission,AmtPerTrade,PctOrUnits,Margin);
> 
> OptProfit = Max(Max(Max(Max(Max(Max(Profit01,Profit02),Max
> (Profit03,Profit04)),
>                             Max(Max(Profit05,Profit06),Max
> (Profit07,Profit08))),
>                         Max(Max(Max(Profit09,Profit10),Max
> (Profit11,Profit12)),
>                             Max(Max(Profit13,Profit14),Max
> (Profit15,Profit16)))),
>                     Max(Max(Max(Max(Profit17,Profit18),Max
> (Profit19,Profit20)),
>                             Max(Max(Profit21,Profit22),Max
> (Profit23,Profit24))),
>                         Max(Max(Max(Profit25,Profit26),Max
> (Profit27,Profit28)),
>                             Max(Max(Profit29,Profit30),Max
> (Profit31,Profit32))))),
>                     Max(Max(Max(Max(Profit33,Profit34),Max
> (Profit35,Profit36)),
>                             Max(Max(Profit37,Profit38),Max
> (Profit39,Profit40))),
>                         Max(Max(Max(Profit41,Profit42),Max
> (Profit43,Profit44)),
>                             Max(Max(Profit45,Profit46),Max
> (Profit47,Profit48)))));
> 
> OptZigPct = IIf(OptProfit==Profit01,1,
>             IIf(OptProfit==Profit02,2,
>             IIf(OptProfit==Profit03,3,
>             IIf(OptProfit==Profit04,4,
>             IIf(OptProfit==Profit05,5,
>             IIf(OptProfit==Profit06,6,
>             IIf(OptProfit==Profit07,7,
>             IIf(OptProfit==Profit08,8,
>             IIf(OptProfit==Profit09,9,
>             IIf(OptProfit==Profit10,10,
>             IIf(OptProfit==Profit11,11,
>             IIf(OptProfit==Profit12,12,
>             IIf(OptProfit==Profit13,13,
>             IIf(OptProfit==Profit14,14,
>             IIf(OptProfit==Profit15,15,
>             IIf(OptProfit==Profit16,16,
>             IIf(OptProfit==Profit17,17,
>             IIf(OptProfit==Profit18,18,
>             IIf(OptProfit==Profit19,19,
>             IIf(OptProfit==Profit20,20,
>             IIf(OptProfit==Profit21,21,
>             IIf(OptProfit==Profit22,22,
>             IIf(OptProfit==Profit23,23,
>             IIf(OptProfit==Profit24,24,
>             IIf(OptProfit==Profit25,25,
>             IIf(OptProfit==Profit26,26,
>             IIf(OptProfit==Profit27,27,
>             IIf(OptProfit==Profit28,28,
>             IIf(OptProfit==Profit29,29,
>             IIf(OptProfit==Profit30,30,
>             IIf(OptProfit==Profit31,31,
>             IIf(OptProfit==Profit32,32,
>             IIf(OptProfit==Profit33,33,
>             IIf(OptProfit==Profit34,34,
>             IIf(OptProfit==Profit35,35,
>             IIf(OptProfit==Profit36,36,
>             IIf(OptProfit==Profit37,37,
>             IIf(OptProfit==Profit38,38,
>             IIf(OptProfit==Profit39,39,
>             IIf(OptProfit==Profit40,40,
>             IIf(OptProfit==Profit41,41,
>             IIf(OptProfit==Profit42,42,
>             IIf(OptProfit==Profit43,43,
>             IIf(OptProfit==Profit44,44,
>             IIf(OptProfit==Profit45,45,
>             IIf(OptProfit==Profit46,46,
>             IIf(OptProfit==Profit47,47,48)
>                ))))))))))))))))))))))))))))))))))))))))))))));
> 
> OptPctProfit = (OptProfit / AcctEquity) * 100;
> PctBarsTested = (TestPeriod / TestPeriods) * 100;
> FinalEquity = AcctEquity + OptProfit;
> AnnualOptPctProfit = 100 * ((FinalEquity / AcctEquity) ^ (251 / 
> TestPeriod) - 1);
> AnnualOptProfit = (AnnualOptPctProfit / 100) * AcctEquity;
> 
> Filter = 1;
> AddTextColumn(FullName(),"Name");
> AddTextColumn(SectorID(1),"Sector");
> AddTextColumn(IndustryID(1),"Industry");
> AddColumn(OptZigPct,"Opt Zig %",1.0);
> AddColumn(OptPctProfit,"% Profit",1.2);
> AddColumn(OptProfit,"$ Profit",1.2);
> AddColumn(TestPeriod,"Bars Tested",1.0);
> AddColumn(PctBarsTested,"% Test Pd",1.2);
> AddColumn(AnnualOptPctProfit,"Ann % Profit",1.2);
> AddColumn(AnnualOptProfit,"Ann $ Profit",1.2);
> 
> CurrentTrendUp = Zig(SignalArray,LastValue(OptZigPct))
>                > Ref(Zig(SignalArray,LastValue(OptZigPct)),-1);
> BaseZigPrice = IIf(CurrentTrendUp,
>                  Trough(SignalArray,LastValue(OptZigPct),1),
>                  Peak(SignalArray,LastValue(OptZigPct),1));
> ZigConfirmedPrice = IIf(CurrentTrendUp,
>                     BaseZigPrice + ((OptZigPct / 100) * BaseZigPrice),
>                     BaseZigPrice - ((OptZigPct / 100) * 
> BaseZigPrice));
> ZigNotConfirmed = IIf(CurrentTrendUp,SignalArray < ZigConfirmedPrice,
>                                      SignalArray > ZigConfirmedPrice);
> ZigColor = IIf(ZigNotConfirmed,colorBlack,colorYellow);
> ZigConfirmedPriceColor = IIf(BaseZigPrice > Zig(SignalArray,LastValue
> (OptZigPct)),
>                              colorRose,colorPaleTurquoise);
> 
> Plot(ZigConfirmedPrice,"Conf 
> Price",ZigConfirmedPriceColor,styleStaircase);
> Plot(Zig(SignalArray,LastValue(OptZigPct)),"Zig Value",
>          ZigColor,styleLine + styleDots);
> Plot(SignalArray,"Price",colorBrown,styleCandle);
> Title = EncodeColor(colorBlue) + Name()
>       + EncodeColor(colorBrightGreen) + "     " + Date()
>       + EncodeColor(colorBlack) + "     Price: " 
>        + EncodeColor(colorRed) + WriteVal(SignalArray,1.2)
>       + EncodeColor(colorBlack) + "     Zig Confirmed at: " 
>        + EncodeColor(colorCustom11) + WriteVal(ZigConfirmedPrice,1.2)
>       + EncodeColor(colorBlack) + "     Opt Zig %: " 
>        + EncodeColor(colorYellow) + WriteVal(OptZigPct,1.0)
> +"\n" + EncodeColor(colorBlack) + "Name: "
>        + EncodeColor(colorBlue) + FullName()
> +"\n" + EncodeColor(colorBlack) + "Sector: "
>        + EncodeColor(colorGold) + SectorID(1)
> +"\n" + EncodeColor(colorBlack) + "Industry: " 
>        + EncodeColor(colorBrown) + IndustryID(1);
> /*
> Plot() - syntax: Plot(array,title,color/barcolor,style)
>            - color/barcolor could be name/number (static) or formula 
> (dynamic)
>                colorCustom1        =  0
>                colorCustom2        =  1
>                colorCustom3        =  2
>                colorCustom4        =  3
>                colorCustom5        =  4
>                colorCustom6        =  5
>                colorCustom7        =  6
>                colorCustom8        =  7
>                colorCustom9        =  8
>                colorCustom10       =  9
>                colorCustom11       = 10
>                colorCustom12       = 11
>                colorCustom13       = 12
>                colorCustom14       = 13
>                colorCustom15       = 14
>                colorCustom16       = 15
>                colorBlack          = 16
>                colorBrown          = 17
>                colorDarkOliveGreen = 18
>                colorDarkGreen      = 19
>                colorDarkTeal       = 20
>                colorDarkBlue       = 21
>                colorIndigo         = 22
>                colorDarkGrey       = 23
>                colorDarkRed        = 24
>                colorOrange         = 25
>                colorDarkYellow     = 26
>                colorGreen          = 27
>                colorTeal           = 28
>                colorBlue           = 29
>                colorBlueGrey       = 30
>                colorGrey40         = 31
>                colorRed            = 32
>                colorLightOrange    = 33
>                colorLime           = 34
>                colorSeaGreen       = 35
>                colorAqua           = 36
>                colorLightBlue      = 37
>                colorViolet         = 38
>                colorGrey50         = 39
>                colorPink           = 40
>                colorGold           = 41
>                colorYellow         = 42
>                colorBrightGreen    = 43
>                colorTurquoise      = 44
>                colorSkyblue        = 45
>                colorPlum           = 46
>                colorLightGrey      = 47
>                colorRose           = 48
>                colorTan            = 49
>                colorLightYellow    = 50
>                colorPaleGreen      = 51
>                colorPaleTurquoise  = 52
>                colorPaleBlue       = 53
>                colorLavender       = 54
>                colorWhite          = 55
>            - style is a combination of one or more of following 
> values:
>                styleLine           =     1 - normal (line) chart 
> (default)
>                styleHistogram      =     2 - histogram chart
>                styleThick          =     4 - fat (thick)
>                styleDots           =     8 - include dots
>                styleNoLine         =    16 - no line
>                styleLog            =    32 - semi-logarithmic scale
>                styleCandle         =    64 - candlestick chart
>                styleBar            =   128 - traditional bar chart
>                styleNoDraw         =   256 - no draw (perform axis 
> scaling only)
>                styleStaircase      =   512 - staircase (square) chart 
>                styleSwingDots      =  1024 - middle dots for 
> staircase chart 
>                styleNoRescale      =  2048 - no rescale
>                styleNoLabel        =  4096 - no value label
>                stylePointAndFigure =  8192 - point and figure
>                styleArea           = 16384 - area chart
>                styleOwnScale       = 32768 - use independent scaling
>                styleLeftAxisScale  = 65536 - use independant left 
> axis scale */
> 
>    
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 
> 2) The second Indicator error is reported as:
> 
> Line 174, Column 19:
> /////////////////////
> 
> PlotShapes( IIf( BuyNow, shapeSmallUpTriangle + shapePositonAbove, 
> shapeNone ), colorBrightGreen );
> ----------------------------------------------------------------------
> ----------------------------^
> 
> Variable 'shapepositonabove' used without having been initialized.
> 
> 
> For code:
> 
> /* Asymetrical Market Profile Band System v1*/
> 
> /* Author Marc Valley */
> 
> per1 = 256; //Optimize("Per1",1,1,20,1);
> per2 = Optimize("Per2",14,1,20,1);
> HistVol= 100*sqrt(260 )*StDev((Close-Ref(Close,-1))/Close,per1 );
> Ga = DEMA(HistVol,per1 );
> G1 = DEMA(RSI(per2 ),per2 );
> G2= (((G1 *Avg)* MA(V,per1))*Ga);
> G0 = BBandTop(G2, 11, 1.00);
> G3 = BBandBot(G2, 11, .95);
> G4 = ValueWhen(LLV(G2,2), G2, 1);
> /*HistVol= 100*sqrt(260)*StDev((Close-Ref(Close,-1))/Close,256);
> Ga = DEMA(HistVol,256);
> G1 = DEMA(DEMA(RSI(14),14),14);
> G2= (((G1 *Avg)* MA(V,256))*Ga);
> G0 = BBandTop(G2, 11, 1.00);
> G3 = BBandBot(G2, 11, .95);
> G4 = ValueWhen(LLV(G2,2), G2, 1);
> /********************/
> /* A theoretical trading system for RSI(14)*/
> 
> /*(it is not proper for real trading)*/
> //perc=3;//calibrate the sensitivity
> //Var= G2; //RSI(14);//Your variable input
> //C1=PeakBars(Var,perc)==0;//peak condition
> //C2=TroughBars(Var,perc)==0;//trough condition
> /*Filter=C1 OR C2;//To find peak or trough dates
> AddColumn(IIf(C1,Var,0),"PEAK",1.2);//To read peak values
> AddColumn(IIf(C2,Var,0),"TROUGH",1.2);//To read trough values
> Buy=C2;//Buy at trough
> Sell=C1;//Sell at peak
> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
> Short=Sell;//A first approach short condition
> Cover=Buy;//A first approach cover condition
> Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short); */
> //perc=40;//calibrate the sensitivity;
> //Var=RSI(14);//Your variable input
> 
> Plot(G2,"G2",1,4);  //BLACK
> ///////////Plot(Peak(g2,1,1),"Peak",2,4);
> ///////////Plot(Trough(g2,1,1),"Trough",2,4);
> Plot(G0,"BH",4,4);  //RED 
> Plot(G3,"BL",5,4);  //GREEN
> //Plot(G4,"G4",colorLightGrey,styleHistogram);
> //Plot(Var,"BAND Trend System  V1",1,1);
> //////////Plot(Zig(Var,perc),"Zig",2,4); //PLOT ZIG LINE FOR VIEWING 
> PURPOSES ONLY
> 
> //Plot(C1*g2,"C1",4,6);
> //Plot(C2*g2,"C2",5,6);
> 
> ///////////////
> BuyNow = Cross(G2,G3);  // OR Cross(G2,G0);
> SellNow = Cross(G0,G2);// OR Cross(G2,G3);
> Buy = BuyNow;
> Sell = SellNow;
> Short=Sell;
> //ShortPrice =Sell;
> 
> Cover=Buy;
> //CoverPrice= Cover;
> Buy=ExRem(Buy,Sell);
> Sell=ExRem(Sell,Buy);
> Short=ExRem(Short,Cover);
> Cover=ExRem(Cover,Short);
> Equity(1);
> 
> /////////////////////
> 
> PlotShapes( IIf( BuyNow, shapeSmallUpTriangle + shapePositonAbove, 
> shapeNone ), colorBrightGreen ); 
> PlotShapes( IIf( SellNow, shapeSmallDownTriangle + shapePositonAbove, 
> shapeNone ), colorRed )
> GraphXSpace = 2;
> GraphZOrder = 1;
> 
> 
> 
> 
> 
> 
> 
> 
> .
> 
> 
> 
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
> 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/