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

[amibroker] Trailing buy-stop



PureBytes Links

Trading Reference Links




Yes 
:-)
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>herman

  <FONT face=Tahoma 
  size=2>-----Original Message-----From: see_change007 
  [mailto:cvt@xxxxxxxxxxxxxx]Sent: Monday, August 09, 2004 9:19 
  AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re: 
  Static VariablesOk So if I want to 
  use X=n in a formula , I don't need to worry about it interacting with x's 
  defined in other forumulars. :) Correct ?See 
  Change--- In amibroker@xxxxxxxxxxxxxxx, "Herman van den 
  Bergen" <psytek@xxxx> wrote:> InLine,,,>   
  -----Original Message----->   From: see_change007 
  [mailto:cvt@xxxx]>   Sent: Monday, August 09, 2004 8:47 
  AM>   To: amibroker@xxxxxxxxxxxxxxx>   
  Subject: [amibroker] Re: Static Variables> > 
  >   Just want to make sure I 'm correct in one thing.> 
  >   If I define X = n at the begining of a formular then X is 
  a static>   variable. X = n is a normal afl variable, to 
  make it Static you have to> use StaticVarSet() if you define it at 
  the begin of the code containing the> assignment then it will be 
  redefined each time this code runs regardless of> what values may 
  have been assigned to it before from other places; i.e. it> would 
  function locally.> >   And if I'm using the same 
  symbols eg x to represent variables in>   different 
  indicators, even if the indicators may not be in use at>   
  one particular time on active charts , the settings in one 
  one>   formular may interact with other forumulars containing 
  the same>   formular.> >   I do not 
  know to what extend invisible indicators are executed... i> suppose 
  they are not however they may collect prices in RealTime... I 
  don't> know exactly what happens here, you could try it and see what 
  happens.> >   However, visible indicators using 
  the same StaticVariable will each> execute and modify StaticVar 
  unless they are kept local (unique) with the> use of TJ's functions 
  or if they are locally initialized in each indicator,> i.e. with 
  Param()> >   If I wanted to avoid this and was using a 
  static variable within one>   indicator , I could set 
  that by coding> >   If you only use it in one 
  indicator, yes. If you want to use the same> Static variables names 
  independently in many Indicators (use the same code> in different 
  places) but have them function locally then they should be kept> 
  unique and you should use TJ's functions.> >   
  StaticVarSet( ''x'', n );> >   Is this correct 
  ?> >   See Change> >   --- In 
  amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen">   
  <psytek@xxxx> wrote:>   > Great suggestion Tomasz, 
  thanks for your input!>   >>   > This 
  will make things a lot simpler to code.>   
  >>   > best regards,>   > 
  herman.>   >>   >>   
  >   -----Original Message----->   
  >   From: Tomasz Janeczko 
  [mailto:amibroker@xxxx]>   >   Sent: Monday, 
  August 09, 2004 5:31 AM>   >   To: 
  amibroker@xxxxxxxxxxxxxxx>   >   Subject: Re: 
  [amibroker] Static Variables>   >   Importance: 
  High>   >>   >>   
  >   Herman,>   >>   
  >   One thing: You don't need to worry about adding such 
  complex>   coding all>   > the 
  time.>   >   Instead you should use FUNCTIONS 
  that make life easier.>   >   If you want 
  "unique static" (per indicator) you can easily have>   
  them using>   > these two functions:>   
  >>   >   procedure UnqStaticVarSet( name, 
  value )>   >   {>   
  >      StaticVarSet( name + GetChartID(), value 
  );>   >   }>   
  >>   >   function UnqStaticVarGet( name 
  )>   >   {>   
  >     return StaticVarGet( name + GetChartID() 
  );>   >   }>   
  >>   >   then use UnqStaticVarSet, 
  UnqStaticVarGet in your code>   >>   
  >   Best regards,>   >   Tomasz 
  Janeczko>   >   
  amibroker.com>   >     ----- Original 
  Message ----->   >     From: Herman 
  van den Bergen>   >     To: 
  amibroker@xxxxxxxxxxxxxxx>   >     
  Sent: Monday, August 09, 2004 3:28 AM>   
  >     Subject: RE: [amibroker] Static 
  Variables>   >>   
  >>   >     Ara,>   
  >>   >     You have to be careful 
  scoping the Static Variables,>   >>   
  >     1) If you use same name static variables in 
  different>   indicators then>   > their 
  values can change from various sources. This is the case 
  if>   you assign>   > program derived 
  values, for example counters ,not in the case of>   
  param() see>   > next...>   
  >>   >     2) If the Static 
  variables are initialized inside the code>   with 
  a>   > Param() in EACH of the Indicators then in essence 
  you have>   disabled the>   > Global 
  nature of the Static Variable: this is so because the>   
  Static variable>   > is reinitialized in each Indicator 
  separately each time the code>   is 
  executed>   > (on Refresh). This makes it immune to 
  whatever other code does.>   >>   
  >     3) Static variables are truly Global, in contrast 
  to afl>   variables>   > declared Global 
  in afl, these are Global 'per' indicator. Static>   
  variables>   > are Global per AmiBroker 
  Instance.>   >>   
  >     4) If you want to restrict the scope of Static 
  variables to>   the current>   > 
  Indicator, to prevnt conflicing conditions, then you have to add 
  a>   unique>   > identifier to each code, 
  I use something like this:>   >     
  ChartID = NumToStr(GetChartID(),1.0,False);>   
  >     Reset = Param("Reset Static 
  variables",0,0,1,1);>   >     
  StaticScope = Param("Scope (0:Local,1:Global) for>   > 
  Chart#"+ChartID,1,0,1,1);>   >     if( 
  StaticScope ) Scope = ""; else Scope = ChartID;>   
  >     ...>   
  >     if( IsEmpty( StaticVarGet("TickCounter"+Scope)) 
  OR Reset)>   >     
  StaticVarSet("TickCounter"+Scope,0);>   
  >     TickCount = 
  StaticVarGet("TickCounter"+Scope);>   
  >>   >     here a tickcounter is 
  made Local to the indicator containing>   the code 
  to>   > prevent interference with duplicate code in other 
  indicators. This>   means i>   > can 
  count ticks from fifferent stocks while using the SAME>   
  indicator.>   >>   
  >     Hope this helps,>   
  >>   >     
  herman.>   >>   >>   
  >>   >>   >>   
  >      -----Original 
  Message----->   >     From: Ara 
  Kaloustian [mailto:ara1@xxxx]>   >     
  Sent: Sunday, August 08, 2004 8:46 PM>   
  >     To: AB-Main>   
  >     Subject: [amibroker] Static 
  Variables>   >>   
  >>   >>   
  >       I am having a hard time using static 
  variables....>   >>   
  >       Sometimes they work as expected ... 
  sometimes they don't ...>   so my>   
  > expectation must obviously be questionable.>   
  >>   >       I am 
  assuming Static variables can be used anywhere that>   normal 
  Number>   > and String variables can be 
  used!>   >>   
  >       - in assignments: 
  StaticVarSet("Var",Value);>   
  >       - in If Statements: if 
  (StaticVarGet("Var") == Value) ....>   
  >       - in iif Statement: Test = 
  iif(StaticVarGet("Var")>   > 
  ==Value,True,False);>   >>   
  >       Is my assumption 
  correct?>   >>   
  >       Thanks>   
  >>   >       
  Ara>   >>   >>   
  >       Check AmiBroker web page 
  at:>   >       <A 
  href="">http://www.amibroker.com/>   
  >>   >       Check group 
  FAQ at:>   > <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html>   
  >>   >>   >>   
  >>   >       Check 
  AmiBroker web page at:>   
  >       <A 
  href="">http://www.amibroker.com/>   
  >>   >       Check group 
  FAQ at:>   > <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html>   
  >>   >>   >>   
  >>   >>   >   Check 
  AmiBroker web page at:>   >   <A 
  href="">http://www.amibroker.com/>   
  >>   >   Check group FAQ 
  at:>   > <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html>   
  >>   >>   
  >         Yahoo! Groups 
  Sponsor>   
  >               
  ADVERTISEMENT>   >>   
  >>   >>   >>   
  >>   > 
  ------------------------------------------------------------------->   
  --------->   > -->   >   
  Yahoo! Groups Links>   >>   
  >     a.. To visit your group on the web, go 
  to:>   >     <A 
  href="">http://groups.yahoo.com/group/amibroker/>   
  >>   >     b.. To unsubscribe from 
  this group, send an email to:>   >     
  amibroker-unsubscribe@xxxxxxxxxxxxxxx>   
  >>   >     c.. Your use of Yahoo! 
  Groups is subject to the Yahoo! Terms>   of 
  Service.> > > >   Check AmiBroker web 
  page at:>   <A 
  href="">http://www.amibroker.com/> 
  >   Check group FAQ at:> <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html> 
  > > >         
  Yahoo! Groups 
  Sponsor>               
  ADVERTISEMENT> > > > > > 
  ----------------------------------------------------------------------------> 
  -->   Yahoo! Groups Links> 
  >     a.. To visit your group on the web, go 
  to:>     <A 
  href="">http://groups.yahoo.com/group/amibroker/> 
  >     b.. To unsubscribe from this group, send an 
  email to:>     
  amibroker-unsubscribe@xxxxxxxxxxxxxxx> >     
  c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
  Service.Check AmiBroker web page at:<A 
  href="">http://www.amibroker.com/Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  


Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 












Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.