Forex
Google

Go Back   Forex Trading > Discussion Areas > Metatrader 4
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-31-2005, 07:18 AM
hua hua is offline
Member
 
Join Date: Oct 2005
Location: Athens
Posts: 75
hua is on a distinguished road
Ask

Dear Codersguru, is it possible an alert when ''ang_Amp_ZZ'' changing direction?? Tks vm in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-31-2005, 01:20 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow Alerts on ang_Amp_ZZ direction changing.

Quote:
Originally Posted by hua
Dear Codersguru, is it possible an alert when ''ang_Amp_ZZ'' changing direction?? Tks vm in advance.
Hi hua,
Happy new year!
Please try this code (I didn't test it because it's Saturday)

PHP Code:
#property  copyright "ANG3110@latchess.com"
//-------------ang_Amp_ZZ---------------
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LemonChiffon
#property indicator_color2 LemonChiffon 
#property indicator_color3 Blue
//--------------------------------
extern int d=40;
//---------------------------------
double ha[],la[],zz[];
double hi,li,hm,lm,di,j;
int f,f1,ai,bi,aii,bii,f0,aibar,bibar;
di=d*Point;
//----------------------------------------------
int init()  {   
SetIndexStyle(0,DRAW_LINE);   
SetIndexBuffer(0,ha);   
SetIndexBuffer(1,la);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(2,zz);
return(
0);  }
//================================
int start()  {   
//--------------------------------
int i,n,cb,cbi,cbn,fs,bar;
//------------------------
//cb=IndicatorCounted();
//if (cb<0) return (-1);
//if (cb>0) cb--;
//cbi=Bars-cb;
//if (Bars<bar | Bars-bar>1) fs=0; bar=Bars;
//if (fs==0) {cbi=Bars-1; cbn=Bars-1; if (cbi<0) return(0); fs=1;}
cbi=Bars-IndicatorCounted()-1;
//-----------------------
//cbi=cbi+1;
for(i=cbii>=0i--){                             
if (
i>=Bars-2) {hi=High[i]; li=Low[i];}      
//==============================================================
if (Low[i]>hi) {hi=Low[i]; if (hi>=li+dili=hi-di;}
if (
High[i]<li) {li=High[i]; if (li<=hi-dihi=li+di;}
//------------------------------------------------------------------------------------

if (High[i]>hi && Low[i]<li) {if (High[i]-hi>li-Low[i]) {f1=1;} else f1=2;} else f1=0;
if (
f==&& High[i]>hi) {hm=High[i]; ai=if=1;}
if (
f==&& Low[i]<li) {lm=Low[i]; bi=if=2;}

if (
f==&& High[i]>hi && f1!=2) {hm=High[i]; f=1f0=0; for (n=ain>=bin--) {zz[n]=High[ai]*(n-bi)/(ai-bi)+Low[bi]*(n-ai)/(bi-ai);} ai=i;}
if (
f==&& High[i]>hm && f1!=2) {hm=High[i]; ai=if0=0;}
if (
f==&& Low[i]<li && f1!=1) {lm=Low[i]; f=2f0=0; for (n=bin>=ain--) {zz[n]=High[ai]*(n-bi)/(ai-bi)+Low[bi]*(n-ai)/(bi-ai);} bi=i;}
if (
f==&& Low[i]<lm && f1!=1)  {lm=Low[i];  bi=if0=0;}
//---------------------------------------------
if (i==&& f0==0) {aibar=Bars-aibibar=Bars-bif0=1;} 
if (
f0==1) {ai=Bars-aibarbi=Bars-bibar;} 

if (
i==&& ai>bi) for (n=ain>=bin--) {zz[n]=High[ai]*(n-bi)/(ai-bi)+Low[bi]*(n-ai)/(bi-ai);}
if (
i==&& ai<bi) for (n=bin>=ain--) {zz[n]=High[ai]*(n-bi)/(ai-bi)+Low[bi]*(n-ai)/(bi-ai);}

if (
i==&& f==1) {for (n=ain>=0n--) {zz[n]=Close[0]*(n-ai)/(0-ai)+High[ai]*(n-0)/(ai-0);}}
if (
i==&& f==2) {for (n=bin>=0n--) {zz[n]=Close[0]*(n-bi)/(0-bi)+Low[bi]*(n-0)/(bi-0);}}
if (
i==&& bi==0) {for (n=ain>=0n--) {zz[n]=Low[0]*(n-ai)/(0-ai)+High[ai]*(n-0)/(ai-0); }}
if (
i==&& ai==0) {for (n=bin>=0n--) {zz[n]=High[0]*(n-bi)/(0-bi)+Low[bi]*(n-0)/(bi-0); }}
//--------------------------------------------
ha[i]=hi;
la[i]=li;

Print(
zz[i]);



//cbi=cbi-1;
}


static 
string last_direction "";
string current_dirction "";

if ( (
zz[1] - zz[0]) > current_dirction "down";
if ( (
zz[1] - zz[0]) < current_dirction "up";



if(
current_dirction != last_direction
{
      
Alert("Direction has been changed " current_dirction);
      
last_direction current_dirction;
}

 
//------------------------------------
return(0);  } 
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-31-2005, 03:07 PM
hua hua is offline
Member
 
Join Date: Oct 2005
Location: Athens
Posts: 75
hua is on a distinguished road
Tks vm indeed. HAPPY NEW YEAR.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-15-2006, 11:21 AM
alp alp is offline
Senior Member
 
Join Date: Nov 2005
Posts: 108
alp is an unknown quantity at this point
Alert script needed..

Hi Guru,

I'm wondering if it's possible to write a script or EA to alert on highest high and lowest low of the preceding 6 bars excluding current (zero) one.
There should be moving alerts for this zigzag breakout system (see attachments).

The idea is when a new bar enters and the old one leaves both alerts may take new values depending on the current 6 bar structure.


Thanks in advance
alp
Attached Files
File Type: mq4 High_Low v2 (ZigZag).mq4 (3.1 KB, 665 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-15-2006, 12:22 PM
kamyar's Avatar
kamyar kamyar is offline
Senior Member
 
Join Date: Dec 2005
Location: Iran
Posts: 635
kamyar is on a distinguished road
hi coder

i have problem with my indicator.i want to draw the parabolic sar dots of the m5 and and m15 and m30 and h1 in the same time in a chart but i cant .
would u help me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-03-2007, 04:11 PM
Zack Zack is offline
Junior Member
 
Join Date: Dec 2006
Posts: 2
Zack is on a distinguished road
Problem with the code for ''ang_Amp_ZZ''

Quote:
Originally Posted by hua
Dear Codersguru, is it possible an alert when ''ang_Amp_ZZ'' changing direction?? Tks vm in advance.

Sorry,

My mistake!

Respectfully

Zack

Last edited by Zack : 01-04-2007 at 09:38 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump



All times are GMT. The time now is 09:59 PM.