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
BabarU 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.
Thanks for your explaination Mate..
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
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...
ThanksIs there anyone who can help me please??...i am stuck...
Thanks
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 BLUEthe 4 of them have values!
2- whenthe color is REDthe buffers 0 and 1 only have values!
So the code of the EA should be something like that:doublesignal = iCustom(NULL,0,"triggerlines",Rperiod,LSMA_Period,2,0);
if (signal != EMPTY_VALUE) <--- Color isBLUE
if (signal == EMPTY_VALUE) <--- Color isREDGive it a try!
babarmughal,
I've noticed that the TriggerLines indicator has 4 buffers!
1- when the color is BLUEthe 4 of them have values!
2- whenthe color is REDthe buffers 0 and 1 only have values!
So the code of the EA should be something like that:doublesignal = iCustom(NULL,0,"triggerlines",Rperiod,LSMA_Period,2,0);
if (signal != EMPTY_VALUE) <--- Color isBLUE
if (signal == EMPTY_VALUE) <--- Color isREDGive it a try!Thanks CG for all your help....i will try it now....
babarmughal,
I've noticed that the TriggerLines indicator has 4 buffers!
1- when the color is BLUEthe 4 of them have values!
2- whenthe color is REDthe buffers 0 and 1 only have values!
So the code of the EA should be something like that:doublesignal = iCustom(NULL,0,"triggerlines",Rperiod,LSMA_Period,2,0);
if (signal != EMPTY_VALUE) <--- Color isBLUE
if (signal == EMPTY_VALUE) <--- Color isREDGive 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
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
ThanksYou have to use code like this:
{
//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);
}You have to use code like this:
{
//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

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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