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 10-15-2006, 10: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, 27 views)

Last edited by babarmughal; 10-15-2006 at 10:13 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
  #2 (permalink)  
Old 10-15-2006, 10:24 AM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 724
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!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 10-15-2006, 09: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!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 11-12-2006, 12:14 AM
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!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 11-12-2006, 11: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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 11-12-2006, 01:37 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 11-12-2006, 01: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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #8 (permalink)  
Old 11-12-2006, 02: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, 50 views)
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
  #9 (permalink)  
Old 11-12-2006, 03:09 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #10 (permalink)  
Old 11-12-2006, 05: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!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
how to define a static var in MT3.86 lamanosky Indicators - Metatrader 3 0 11-18-2006 01:43 PM
How can I define.... babarmughal Expert Advisors - Metatrader 4 6 11-10-2006 11:18 PM
Global colour change - possible? niceguy777 Setup Questions 2 11-10-2006 01:15 AM
How to define a BAr........ babarmughal Metatrader 4 1 06-27-2006 01:47 AM
How to change line colour billm Metatrader 4 3 12-10-2005 06:39 PM


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



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