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

Re: [EquisMetaStock Group] help with barsSince



PureBytes Links

Trading Reference Links

Juan

I'm struggling to see exactly how you intend to use this code and there are
a numbers of areas where there is redundant code. Using an If() to create a
binary result is unnecessary as a simple "a>b" will do the same thing. Also
why would yuu name a variable "Resistance", and then create another variable
called "R1". Just call it "Rl" from the start.

For construction and troubleshooting I suggest you get into the habit of
displaying some or all binary variables so that you can clearly see the
effect that each one has on the next. To do this with the indicator below I
would add the following onto the end of it

sigtl+8.75;
rsttl+7.5;
itl+6.25;
rmbtl+5;
spk+2.5;
stop+1.25;

Don't be afraid to break your code up into smaller (simpler) variables. Even
the most logical thinker can have problems with variables that are trying to
achive many things at the same time. As long as the syntax is correct you
can copy an expression to the bottom of your indicator (as I have done) and
verify that it is producing the result that you think it is. There are many
tricks to troubleshooting and you will learn best by assuming the problem
can be solved then putting in the work to find out how. Each of us have
different ideas about how to reach a goal. That's why I have trouble with
your code and you have trouble with mine. Both ways may be correct and quite
acceptable.

Write to me directly at rlarsen@xxxxxxxxxxxxxx if you're still stuck after
reviewing the code below.

Roy

  {draws resistances and supports}
LookBack := 34;
R1:=ValueWhen(1,Cross(Mov(C,LookBack,S) ,C),HHV(H, LookBack));
S1:=ValueWhen(1,Cross(C,Mov(C, LookBack,S)),LLV(L, LookBack));
  {binary latch, gives 1 if L>Resistance, and resets if H<Resistance to 0}
sigtl:=L>R1;
rsttl:=H<R1;
itl:=Cum(sigtl+rsttl>-1)=1;
rmbtl:=If(BarsSince(sigtl OR itl)<BarsSince(rsttl OR itl),1,-1);
  {rmbtl;}
  {looks for HHV since L>Resistance to place a trailing stop}
all:=If(rmbtl=0,-1,L);
  {stlongl:= If(all=-1,0,
If(HHV(H,LastValue(PREV+BarsSince(all=-1)-PREV))-ATR(6)*0.5<C,1,0));}
  {How can i solve the problem?} {stlongl;}
spk:=sigtl AND Alert(sigtl=0,2);
trail:=HighestSince(1,itl OR spk,L)-ATR(6)*0.5;
stop:=rmbtl=1 AND C<trail;
stop1:=stop AND Alert(stop=0,2);
stop1;
 {sigtl+8.75;
  rsttl+7.5;
  itl+6.25;
  rmbtl+5;
  spk+2.5;
  stop+1.25;}



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

 

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