Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > Metatrader 4


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 04-17-2006, 10:03 AM
pete7's Avatar
Member
 
Join Date: Jan 2006
Posts: 92
pete7 is on a distinguished road
Consolidation Lines // Not working

Hiho all forex traders and fellow MT4 programmers,
lately I was working on an indicator which should show me consolidation lines. Here is how it *should* work:
1.There is a cross of 2 MA's (any type i.e. SMA, EMA, etc.);
2.Right after ther cross we start to draw line.
3.When the price (I am using Close) crosses the line we stop drawing the line.

Here is the code I came up with *BUT* it is working strane however. Sometimes only one dot occurs and the ind. stops to draw more (the line I am talking about is made of dots). Can you tell me what is wrong with my code (Corss func. which is imported from my library is excactly the same as one in developing course in this forum, btw. thanks for this course) ?

Quote:
int start()
{
int counted_bars=IndicatorCounted();
//----
time=Bars;
ArrayResize(tempUPL, time);
for(i=time;i>0;i--){
MA1=NormalizeDouble(iCustom(NULL,0,"Moving_Average ",MA1Period,MA1Price,MA1Type,0,i),4);
MA2=NormalizeDouble(iCustom(NULL,0,"Moving_Average ",MA2Period,MA2Price,MA2Type,0,i),4);
ConsEntry=Cross1(MA1,MA2);
if(ConsEntry!=0){
ConsPrice=iClose(NULL,0,i);
ConsCond=1;
ConsExit = 0;
tempUPL[i]=ConsPrice+(Consolidation/2)*Point;
}
if(ConsCond==1){
if(Cross2(UPL[i],iClose(NULL,0,i))!=0){
ConsExit=1;
ConsCond=0;
}
}
if(ConsCond==1 || ConsExit==1){
tempUPL[i]=ConsPrice+(Consolidation/2)*Point;
}
if(ConsCond!=0 || ConsExit!=0){
UPL[i]=tempUPL[i];
} else if (ConsCond==0 && ConsExit==0) {
UPL[i]=0;
}
ConsEntry=0;
ConsExit=0;

}
where Moving_Average is my own version of MA and I know that it is working 100% correctly.

Please help me if you can. Thank you in advance!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2006, 12:27 PM
pete7's Avatar
Member
 
Join Date: Jan 2006
Posts: 92
pete7 is on a distinguished road
Cool... even not a one reply... so here you have .mq4 file. It is the ind. I have told you about. Now can you tell me why there are some single dots not lines?
After putting this ind. wait some time to see that it has counted all the vaules (some lines will be cut) or put it on the chart and restart MT4.
Attached Files
File Type: mq4 MA_Upper_Consolidation_Lines.mq4 (3.0 KB, 33 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-17-2006, 12:43 PM
Senior Member
 
Join Date: Jan 2006
Location: 3rd rock from the sun
Posts: 131
fred is on a distinguished road
Give it sometime as we are in the holidays at the moment, you will probably get a reply later this week.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-17-2006, 01:01 PM
pete7's Avatar
Member
 
Join Date: Jan 2006
Posts: 92
pete7 is on a distinguished road
ok. just remeber... this topic is like samsung: everyone invited!

Last edited by pete7; 04-17-2006 at 01:15 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-17-2006, 01:06 PM
Administrator
 
Join Date: Sep 2005
Posts: 16,701
Blog Entries: 137
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
It should be PKlibrary.ex4 file for this indicator.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-17-2006, 01:18 PM
pete7's Avatar
Member
 
Join Date: Jan 2006
Posts: 92
pete7 is on a distinguished road
my bad, my bad... here it is. Sorry.
Attached Files
File Type: mq4 PKLibrary.mq4 (2.9 KB, 39 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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
What has been working? matrixebiz Expert Advisors - Metatrader 4 18 03-10-2008 12:58 PM
Working indicator not working yuhu Indicators - Metatrader 4 0 05-25-2007 02:38 AM
TD sequential and TD lines amarnath Indicators - Metatrader 4 1 03-02-2007 09:37 AM
adx not working hidethereal Indicators - Metatrader 4 1 07-24-2006 10:14 PM
Trading the lines ForexStyle Questions 0 03-19-2006 06:08 AM


All times are GMT. The time now is 08:30 AM.



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