Forex
Google

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions
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 (2) Thread Tools Display Modes
  #81 (permalink)  
Old 04-17-2006, 03:35 PM
firedave's Avatar
firedave firedave is offline
Senior Member
 
Join Date: Nov 2005
Location: Jakarta, Indonesia
Posts: 416
firedave is on a distinguished road
Hi Gordon, as you can see on the code you've just posted, if you like to change the color permanent, just change ALL WHITE and RED word to whatever color you like, then compile the custom indicator. Please let me know should this could solve your problem. Hope this help
__________________
David Michael H
"Trader helps traders with sincerity, honesty and integrity"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #82 (permalink)  
Old 04-17-2006, 03:56 PM
Bongo Bongo is offline
Senior Member
 
Join Date: Oct 2005
Posts: 278
Bongo is on a distinguished road
Ask????

Hi All,
EA is opening 2 positions
at the same time, same pairs.
Could u please check this.
Thanks, Bongo

int cnt = 0;

string OrderValueSymbol(int index)
{
OrderSelect(index, SELECT_BY_POS);
return(OrderSymbol());
}

int start()
{

if( Bars < 20 ) return(0);

for(cnt=1;cnt<=OrdersTotal();cnt++) {
if( OrderValueSymbol(cnt) == Symbol() )
{
Order = 1;
break;
}
else
{
Order = 0;
}
}

if( OrdersTotal() == 0 ) Order = 0;
if( OrdersTotal() < 5 && Order == 0 )
etc....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #83 (permalink)  
Old 04-17-2006, 04:03 PM
gordon gordon is offline
Member
 
Join Date: Apr 2006
Posts: 61
gordon is on a distinguished road
Hi Dave,
Getting an error message when I try to compile, obviously I am missing something. Message below


'indicator_color2' - defined value expected E:\Program Files\MetaTrader 4\experts\indicators\Heiken Ashi.mq4 (18, 1)

Gordon
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #84 (permalink)  
Old 04-17-2006, 05:09 PM
firedave's Avatar
firedave firedave is offline
Senior Member
 
Join Date: Nov 2005
Location: Jakarta, Indonesia
Posts: 416
firedave is on a distinguished road
Quote:
Originally Posted by gordon
Hi Dave,
Getting an error message when I try to compile, obviously I am missing something. Message below


'indicator_color2' - defined value expected E:\Program Files\MetaTrader 4\experts\indicators\Heiken Ashi.mq4 (18, 1)

Gordon
Hi Gordon, please post your modified code, I will take a look at it. Also let me know, what color you like for WHITE and RED ? Hope this help
__________________
David Michael H
"Trader helps traders with sincerity, honesty and integrity"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #85 (permalink)  
Old 04-17-2006, 05:22 PM
firedave's Avatar
firedave firedave is offline
Senior Member
 
Join Date: Nov 2005
Location: Jakarta, Indonesia
Posts: 416
firedave is on a distinguished road
Quote:
Originally Posted by Bongo
Hi All,
EA is opening 2 positions
at the same time, same pairs.
Could u please check this.
Thanks, Bongo

int cnt = 0;

string OrderValueSymbol(int index)
{
OrderSelect(index, SELECT_BY_POS);
return(OrderSymbol());
}

int start()
{

if( Bars < 20 ) return(0);

for(cnt=1;cnt<=OrdersTotal();cnt++) {
if( OrderValueSymbol(cnt) == Symbol() )
{
Order = 1;
break;
}
else
{
Order = 0;
}
}

if( OrdersTotal() == 0 ) Order = 0;
if( OrdersTotal() < 5 && Order == 0 )
etc....
IMHO the multiple entry could happen if you test it on multiple pairs. How many pairs did you run the EA on the same time ?
__________________
David Michael H
"Trader helps traders with sincerity, honesty and integrity"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #86 (permalink)  
Old 04-17-2006, 08:20 PM
gordon gordon is offline
Member
 
Join Date: Apr 2006
Posts: 61
gordon is on a distinguished road
Thanks again Dave,
Blue for buy, red for sell.


#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 blue
#property indicator_color3 Red
#property indicator_color4 blue
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, Red);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, blue);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, Red);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3, blue);
SetIndexBuffer(3, ExtMapBuffer4);
//----
SetIndexDrawBegin(0,10);
SetIndexDrawBegin(1,10);
SetIndexDrawBegin(2,10);
SetIndexDrawBegin(3,10);
//---- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexBuffer(3,ExtMapBuffer4);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double haOpen, haHigh, haLow, haClose;
if(Bars<=10) return(0);
ExtCountedBars=IndicatorCounted();
//---- check for possible errors
if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
int pos=Bars-ExtCountedBars-1;
while(pos>=0)
{
haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2;
haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4;
haHigh=MathMax(High[pos], MathMax(haOpen, haClose));
haLow=MathMin(Low[pos], MathMin(haOpen, haClose));
if (haOpen<haClose)
{
ExtMapBuffer1[pos]=haLow;
ExtMapBuffer2[pos]=haHigh;
}
else
{
ExtMapBuffer1[pos]=haHigh;
ExtMapBuffer2[pos]=haLow;
}
ExtMapBuffer3[pos]=haOpen;
ExtMapBuffer4[pos]=haClose;
pos--;
}
//----
return(0);

