Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register More recent Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-26-2006, 06:03 PM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
Channeling Detection

My tests are telling me a couple of things that I'd like to exploit better than I know how to exploit right now. There are so many indicators. Which one(s) would serve to detect channels best that I can build into my EA?

I can see that my EA loses when it gets near a turning point or the outer edge of a channel that reverses. Everything within the channel usually closes at TP.
My system is working off of moving average crosses. The argument is made that 'you don't know' where it's going to reverse. Well I don't think we have to know exactly. If there is an indicator that knows approximately that should be good enough. It just has to indicate that the side of a channel is near and so don't take any positions that are going to go shooting off over the edge, only take long positions at this time if it's near support and only take short positions if it's near resistance.

I have looked at one support resistance indicator but I don't know that it would work because the lines it generates are so short term and they get blown thru all the time. I'm looking for something that will identify a support resistance line that has some strength and meaning to them
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 06-27-2006, 02:33 AM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
This could work...

PHP Code:
//+------------------------------------------------------------------+
//|                                                 5dayBreakout.mq4 |
//|                                                        Bill Sica |
//|                                         http://www.tetsuyama.com |
//+------------------------------------------------------------------+
#property copyright "Bill Sica"
#property link      "http://www.tetsuyama.com"

#property indicator_chart_window
//---- input parameters
extern int       DAYS=5;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
  {
//---- indicators

//---- indicators

   

//----
   
return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
double daily_high1[20];
   
double daily_low1[20];
   
double yesterday_close;
   
double phigh,plow;
   
int i=1;

//---- TODO: add your code here
ArrayResize(daily_high1,DAYS);
ArrayResize(daily_low1,DAYS);
ArrayInitialize(daily_high1,0);
ArrayInitialize(daily_low1,0);

ArrayCopySeries(daily_low1MODE_LOWSymbol(), PERIOD_D1);
ArrayCopySeries(daily_high1MODE_HIGHSymbol(), PERIOD_D1);

/* initialise */
plow=daily_low1[1];
phigh=daily_high1[1];

for(
i=1;i<DAYS;i++)
{
   if(
plow>daily_low1[i])
   {
      
plow =daily_low1[i];
   }
}

for(
i=1;i<DAYS;i++)
{
   if(
phigh<daily_high1[i])
   {
      
phigh =daily_high1[i];
   }
}

Comment("\n5dayH ",phigh,"\n5dayL ",plow);

ObjectDelete("5dayHigh1");
ObjectDelete("5dayLow1");

ObjectCreate("5dayHigh1"OBJ_HLINE,0CurTime(),phigh);
ObjectSet("5dayHigh1",OBJPROP_COLOR,SpringGreen);
ObjectSet("5dayHigh1",OBJPROP_STYLE,STYLE_SOLID);

ObjectCreate("5dayLow1"OBJ_HLINE,0CurTime(),plow);
ObjectSet("5dayLow1",OBJPROP_COLOR,Red);
ObjectSet("5dayLow1",OBJPROP_STYLE,STYLE_SOLID);

ObjectsRedraw();

   return(
0);
  }
//+------------------------------------------------------------------ 
so could this...

PHP Code:
//+------------------------------------------------------------------+
//|                                                  SHI_Channel.mq4 |
//|                                 Copyright © 2004, Shurka & Kevin |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, Shurka & Kevin"
#property link      ""

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
double ExtMapBuffer1[];
//---- input parameters
extern int       AllBars=240;
extern int       BarsForFract=0;
int CurrentBar=0;
double Step=0;
int B1=-1,B2=-1;
int UpDown=0;
double P1=0,P2=0,PP=0;
int i=0,AB=300,BFF=0;
int ishift=0;
double iprice=0;
datetime T1,T2;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   
SetIndexStyle(0,DRAW_ARROW);
   
SetIndexArrow(0,164);
   
SetIndexBuffer(0,ExtMapBuffer1);
   
SetIndexEmptyValue(0,0.0);
   
//----
    
    
   
return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   
return(0);
  }

