Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > Setup Questions


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 (2) Thread Tools Display Modes
  #11 (permalink)  
Old 06-28-2006, 10:44 PM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
here's the whole indicator for reference...

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);}
//===================================================================================== 
Attached Images
File Type: gif autochindicator.gif (14.1 KB, 75 views)

Last edited by Aaragorn; 06-28-2006 at 10:53 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 06-29-2006, 03:03 AM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
ObjectCreate("1"+sName,2, 0,Time[p],price_p1,Time[0],price_01);
ObjectCreate("0"+sName,2, 0,Time[p],price_p0,Time[0],price_00);
ObjectCreate("2"+sName,2, 0,Time[p],price_p2,Time[0],price_02);


ok i think the "1" is the losest line, the "0" is the middle dotted line, and the "2" is the upper line. I decude that from the fact that when I put my mouse over the lines they each have an object number associated with them and that number is the same except for the first digit.

The three object trendlines are
#01151541601
#11151541601
#21151541601
according to the object list.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 06-29-2006, 04:55 AM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
this indicator has no buffer!!! oy how do you use an indicator in an EA which has no buffer?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 06-29-2006, 09:07 AM
Administrator
 
Join Date: Sep 2005
Posts: 15,982
Blog Entries: 69
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Quote:
Originally Posted by Aaragorn
channeling mostly...
actually I have one indicator I think would work....I need help adding it...
help adding indicator as filter and to modify EAs
Aaragorn,

I don't know. I am not guru in coding.
I don't know how to add custom indicator which does not have buffer.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 06-29-2006, 02:51 PM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
is there a good channeling indicator that DOES have a buffer?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 06-29-2006, 03:17 PM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
ok lets see how to make this one work..

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
    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))
    {
    

        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);} 
    
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[