Gordon
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #87 (permalink)  
Old 04-17-2006, 08:43 PM
Nicholishen's Avatar
Nicholishen Nicholishen is offline
Senior Member
 
Join Date: Dec 2005
Posts: 531
Nicholishen is on a distinguished road
Quote:
Originally Posted by Bongo
Hi All,
EA is opening 2 positions
at the same time, same pairs.
Could u please check this.
Thanks, Bongo

int cnt = 0;

string OrderValueSymbol(int index)
{
OrderSelect(index, SELECT_BY_POS);
return(OrderSymbol());
}

int start()
{

if( Bars < 20 ) return(0);

for(cnt=1;cnt<=OrdersTotal();cnt++) {
if( OrderValueSymbol(cnt) == Symbol() )
{
Order = 1;
break;
}
else
{
Order = 0;
}
}

if( OrdersTotal() == 0 ) Order = 0;
if( OrdersTotal() < 5 && Order == 0 )
etc....
Bongo. The first position in the trade pool is 0 instead of 1. The for loop should look like this : for(int i=0;i<Orderstotal();i++){
Also, are you using custom functions?
Cheers!
__________________
"Anyone who has never made a mistake has never tried anything new." -Albert Einstein
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #88 (permalink)  
Old 04-17-2006, 11:35 PM
firedave's Avatar
firedave firedave is offline
Senior Member
 
Join Date: Nov 2005
Location: Jakarta, Indonesia
Posts: 416
firedave is on a distinguished road
Quote:
Originally Posted by gordon
Thanks again Dave,
Blue for buy, red for sell.


#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 blue
#property indicator_color3 Red
#property indicator_color4 blue
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, Red);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, blue);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, Red);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3, blue);
SetIndexBuffer(3, ExtMapBuffer4);
//----
SetIndexDrawBegin(0,10);
SetIndexDrawBegin(1,10);
SetIndexDrawBegin(2,10);
SetIndexDrawBegin(3,10);
//---- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexBuffer(3,ExtMapBuffer4);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double haOpen, haHigh, haLow, haClose;
if(Bars<=10) return(0);
ExtCountedBars=IndicatorCounted();
//---- check for possible errors
if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
int pos=Bars-ExtCountedBars-1;
while(pos>=0)
{
haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2;
haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4;
haHigh=MathMax(High[pos], MathMax(haOpen, haClose));
haLow=MathMin(Low[pos], MathMin(haOpen, haClose));
if (haOpen<haClose)
{
ExtMapBuffer1[pos]=haLow;
ExtMapBuffer2[pos]=haHigh;
}
else
{
ExtMapBuffer1[pos]=haHigh;
ExtMapBuffer2[pos]=haLow;
}
ExtMapBuffer3[pos]=haOpen;
ExtMapBuffer4[pos]=haClose;
pos--;
}
//----
return(0);

Gordon
Hi Gordon, I got the problem. If you like BLUE for your color, you must write "Blue" instead of "blue" , MetaEditor is CASE SENSITIVE. I've tested it and it should be work. Hope this help and let me know should you still have other problem
__________________
David Michael H
"Trader helps traders with sincerity, honesty and integrity"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #89 (permalink)  
Old 04-18-2006, 01:00 AM
gabroo_munda gabroo_munda is offline
Member
 
Join Date: Oct 2005
Posts: 58
gabroo_munda is on a distinguished road
hi gang,
i thought this will be the right place to ask this. how can i refresh the charts from code? or how can i refresh indicators from their code? i ask this because some indicators plot ...and then when i click on refresh..change their values a bit. thanks for the help.

regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #90 (permalink)  
Old 04-18-2006, 02:52 AM
LCCAZZANI LCCAZZANI is offline
Junior Member
 
Join Date: Apr 2006
Posts: 4
LCCAZZANI is on a distinguished road
Hi to all. Im new here, VERY NICE FORUM!!!!

I have a doubt, i want to color my bars acording to this criteria:
I have this Inverse fisher transform of RSI indicator witch i want to use to color the bars blue when its increasing, and red when its decreasing...
Ill try to attach the indicator i case of someone could help me..

Thanks, LC.
Attached Files
File Type: mq4 Inverse Fisher Transform of RSI.mq4 (6.2 KB, 66 views)
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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
Posted By For Type Date
OzFx System:) - Page 639 This thread Refback 06-21-2008 09:53 PM
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 11:46 AM


All times are GMT. The time now is 02:31 PM.