void DelObj()
{
    
ObjectDelete("TL1");
    
ObjectDelete("TL2");
    
ObjectDelete("MIDL");
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
int    counted_bars=IndicatorCounted();
//---- 
    
if ((AllBars==0) || (Bars<AllBars)) AB=Bars; else AB=AllBars//AB-êîëè÷åñòâî îáñ÷èòûâàåìûõ áàðîâ
    
if (BarsForFract>0
        
BFF=BarsForFract
    else
    {
        switch (
Period())
        {
            case 
1BFF=12; break;
            case 
5BFF=48; break;
            case 
15BFF=24; break;
            case 
30BFF=24; break;
            case 
60BFF=12; break;
            case 
240BFF=15; break;
            case 
1440BFF=10; break;
            case 
10080BFF=6; break;
            default: 
DelObj(); return(-1); break;
        }
    }
    
CurrentBar=2//ñ÷èòàåì ñ òðåòüåãî áàðà, ÷òîáû ôðàêòàë "çàêðåïèëñÿ
    
B1=-1B2=-1UpDown=0;
    while(((
B1==-1) || (B2==-1)) && (CurrentBar<AB))
    {
        
//UpDown=1 çíà÷èò ïåðâûé ôðàêòàë íàéäåí ñâåðõó, UpDown=-1 çíà÷èò ïåðâûé ôðàêòàë
        //íàéäåí ñíèçó, UpDown=0 çíà÷èò ôðàêòàë åù¸ íå íàéäåí.
        //Â1 è Â2 - íîìåðà áàðîâ ñ ôðàêòàëàìè, ÷åðåç íèõ ñòðîèì îïîðíóþ ëèíèþ.
        //Ð1 è Ð2 - ñîîòâåòñòâåííî öåíû ÷åðåç êîòîðûå áóäåì ëèíèþ ïðîâîäèòü

        
if((UpDown<1) && (CurrentBar==Lowest(Symbol(),Period(),MODE_LOW,BFF*2+1,CurrentBar-BFF))) 
        {
            if(
UpDown==0) { UpDown=-1B1=CurrentBarP1=Low[B1]; }
            else { 
B2=CurrentBarP2=Low[B2];}
        }
        if((
UpDown>-1) && (CurrentBar==Highest(Symbol(),Period(),MODE_HIGH,BFF*2+1,CurrentBar-BFF))) 
        {
            if(
UpDown==0) { UpDown=1B1=CurrentBarP1=High[B1]; }
            else { 
B2=CurrentBarP2=High[B2]; }
        }
        
CurrentBar++;
    }
    if((
B1==-1) || (B2==-1)) {DelObj(); return(-1);} // Çíà÷èò íå íàøëè ôðàêòàëîâ ñðåäè 300 áàðîâ 8-)
    
Step=(P2-P1)/(B2-B1);//Âû÷èñëèëè øàã, åñëè îí ïîëîæèòåëüíûé, òî êàíàë íèñõîäÿùèé
    
P1=P1-B1*StepB1=0;//ïåðåñòàâëÿåì öåíó è ïåðâûé áàð ê íóëþ
    //À òåïåðü îïîðíóþ òî÷êó ïðîòèâîïîëîæíîé ëèíèè êàíàëà.
    
ishift=0iprice=0;
    if(
UpDown==1)
    { 
        
PP=Low[2]-2*Step;
        for(
i=3;i<=B2;i++) 
        {
            if(
Low[i]<PP+Step*i) { PP=Low[i]-i*Step; }
        }
        if(
Low[0]<PP) {ishift=0iprice=PP;}
        if(
Low[1]<PP+Step) {ishift=1iprice=PP+Step;}
        if(
High[0]>P1) {ishift=0iprice=P1;}
        if(
High[1]>P1+Step) {ishift=1iprice=P1+Step;}
    } 
    else
    { 
        
PP=High[2]-2*Step;
        for(
i=3;i<=B2;i++) 
        {
            if(
High[i]>PP+Step*i) { PP=High[i]-i*Step;}
        }
        if(
Low[0]<P1) {ishift=0iprice=P1;}
        if(
Low[1]<P1+Step) {ishift=1iprice=P1+Step;}
        if(
High[0]>PP) {ishift=0iprice=PP;}
        if(
High[1]>PP+Step) {ishift=1iprice=PP+Step;}
    }
    
//Òåïåðü ïåðåñòàâèì êîíå÷íóþ öåíó è áàð íà ÀÂ, ÷òîáû ëèíèè êàíàëà ðèñîâàëèñü ïîäëèííåå
    
P2=P1+AB*Step;
    
T1=Time[B1]; T2=Time[AB];

    
//Åñëè íå áûëî ïåðåñå÷åíèÿ êàíàëà, òî 0, èíà÷å ñòàâèì ïñèñó.
    
if(iprice!=0ExtMapBuffer1[ishift]=iprice;
    
DelObj();
    
ObjectCreate("TL1",OBJ_TREND,0,T2,PP+Step*AB,T1,PP); 
        
ObjectSet("TL1",OBJPROP_COLOR,Lime); 
        
ObjectSet("TL1",OBJPROP_WIDTH,2); 
        
ObjectSet("TL1",OBJPROP_STYLE,STYLE_SOLID); 
    
ObjectCreate("TL2",OBJ_TREND,0,T2,P2,T1,P1); 
        
ObjectSet("TL2",OBJPROP_COLOR,Lime); 
        
ObjectSet("TL2",OBJPROP_WIDTH,2); 
        
ObjectSet("TL2",OBJPROP_STYLE,STYLE_SOLID); 
    
ObjectCreate("MIDL",OBJ_TREND,0,T2,(P2+PP+Step*AB)/2,T1,(P1+PP)/2);
        
ObjectSet("MIDL",OBJPROP_COLOR,Lime); 
        
ObjectSet("MIDL",OBJPROP_WIDTH,1); 
        
ObjectSet("MIDL",OBJPROP_STYLE,STYLE_DOT); 
        
double MIDL2=ObjectGet("MIDL",OBJPROP_PRICE2);
   
double MIDL1=ObjectGet("MIDL",OBJPROP_PRICE1);
   
double TL1 =ObjectGet("TL1" ,OBJPROP_PRICE2);
   
double TL2 =ObjectGet("TL2" ,OBJPROP_PRICE2);
        
Comment("Channel size = "DoubleToStr(MathAbs(PP P1)/Point,0), " Slope = "DoubleToStr(-Step/Point2),"\n","Upper SHI = "TL2" Lower SHI = "TL1);
       
//----
   
return(0);
  }
//+------------------------------------------------------------------+ 
maybe some combination of the two would work as a filter to keep my MA Cross driven EA from entering positions which would have to close outside of a high probability range.

As always if kind ambitious programmers want to take this on to see results before my learning curve allows me to do it myself...feel free.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 06-27-2006, 02:55 AM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
PHP Code:
#property  copyright "ANG3110@latchess.com"
//----------------------------------
#property indicator_chart_window
//----------------------------------
extern int Hours=24;
extern color col=SkyBlue;
//------------------
double lr,lr0,lrp;
double sx,sy,sxy,sx2,aa,bb;
int p,sName,fs;
int f,f0,f1;
double dh,dl,dh_1,dl_1,dh_2,dl_2;
int ai_1,ai_2,bi_1,bi_2
double hai,lai,dhi,dli,dhm,dlm,ha0,hap,la0,lap;
double price_p1,price_p0,price_p2,price_01,price_00,price_02;
int p1,p0,p2,fp;
//*****************************************
int init() {
p=Hours*60/Period();
if (
fs==0) {sName=CurTime(); fs=1;}
return(
0);}
//*******************************
int deinit() {
   
ObjectDelete("1"+sName);
   
ObjectDelete("0"+sName);
   
ObjectDelete("2"+sName); }
//*******************************
int start() {
int i,n;
//------------------------------------------------------------------------------
if (f==1) { 
p1=iBarShift(Symbol(),Period(),ObjectGet("1"+sName,OBJPROP_TIME1));
p0=iBarShift(Symbol(),Period(),ObjectGet("0"+sName,OBJPROP_TIME1));
p2=iBarShift(Symbol(),Period(),ObjectGet("2"+sName,OBJPROP_TIME1));
if (
fp==&& p!=p1) {p=p1fp=1;}
if (
fp==&& p!=p0) {p=p0fp=1;}
if (
fp==&& p!=p2) {p=p2fp=1;}
}
//====================================================
sx=0sy=0sxy=0sx2=0
for (
n=0n<=pn++) {sx+=nsy+=Close[n]; sxy+=n*Close[n]; sx2+=MathPow(n,2);}   
aa=(sx*sy-(p+1)*sxy)/(MathPow(sx,2)-(p+1)*sx2); bb=(sy-aa*sx)/(p+1);
//----------------------------------------------------
for (i=0i<=pi++) {
lr=bb+aa*i;
dh=High[i]-lrdl=Low[i]-lr;
//----------------------------------------------------
if (i<p/2) {if (i==0) {dh_1=0.0dl_1=0.0ai_1=ibi_1=i;} 
if (
dh>=dh_1) {dh_1=dhai_1=i;}
if (
dl<=dl_1) {dl_1=dlbi_1=i;}}  
//----------------------------------------------------
if (i>=p/2) {if (i==p/2) {dh_2=0.0dl_2=0.0ai_2=ibi_2=i;} 
if (
dh>=dh_2) {dh_2=dhai_2=i;}
if (
dl<=dl_2) {dl_2=dlbi_2=i;}}} 
//-------------------------------------
lr0=bblrp=bb+aa*(i+p);
//===================================================
if (MathAbs(ai_1-ai_2)>MathAbs(bi_1-bi_2)) f=1;
if (
MathAbs(ai_1-ai_2)<MathAbs(bi_1-bi_2)) f=2;
if (
MathAbs(ai_1-ai_2)==MathAbs(bi_1-bi_2)) {if (MathAbs(dh_1-dh_2)<MathAbs(dl_1-dl_2)) f=1; if (MathAbs(dh_1-dh_2)>=MathAbs(dl_1-dl_2)) f=2;} 
//=================================================
if (f==1) {
for (
n=0n<=20n++) { f1=0;
for (
i=0i<=pi++) {hai=High[ai_1]*(i-ai_2)/(ai_1-ai_2)+High[ai_2]*(i-ai_1)/(ai_2-ai_1);  
if (
i==|| i==p/2dhm=0.0
if (
High[i]-hai>dhm && i<p/2) {ai_1=if1=1;}
if (
High[i]-hai>dhm && i>=p/2) {ai_2=if1=1;} }
if (
f==0) break;} 
//----------------------------
for (i=0i<=pi++) {hai=High[ai_1]*(i-ai_2)/(ai_1-ai_2)+High[ai_2]*(i-ai_1)/(ai_2-ai_1);  
dli=Low[i]-hai
if (
i==0dlm=0.0; if (dli<dlmdlm=dli;}   
ha0=High[ai_1]*(0-ai_2)/(ai_1-ai_2)+High[ai_2]*(0-ai_1)/(ai_2-ai_1); 
hap=High[ai_1]*(p-ai_2)/(ai_1-ai_2)+High[ai_2]*(p-ai_1)/(ai_2-ai_1);
//----------------------------
price_p1=hap;
price_p0=hap+dlm/2;
price_p2=hap+dlm;
price_01=ha0;
price_00=ha0+dlm/2;
price_02=ha0+dlm;
}
//=================================================
if (f==2) {
for (
n=0n<=20n++) { f1=0;
for (
i=0i<=pi++) {lai=Low[bi_1]*(i-bi_2)/(bi_1-bi_2)+Low[bi_2]*(i-bi_1)/(bi_2-bi_1); 
if (
i==|| i==p/2dlm=0.0
if (
Low[i]-lai<dlm && i<p/2) {bi_1=if1=1;}
if (
Low[i]-lai<dlm && i>=p/2) {bi_2=if1=1;}} 
if (
f==0) break;}
//----------------------------
for (i=0i<=pi++) {lai=Low[bi_1]*(i-bi_2)/(bi_1-bi_2)+Low[bi_2]*(i-bi_1)/(bi_2-bi_1); 
dhi=High[i]-lai;
if (
i==0dhm=0.0; if (dhi>dhmdhm=dhi;}   
la0=Low[bi_1]*(0-bi_2)/(bi_1-bi_2)+Low[bi_2]*(0-bi_1)/(bi_2-bi_1); 
lap=Low[bi_1]*(p-bi_2)/(bi_1-bi_2)+Low[bi_2]*(p-bi_1)/(bi_2-bi_1);
//----------------------------------------------------------------
price_p1=lap;
price_p0=lap+dhm/2;
price_p2=lap+dhm;
price_01=la0;
price_00=la0+dhm/2;
price_02=la0+dhm;
}
//===================================================================================
ObjectCreate("1"+sName,20,Time[p],price_p1,Time[0],price_01);
ObjectCreate("0"+sName,20,Time[p],price_p0,Time[0],price_00);
ObjectCreate("2"+sName,20,Time[p],price_p2,Time[0],price_02);
//-----------------------------------------------------------------
ObjectSet("1"+sName,OBJPROP_COLOR,col);
ObjectSet("0"+sName,OBJPROP_COLOR,col);
ObjectSet("0"+sName,OBJPROP_STYLE,STYLE_DOT);
ObjectSet("2"+sName,OBJPROP_COLOR,col);
//---------------------------------------------
ObjectSet("1"+sName,OBJPROP_TIME1,Time[p]);
ObjectSet("1"+sName,OBJPROP_PRICE1,price_p1);
ObjectSet("1"+sName,OBJPROP_TIME2,Time[0]);
ObjectSet("1"+sName,OBJPROP_PRICE2,price_01);
ObjectSet("0"+sName,OBJPROP_TIME1,Time[p]);
ObjectSet("0"+sName,OBJPROP_PRICE1,price_p0);
ObjectSet("0"+sName,OBJPROP_TIME2,Time[0]);
ObjectSet("0"+sName,OBJPROP_PRICE2,price_00);
ObjectSet("2"+sName,OBJPROP_TIME1,Time[p]);
ObjectSet("2"+sName,OBJPROP_PRICE1,price_p2);
ObjectSet("2"+sName,OBJPROP_TIME2,Time[0]);
ObjectSet("2"+sName,OBJPROP_PRICE2,price_02);
//==================================================================
f=1p1=pp0=pp2=pfp=0
//*************************************************************************************
return(0);}
//===================================================================================== 
ok this one doesn't give me different slopes on each time frame. It depends on how far back I draw the lines as to what the slope is...

hum, that's three ways to do it now...

one that uses highest highs and lowest lows, one that slopes divergent ways and this one....I'm shy on the one what gives divergent slopes in each TF. If I'm making a filter from it I can't wrap my mind around the slope changing so volitily.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 06-27-2006, 03:24 AM
increase's Avatar
Senior Member
 
Join Date: May 2006
Posts: 845
increase is on a distinguished road
Waiting with bated breath for your outcome

Last edited by increase; 06-27-2006 at 03:27 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 06-27-2006, 05:02 AM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
Quote:
Originally Posted by increase
Waiting with bated breath for your outcome
me too. I only wish I could code well enough to pull it off right now myself. I'm still going to need tutoring with the programming end of it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Divergence Detection Indicator goover Indicators - Metatrader 4 17 05-08-2009 05:19 PM
Has anyone been using FX_Fish for trend reversal detection? zeroz Indicators - Metatrader 4 5 03-11-2006 07:45 PM


All times are GMT. The time now is 06:28 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.