Coding help - page 265

 

The following piece of code

for (int i = OrdersTotal() - 1; i >= 0; i--) {

if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

switch (OrderType()) {

case OP_BUY:

bid1 = MarketInfo(OrderSymbol(), MODE_BID);

OrderClose(OrderTicket(), OrderLots(), bid1, Slippage, Red);

// to the above line the warning applies

break;

..............................................................

}

}

}

produces warning return value of 'OrderClose' should be checked;

how to remove this message / improve the code?

 
wojtek.paul:
The following piece of code
for (int i = OrdersTotal() - 1; i >= 0; i--) {

if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

switch (OrderType()) {

case OP_BUY:

bid1 = MarketInfo(OrderSymbol(), MODE_BID);

OrderClose(OrderTicket(), OrderLots(), bid1, Slippage, Red);

// to the above line the warning applies

break;

..............................................................

}

}

}

produces warning return value of 'OrderClose' should be checked;

how to remove this message / improve the code?

wojtek

Do like this

bool closeResult = OrderClose(OrderTicket(), OrderLots(), bid1, Slippage, Red);

and you will have no warning

 

WOW, Mladen, you have a superluminal speed; thank you very much!

 

Hi,

was trying to test the macd indicator with the other timeframes likes M3, M6, M10...

But I am getting only 0 as macd-value back. Why?

 
sunshineh:
Hi,

was trying to test the macd indicator with the other timeframes likes M3, M6, M10...

But I am getting only 0 as macd-value back. Why?

You have to have data for those time frames and those symbols generated with some offline data generator. If you do not have it already generated, you will always get result 0

 

Dear Mladen If you’re interested, I have a job for you. I have an indicator I need to be coded as an EA.Is that something you can do efficiently.I am willing to pay for your services.If you’re interested, please private message me, and then we can continue using email. My Humble Submission,

Evasparkling.

 

Hello Dear Mladen,this indicator doesn't work at this terminal with a prefix of ECN, without prefix the indicator works at other terminal. Please help

 
Air92:
Hello Dear Mladen,this indicator doesn't work at this terminal with a prefix of ECN, without prefix the indicator works at other terminal. Please help

Added two parameters : Prefix and Suffix. As far as I see in your case you have to enter ".ecn" to Suffix parameter. Try it out (I don't have such an account). Let me know

kumo_cloud_heatmap_mtf_window_2_nmc.mq4

 
mladen:
Added two parameters : Prefix and Suffix. As far as I see in your case you have to enter ".ecn" to Suffix parameter. Try it out (I don't have such an account). Let me know kumo_cloud_heatmap_mtf_window_2_nmc.mq4

Everything works now. Thank you

 

hello,

I need a small help with this S/R indicator... when I'm trying to reduce a number of S/R levels - it's not working... I would like to see only those important ;] some of them are also blinking when the price moves (don't know why)...

how this can be fixed?

thanks in advance for your help :-)

Files:
s_r_lines.mq4  19 kb
Reason: