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

Re: Can MS do loops?



PureBytes Links

Trading Reference Links

Martin - 
Excellent idea. I love it. I will be sure to try it out when I get a chance.
Thanks. 

You mention in your example of previous that it bogs your machine down a
bunch. Would it help to move the previous value to a holding variable. Perhaps
the machine would not have to reconstruct the set of values for each iteration
of the statement. ex:
if(buy,hold:=1,
if(sell,0,hold:));
Does this make sense? Will that help performance for you? 
Thanks again
Chris

I do have a couple of comments embedded in the text below.
In a message dated 9/15/98 8:49:30 AM Eastern Daylight Time,
mhaesler@xxxxxxxxxxxxxx writes:
> Hi ...
>  
>  "previous" provides the pervious value of a formula or variable.
>  
>  suppose you have a formula that gives you only a blip (to a true state ie 
> value
>  one)
>  
>  eg
>  buy:=cross(c,mov(c,21,e));
>  and
>  sell:=cross(mov(c,21,e),c);
>  
>  these signals respectively will give a blip to a one when the close crosses
> to
>  above the 21 day exponential moving average and subseqently when it drops 
> below.
>  ie they will switch to one for only one bar.
>  
>  If you wanted to convert these two blips into a "am long" and "am out" 
> signal to
>  use in the expert to colour being long as green, and being out as blue, you
> could
>  convert the two blips into a square wave by using the following formula
>  
>  if(buy,1,
>  if(sell,0,previous));
>  
>  ie if we have a buy blip switch to value one, if we have a sell blip switch
> to
>  value zero otherwise hold the previous value. This would switch to one on 
> the buy
>  blip and then hold this value until we had a sell blip, at which time it 
> would
>  switch to zero and stay there until we had another buy blip.
>  
>  I have found the "previous" function invaluable when picking up and holding
> values
>  to use in indicators and experts. eg you can use the valuewhen function to 
> pick up
>  the buy value on a buy blip and the sell value on a sell blip. But they 
> appear
>  only for an instant (one bar). The "previous" function holds the values so 
> that
>  you can subseqently deduct the buy value from the sell value to determine 
> the
>  profit.
>  
>  However, be warned that the "previous" function is very compute demanding 
> and when
>  used over a long set of data, your machine may appear to "stall"
>  
>  Regards ... Martin
>