Coding Forum Collaborate, receive help, or discuss indicators and other coding-related topics

04-11-2016, 12:53 AM   #1

Join Date: Apr 2007
Location: Andalusia
Posts: 24

Thanks: 3
Thanked 2 Times in 2 Posts

Coding Problem

I am having problems finding new highs or lows when the macd crosses under 0 line.
It seems to plot with cross above zero line. I am trying to reset the time with cross overs of zeroline. With cross over it needs to reset the time and from there start finding new higher highs and lows etc.
Any help would be much appreciated.
Thanks

{Start of code_____EasyLanguage____ _________________________ _____}

var: HH(0), LL(0),TimeOK(false),start (0),var10(0);

{"Macd Added"____Need to reset time or Start as macd crosses over 0 line-from Data2--Then Reset highs and lows and start looking from there for new Highs Lows from new start time____________________}
inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;

var0 = MACD ( Close , FastLength , SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;

condition1 = var0 {data2 }crosses over 0 {data2} ;
if condition1 then begin
var10=time_s;
var10=time;

start=var10 ;

end;
condition2 = var0 crosses under 0 ;
if condition2 then begin
var10=time_s;
{start=time ;}

start=var10 ;
var10=time;
end;

{High Low find from Time reset }
TimeOK = time >= start ;

if TimeOK = false then begin
HH = high;
LL = low;
noplot(1) ;
noplot(2);
end else begin
if high > HH Then begin
HH = high;

plot1(HH,"HH",red );
end;
if Low < LL then begin
LL = low;

plot2(LL,"LL",cyan );

end;
end;

 Thread Tools Display Modes Help Others By Rating This Thread Linear Mode Help Others By Rating This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 ∧ Similar Threads Thread Thread Starter Forum Replies Last Post ianpal General Discussion 1 03-23-2009 05:37 PM hogarstrasni Beginners Forum 1 02-16-2009 07:33 AM ian Support Center 5 11-24-2008 05:29 AM james_gsx General Discussion 13 07-11-2008 09:24 PM kyle Beginners Forum 14 11-06-2006 03:33 AM

### Website Terms

All times are GMT -4. The time now is 11:51 PM.