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

Simple Code Help



PureBytes Links

Trading Reference Links

I need help with some simple code. Is it possible and if so, how can
this code be amended so that the plots only occur once per bar?
Currently, sometimes I get both directions signaling
in the same bar. I know the simple answer is to turn off the the "Update
Every Tick" feature but I want to see the plots as they occur intrabar.
Your help will be most appreciated.

ZT

Input: LenL(3), LenS(3);
Var: Swing(0), upper(c), lower(c);
Value1=Average(H, LenL);
Value2=Average(L,LenS);
upper=minlist(value1,upper[1]);
lower=maxlist(value2,lower[1]);

If C<Value2[1] And C[1]>=Value2[2] then Swing=-1;
If C>Value1[1] And C[1]<=Value1[2] then Swing=1;

if Swing=-1 then begin
 plot1(lower,"lowband");
 upper=9999999;
end;

if Swing=1 then begin
 plot2(upper,"upband");
 lower=0;
end;

IF CheckAlert Then Begin
  IF Plot1 Crosses Below Plot2 or Plot2 Crosses Above Plot1
  Then Alert = TRUE;
End;