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.
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
Last edited by babarmughal; 10-15-2006 at 10:13 AM.
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/
........................................
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...
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
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....
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
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 = 0 ; cnt < total ; cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); string selected_symbol = OrderSymbol(); if (current_symbol == selected_symbol && OrderMagicNumber()==MagicNumber) return (False); } return (True); }
if(OrdersTotal() < 1 || isNewSymbol(Symbol())) { if(BuyCondition) //<-- BUY condition { //<-- Open BUY order return(0); } if(SellCondition) //<-- SELL condition { //<-- Open SELL order return(0); } return(0); }
bool isNewSymbol(string current_symbol)
{
//loop through all the opened order and compare the symbols
int total = OrdersTotal();
for(int cnt = 0 ; cnt < total ; cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
string selected_symbol = OrderSymbol();
if (current_symbol == selected_symbol && OrderMagicNumber()==MagicNumber)
return (False);
}
return (True);
}
if(OrdersTotal() < 1 || 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