Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - 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 10-15-2006, 09:04 AM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Smile How can I define Colour change

HI Guys,

Can you please tell me how can I define the color change in an EA...Like some indicators displays diff colours depending on the trend. How can I write this in EA,...Basically i am trying to make an EA based on Triggerlines..Please Help

Thanks
Babar
Attached Files
File Type: mq4 Triggerlines.mq4 (3.6 KB, 19 views)

Last edited by babarmughal; 10-15-2006 at 09:13 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-15-2006, 09:24 AM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 693
Kalenzo is on a distinguished road
Quote:
Originally Posted by babarmughal
HI Guys,

Can you please tell me how can I define the color change in an EA...Like some indicators displays diff colours depending on the trend. How can I write this in EA,...Basically i am trying to make an EA based on Triggerlines..Please Help

Thanks
Babar
U should check the buffer value. To change the line color u need to have 2 buffers lets say that buffer 1 is blue buffer 2 is red.
Buffer 1 is defined as buffer 0 in init function, and buffer 2 is defined as buffer 1 in init SetIndexBuffer(0,buffer1);
So the first buffer covers second, if the first buffer will be empty - u will see the other color.
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-15-2006, 08:21 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Thanks for your explaination Mate..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-11-2006, 11:14 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Smile

Quote:
Originally Posted by Kalenzo
U should check the buffer value. To change the line color u need to have 2 buffers lets say that buffer 1 is blue buffer 2 is red.
Buffer 1 is defined as buffer 0 in init function, and buffer 2 is defined as buffer 1 in init SetIndexBuffer(0,buffer1);
So the first buffer covers second, if the first buffer will be empty - u will see the other color.
HI,

Just wondering how can I write this in EA that if the line is BLUE then BUY and if the line changes its colour from BLUE to RED then SELL...

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-12-2006, 10:51 AM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Smile

Quote:
Originally Posted by babarmughal
HI,

Just wondering how can I write this in EA that if the line is BLUE then BUY and if the line changes its colour from BLUE to RED then SELL...

Thanks
Is there anyone who can help me please??...i am stuck...

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 11-12-2006, 12:37 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Cool

Quote:
Originally Posted by babarmughal
Is there anyone who can help me please??...i am stuck...

Thanks
babarmughal,

I've noticed that the TriggerLines indicator has 4 buffers!
1- when the color is BLUE the 4 of them have values!
2- when
the color is RED the buffers 0 and 1 only have values!

So the code of the EA should be something like that:


double signal = iCustom(NULL,0,"triggerlines",Rperiod,LSMA_Period,2,0);
if (signal != EMPTY_VALUE) <--- Color is
BLUE
if (signal == EMPTY_VALUE) <--- Color is RED

Give it a try!



__________________
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
  #7 (permalink)  
Old 11-12-2006, 12:50 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Smile

Quote:
Originally Posted by codersguru
babarmughal,

I've noticed that the TriggerLines indicator has 4 buffers!
1- when the color is BLUE the 4 of them have values!
2- when
the color is RED the buffers 0 and 1 only have values!

So the code of the EA should be something like that:


double signal = iCustom(NULL,0,"triggerlines",Rperiod,LSMA_Period,2,0);
if (signal != EMPTY_VALUE) <--- Color is
BLUE
if (signal == EMPTY_VALUE) <--- Color is RED

Give it a try!




Thanks CG for all your help....i will try it now....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 11-12-2006, 01:07 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Quote:
Originally Posted by codersguru
babarmughal,

I've noticed that the TriggerLines indicator has 4 buffers!
1- when the color is BLUE the 4 of them have values!
2- when
the color is RED the buffers 0 and 1 only have values!

So the code of the EA should be something like that:


double signal = iCustom(NULL,0,"triggerlines",Rperiod,LSMA_Period,2,0);
if (signal != EMPTY_VALUE) <--- Color is
BLUE
if (signal == EMPTY_VALUE) <--- Color is RED

Give it a try!



Hi CG,

I have tried the code works fine but got 1 question...where there are more than 1 trades infact there should be only 1 trade when the colour of line has been changed..the areas are in the blue circle

Thanks
Attached Images
File Type: gif chart 1.gif (27.3 KB, 42 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 11-12-2006, 02:09 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Quote:
Originally Posted by babarmughal
Hi CG,

I have tried the code works fine but got 1 question...where there are more than 1 trades infact there should be only 1 trade when the colour of line has been changed..the areas are in the blue circle

Thanks
You have to use code like this:

PHP Code:
bool isNewSymbol(string current_symbol)
  {
   
//loop through all the opened order and compare the symbols
   
int total  OrdersTotal();
   for(
int cnt cnt total cnt++)
   {
      
OrderSelect(cntSELECT_BY_POSMODE_TRADES);
      
string selected_symbol OrderSymbol();
      if (
current_symbol == selected_symbol && OrderMagicNumber()==MagicNumber)
      return (
False);
    }
    return (
True);
}
  
 if(
OrdersTotal() < || isNewSymbol(Symbol())) 
     {
       if(
BuyCondition//<-- BUY condition
         
{
           
//<-- Open BUY order
            
return(0);
         }
         if(
SellCondition//<-- SELL condition
         
{
            
//<-- Open SELL order
            
return(0);
         }
         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
  #10 (permalink)  
Old 11-12-2006, 04:19 PM
babarmughal's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 315
babarmughal is on a distinguished road
Quote:
Originally Posted by codersguru
You have to use code like this:

PHP Code:
bool isNewSymbol(string current_symbol)
  {
   
//loop through all the opened order and compare the symbols
   
int total  OrdersTotal();
   for(
int cnt cnt total cnt++)
   {
      
OrderSelect(cntSELECT_BY_POSMODE_TRADES);
      
string selected_symbol OrderSymbol();
      if (
current_symbol == selected_symbol && OrderMagicNumber()==MagicNumber)
      return (
False);
    }
    return (
True);
}
  
 if(
OrdersTotal() < || isNewSymbol(Symbol())) 
     {
       if(
BuyCondition//<-- BUY condition
         
{
           
//<-- Open BUY order
            
return(0);
         }
         if(
SellCondition//<-- SELL condition
         
{
            
//<-- Open SELL order
            
return(0);
         }
         return(
0);
     } 
CG. thanks a lot man. u r the best....will try this.....many thanks
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 On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to define a static var in MT3.86 lamanosky Indicators - Metatrader 3 0 11-18-2006 12:43 PM
How can I define.... babarmughal Expert Advisors - Metatrader 4 6 11-10-2006 10:18 PM
Global colour change - possible? niceguy777 Setup Questions 2 11-10-2006 12:15 AM
How to define a BAr........ babarmughal Metatrader 4 1 06-27-2006 12:47 AM
How to change line colour billm Metatrader 4 3 12-10-2005 05:39 PM


All times are GMT. The time now is 04:41 AM.



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