| In Indicators you can call Equity() multiple times, linearly or in a loop. 
 best regards, herman 
 For tips on developing Real-Time Auto-Trading systems visit: http://www.amibroker.org/userkb/ 
 Friday, March 7, 2008, 2:47:15 AM, you wrote: 
 > As i want to compare equities of several systems within a chart, i try > to program equityline within a loop. > But i got a problem which i cannot solve. Maybe somebody can help me. 
 > This is my code, but it seems that it adds a position with every > signal and i want just 1 contract/share in a position and if i got > already a position, then nothing else should happen. It is a simple > Stop&Reverse ChannelBreakout system to test the code. 
 > LongChannelLength = Param("Channel Length Long", 20, 2, 50, 1); > ShortChannelLength = Param("Channel Length Short", 20, 2, 50, 1); 
 > Longchannel = Ref(HHV(H, LongChannelLength),-1); > ShortChannel = Ref(LLV(L, ShortChannelLength),-1); > Buy1 = Cross(H, Longchannel); > Sell1 = Cross(ShortChannel, L); > BuyPrice1   = Longchannel + TickSize; > SellPrice1  = Shortchannel - TickSize; > intrade1 = 0; > Equity1  = 0; 
 > for( i = 1; i < BarCount; i++ )  > {  >         if( intrade1[i] == 0 && Sell1[ i ] )                        >         {  >                 intrade1[i] = -1;                                   >                 Equity1[i] = Equity1[i-1] + SellPrice1[i];   >         } 
 >         else if( intrade1[i] == 0 && Buy1[ i ] )                    >         {  >                 intrade1[i] = 1;                                    >                 Equity1[i] = Equity1[i-1] - BuyPrice1[i];           >         } >         else if( intrade1[i] == -1 && Buy1[ i ] )                >         {  >                 intrade1[i] = 1;                                    >                 Equity1[i] = Equity1[i-1] - 2*BuyPrice1[i];  >         }  >          else if( intrade1[i] == 1 && Sell1[i] )                    >         { >                 intrade1[i] = -1;                                   >                 Equity1[i] = Equity1[i-1] + 2*SellPrice1[i];  >         } 
 >         else  >         { >                 Equity1[i] = Equity1[i-1]; >                 intrade1[i] = intrade1[i-1]; >         } > }  
 > Plot(Equity1, "Equity1", colorBlue, styleLine+styleThick); > Plot(intrade1, "Intrade1", colorWhite, styleOwnScale+styleHistogram); 
 
 
 > Please note that this group is for discussion between users only. 
 > To get support from AmiBroker please send an e-mail directly to  > SUPPORT {at} amibroker.com 
 > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ 
 > For other support material please check also: > http://www.amibroker.com/support.html >   > Yahoo! Groups Links 
 > <*> To visit your group on the web, go to: >     http://groups.yahoo.com/group/amibroker/ 
 > <*> Your email settings: >     Individual Email | Traditional 
 > <*> To change settings online go to: >     http://groups.yahoo.com/group/amibroker/join >     (Yahoo! ID required) 
 > <*> To change settings via email: >     mailto:amibroker-digest@xxxxxxxxxxxxxxx  >     mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx 
 > <*> To unsubscribe from this group, send an email to: >     amibroker-unsubscribe@xxxxxxxxxxxxxxx 
 > <*> Your use of Yahoo! Groups is subject to: >     http://docs.yahoo.com/info/terms/ >  __._,_.___ 
 Please note that this group is for discussion between users only.
 
 To get support from AmiBroker please send an e-mail directly to
 SUPPORT {at} amibroker.com
 
 For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
 http://www.amibroker.com/devlog/
 
 For other support material please check also:
 http://www.amibroker.com/support.html
 
 
 
 ![]()  
 
 __,_._,___
 |