Coding help - page 204

 
donstar19:
How do I do that? I'm sorry I don't know coding but I am willing to Try anything at this point to get it to stop, If there is a way to Limit my orders and pending orders it might could work?

donstar19

It only can be done from within the EA (it must be implemented in the EA code)

 
mladen:
donstar19 It only can be done from within the EA (it must be implemented in the EA code)

And that is why i want to Create the stop light iCustom indicator to add to my EA.

to only trade when that signal is green.

 
donstar19:
And that is why i want to Create the stop light iCustom indicator to add to my EA. to only trade when that signal is green.

donstar19

You can use a function similar to this to count currently opened orders

int countOpenedOrders(int& openedBuys,int& openedSells,double& totalProfit)

{

int openedOrders = 0;

openedBuys = 0;

openedSells = 0;

totalProfit = 0;

//

//

//

//

//

for(int i=0; i < OrdersTotal(); i++)

{

if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false) break;

//

//

//

//

//

if(OrderSymbol() != s_symbol) continue;

if(NoHedge)

{

if(OrderType() == OP_BUY) openedBuys++;

if(OrderType() == OP_SELL) openedSells++;

}

if(OrderMagicNumber() != MagicNumber) continue;

//

//

//

//

//

if(OrderType() == OP_BUY || OrderType() == OP_SELL) { openedOrders++; if (!AllSymbolsForProfitAndLoss) totalProfit += (OrderProfit()+OrderSwap()); }

}

return(openedOrders);

}

And if the number of currently opened orders is > 0, than you should prevent openeing a new order. You also can add a count of other types or orders in this function. Using indicator will not work unless you pass magic number and other data specific to the EA so that the indicator "knows" what to look for (which would make the indicator depending on the EA and that is why it is more eficient to do it as a function from the EA)

 
mladen:
donstar19

You can use a function similar to this to count currently opened orders

int countOpenedOrders(int& openedBuys,int& openedSells,double& totalProfit)

{

int openedOrders = 0;

openedBuys = 0;

openedSells = 0;

totalProfit = 0;

//

//

//

//

//

for(int i=0; i < OrdersTotal(); i++)

{

if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false) break;

//

//

//

//

//

if(OrderSymbol() != s_symbol) continue;

if(NoHedge)

{

if(OrderType() == OP_BUY) openedBuys++;

if(OrderType() == OP_SELL) openedSells++;

}

if(OrderMagicNumber() != MagicNumber) continue;

//

//

//

//

//

if(OrderType() == OP_BUY || OrderType() == OP_SELL) { openedOrders++; if (!AllSymbolsForProfitAndLoss) totalProfit += (OrderProfit()+OrderSwap()); }

}

return(openedOrders);

}

And if the number of currently opened orders is > 0, than you should prevent openeing a new order. You also can add a count of other types or orders in this function. Using indicator will not work unless you pass magic number and other data specific to the EA so that the indicator "knows" what to look for (which would make the indicator depending on the EA and that is why it is more eficient to do it as a function from the EA)

Thanks but its Coding ...I'm just trying to learn this stuff, where should i place this in my EA? its not compiling when I paste it?

 
donstar19:
Thanks but its Coding ...I'm just trying to learn this stuff, where should i place this in my EA? its not compiling when I paste it?

donstar19

And how were you planing to use it if it was an indicator?

 
mladen:
donstar19 It only can be done from within the EA (it must be implemented in the EA code)

Hi Mladen thanks for all your help i sent you a Private Message. I don't want to flood the forum with my explanation on what im trying to do. But the reason i am asking for the Indicator to be Coded is because the program that im using to create my EA is based on conditions of multiple Indicators signals.

 

please help me to fix this code ...

arrow no appear if attach to chart

whats wrong ??

and please add more arrow for stop

if(Laguerre>Lb) = stop BUY

if(Laguerre<Lm) = stop SELL

thanks

Files:
bs.mq4  3 kb
 
rizkyd:
please help me to fix this code ...

arrow no appear if attach to chart

whats wrong ??

and please add more arrow for stop

if(Laguerre>Lb) = stop BUY

if(Laguerre<Lm) = stop SELL

thanks

rizkyd

Which Laguerre indicator exactly are you using for custom calls?

 

am looking for an indicator that draws/shows trend lines of 3 different time frames on 1 chart .

the trend lines should have different colours and be labelled for easy identification.

the time frames should be selectable

 
rizkyd:
please help me to fix this code ...

arrow no appear if attach to chart

whats wrong ??

and please add more arrow for stop

if(Laguerre>Lb) = stop BUY

if(Laguerre<Lm) = stop SELL

thanks

Never mind the previous question

Here is a version that works

Files:
bs_1.mq4  3 kb
Reason: