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

Re: [EquisMetaStock Group] help with barsSince



PureBytes Links

Trading Reference Links




Ah-Ha!
 
Yep, now that you jog my memory, I remember your neat code to 
cover that first trade situation. (Wow, been a while.)
 
My apologies!
 
In all of the instances that I tried, 
 
<FONT face="Courier New" 
size=3>Cum(sigtl+rsttl>-1)=1;<FONT 
face="Courier New" size=3>
worked the same as
 
<FONT face="Courier New" 
size=3>Cum(sigtl+rsttl)=1;
Probably luck.
 
I don't use MS much anymore. 
Now that I see the object, I need to refresh some brain cells 
and look at this some more.
 
Thanks,
Corey Saxe
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Roy 
  Larsen 
  To: <A 
  title=equismetastock@xxxxxxxxxxxxxxx 
  href="">equismetastock@xxxxxxxxxxxxxxx 
  
  Sent: Monday, March 10, 2003 11:39 
  AM
  Subject: Re: [EquisMetaStock Group] help 
  with barsSince
  CoreyThis construction is mine (not the code but 
  the method behind it) and it iscorrect just as it is. The variable is used 
  for what I call"initialisation", and my layout would be 
  I:=Cum(N+X>-1)=1;The primary purpose of this variable is to give a 
  1 bar true output for theFIRST bar where all component binary (or 
  positive) variables are VALID. Onceall components are valid (zero or 
  greater, but not N/A) the cum count willreturn a "one", and then return 
  "zero" for every subsequent bar. This is themost concise way I know to 
  write code to do this. I use the "I" variable asa fake buy or sell with a 
  simple (non-PREV) latch as in "BarsSince(I ORN)<BarSince(I OR X);". 
  This usage prevents missing the first signal butwon't function until both 
  'N' and 'X' are valid. 'I' provides a startingreference point on a chart 
  that enables latches and the like to be kickedoff in an orderly 
  fashion.I also find the 'I' variable useful with the ValueWhen() 
  function toeliminate the long periods of N/A that can result with 
  irregular signals.This becomes more significant when attempting to 
  back-test on early chartdata where any N/A bar can have, and often does 
  have, a cumulative effect onsubsequent variables.Hope this 
  explains my thinking behind the 'I' variable.Roy----- 
  Original Message -----From: "CS" <csaxe@xxxxxxx>To: 
  <equismetastock@xxxxxxxxxxxxxxx>Sent: Tuesday, March 11, 2003 7:04 
  AMSubject: Re: [EquisMetaStock Group] help with barsSinceI got 
  in on this late but will try to take a stab it this.I ran your code 
  and am not sure if the logic is correct.When I plot the 
  line:itl:=Cum(sigtl+rsttl>-1)=1;It only works once at the very 
  beginning of the chart. Since either sigtl orrsttl can only be 0 or 1, the 
  addition of both sigtl and rsttl will begreater than -1 very quickly and 
  stay that way. Cum will only find the firstinstance where sigtl and rsttl 
  are greater than -1. Besides, you have aBoolean operation (rsttl>-1) 
  mixed within a math operation (sigtl+rsttl),both within Cum. While they 
  may be allowed, they can get confusing quickly.I usually see lines 
  like that written as:itl:=Cum(sigtl+rsttl)=1; {does the same thing with 
  less code}If you want to check for each instance where sigtl and rsttl 
  are greaterthan -1, use Sum or ValueWhen.I also see where you 
  calculate rmbts and do nothing with it. Is it for ashort exit?I 
  would suggest that you plot each variable separately. See what they do 
  andwhen. Work your way down through your formula.Being able to use 
  LastValue(X +PREV-PREV) to trick functions to acceptdynamic inputs in MS 
  helps to create formulas that can tune themselves, buta MAJOR re-write of 
  MS formula language is about 5 years past due.-Corey 
  Saxe  ----- Original Message -----  From: 
  emarco  To: equismetastock@xxxxxxxxxxxxxxx  Sent: Sunday, 
  March 09, 2003 7:29 PM  Subject: Re: [EquisMetaStock Group] help with 
  barsSince  Thanks Roy.  Unfortunatly it does not 
  work.  Here's the full code. Thanks again,  
  Juan  LookBack := 34;  Resistance 
  :=ValueWhen(1,Cross(Mov(C, LookBack,S),C),HHV(H, LookBack));  
  Support :=ValueWhen(1,Cross(C,Mov(C, LookBack,S)),LLV(L, 
  LookBack));  R1:=Resistance;  
  S1:=Support;  sigtl:=If(L>R1,1,0);  
  sigts:=If(H<S1,1,0);  rsttl:=If(H<R1,1,0);  
  rstts:=If(L>S1,1,0);  
  itl:=Cum(sigtl+rsttl>-1)=1;  
  its:=Cum(sigts+rstts>-1)=1;  rmbtl:=BarsSince(sigtl OR 
  itl)<BarsSince(rsttl OR itl);  rmbts:=BarsSince(sigts OR 
  its)<BarsSince(rstts OR 
  its);stlong:=If(HHV(H,LastValue(PREV+BarsSince(rmbtl=0)-PREV))-ATR(6)*2.5<C,1,0);  
  stlong;  ----- Original Message -----  From: 
  "Roy Larsen" <rlarsen@xxxxxxxxxxxxxx>  To: 
  <equismetastock@xxxxxxxxxxxxxxx>  Sent: Sunday, March 09, 2003 
  6:38 PM  Subject: Re: [EquisMetaStock Group] help with 
  barsSince  > Juan  >  > Thanks to 
  Corey Saxe there is a way that MS will accept a variable as  > 
  constant. Try redefining your variable using  > 
  LastValue(PREV+"Variable Data"-PREV)  >  > This method 
  does not work on every occasion but there are a couple of  
  things  > you can do to help.  > 1. Make sure your 
  variable is greater than or equal to one.  > 2. Make sure your 
  variable is a whole number.  >  > LastValue() can be 
  used in a number of situations to make a result  suitable  
  > for using as a constant, but only where the last value of the 
  variableis  > the same as on every other bar. The above 
  example of adding then  subtracting  > PREV from the 
  current value appears to return the "actual" value rather  
  than  > the "last" value, and therefore is accepted as a 
  "constant" by many MS  > functions.  >  > 
  I have some doubts about the code you have given as an example and 
  doubt  it  > could work in its present form even without 
  MetaStock's perceived  > inadequacies. The code appears to be 
  looking for results from two If()  > statements yet I can only see 
  one If(). It also seems to me that the  > calculated "constant" 
  for the HHV periods has no check to ensure that it  is  > 
  a whole number.  >  > When looking for assistance with 
  code it is also helpful if associated  code  > can be 
  supplied. You may know how "rmbtl" is calculated but 
  thosecapable  of  > offering help won't. Providing 
  actual code or at least a working  substitute  > will 
  increase your chances of real help that goes beyond "buy some more  
  > software".  >  > Good luck with your attempts to 
  solve your problem whichever method you  > choose to 
  use.  >  > Roy  >  > ----- 
  Original Message -----  > From: "emarco" 
  <emarco@xxxxxxxxxxxxxxx>  > To: 
  <equismetastock@xxxxxxxxxxxxxxx>  > Sent: Saturday, March 
  08, 2003 11:37 AM  > Subject: [EquisMetaStock Group] help with 
  barsSince  >  >  > This is a trailing 
  stop. The problem is that MS does not accept variable  > data in 
  HHV.  >  >  >  > 
  stlong:=if(HHV(H,BarsSince(rmbtl=0))-ATR(6)*2.5>C,1,0),1,0)  
  >  >  > As you can see, MS does not accept 
  barssince as a period data.  > How can I solve this 
  problem?  > Thanks  >  > Juan  
  >  >  >  >  >  
  > To unsubscribe from this group, send an email to:  > 
  equismetastock-unsubscribe@xxxxxxxxxxxxxxx  >  
  >  >  > Your use of Yahoo! Groups is subject 
  to<A 
  href="">http://docs.yahoo.com/info/terms/  
  >  >        
  Yahoo! Groups 
  Sponsor              
  ADVERTISEMENT  To unsubscribe from this group, send 
  an email to:  
  equismetastock-unsubscribe@xxxxxxxxxxxxxxx  Your use of 
  Yahoo! Groups is subject to the Yahoo! Terms of Service.To 
  unsubscribe from this group, send an email 
  to:equismetastock-unsubscribe@xxxxxxxxxxxxxxxYour 
  use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT









To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx





Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.