Coding help - page 372

 
AtApi:
Thanks mladen! the problem this way is that it doesnt really remove the string from the array it just change the value of the string to "remove" on both original and duplicate value...so if i want later filter them i will remove the original value as well.. i hope i m clear..

It does not

That is why the if (myArray != "remove") condition is in the last line of that code. Only the values different from "remove" are copied to the new array after adjusting the new array size (adding a new element)

 

ok i`ll test it and i will let you know!

always thanks from the bottom of my heart!!

 
mladen:
It does not That is why the if (myArray != "remove") condition is in the last line of that code. Only the values different from "remove" are copied to the new array after adjusting the new array size (adding a new element)

It works great mladen! thanks a bunch!!

 

Mladen

The nicetrader1.03 ea errors has disappear.....so I took it back to tester.It could not trade but giving the errors.I ve attach part of the error from the journal below:

I think this is as a results of the trailing stop functions we added, bcos ot was trading before,,,,just want to perfect the template for all us here....kindly help me reajust the trailing stop to work with the template.I created 3 external variable for the trailing order, Trailingstop, Trailingstart and Trailingstep.TrailingStart, which is the profit threshold that needs to be achieved before the trailing stop can be activated; the TrailingStop, which is the amount of pips we will trail from new profit highs; and the TrailingStep, the amount of new pips that need to be gained before the stop can be increased by the amount of the gain.

mladen:
Those warnings removed : newnicetrader_1.03.mq4
Files:
errorimage.png  212 kb
 
Mastercash:
Mladen

The nicetrader1.03 ea errors has disappear.....so I took it back to tester.It could not trade but giving the errors.I ve attach part of the error from the journal below:

I think this is as a results of the trailing stop functions we added, bcos ot was trading before,,,,just want to perfect the template for all us here....kindly help me reajust the trailing stop to work with the template.I created 3 external variable for the trailing order, Trailingstop, Trailingstart and Trailingstep.TrailingStart, which is the profit threshold that needs to be achieved before the trailing stop can be activated; the TrailingStop, which is the amount of pips we will trail from new profit highs; and the TrailingStep, the amount of new pips that need to be gained before the stop can be increased by the amount of the gain.

Error 134 means : not enough money. The order lot size is too big for the account equity, It is not results of any trading functions added since I did not add any trading function at all to that EA - if you did add such functions, please revise them, since I have no idea what changes in the code were made by you

 

How can I calculate total profit of currently opened orders?

 
apprentice coder:
How can I calculate total profit of currently opened orders?

apprentice coder

You can do something like this (swaps and commissions included, so the result is an exact profit) :

double colectProfit()

{

double profitSoFar=0;

//

//

//

//

//

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

{

OrderSelect(i, SELECT_BY_POS,MODE_TRADES);

if (!TrailAllSymbols)

if (OrderSymbol()!=Symbol()) continue;

if (OrderMagicNumber() < magicNumberfrom) continue;

if (OrderMagicNumber() > magicNumberto) continue;

if (OrderType()==OP_BUY || OrderType()==OP_SELL)

profitSoFar += (OrderProfit()+OrderSwap()+OrderCommission());

}

return(profitSoFar);

}

 
mladen:
apprentice coder

You can do something like this (swaps and commissions included, so the result is an exact profit) :

double colectProfit()

{

double profitSoFar=0;

//

//

//

//

//

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

{

OrderSelect(i, SELECT_BY_POS,MODE_TRADES);

if (!TrailAllSymbols)

if (OrderSymbol()!=Symbol()) continue;

if (OrderMagicNumber() < magicNumberfrom) continue;

if (OrderMagicNumber() > magicNumberto) continue;

if (OrderType()==OP_BUY || OrderType()==OP_SELL)

profitSoFar += (OrderProfit()+OrderSwap()+OrderCommission());

}

return(profitSoFar);

}

Got it

I was thinking something in the line, but the swap caused wrong results sometimes. Thanks

 

yes, but starts this error when I added the trailing stop other I took time to explain.This ea need trailing stp, to me it is like the one I added which is the first function at the upper side of the code,is not working .Kindly help out by adding a better trailing function.

mladen:
Error 134 means : not enough money. The order lot size is too big for the account equity, It is not results of any trading functions added since I did not add any trading function at all to that EA - if you did add such functions, please revise them, since I have no idea what changes in the code were made by you
 

This post for Mladen,hi,sir, this what i got when i tried to compli expert in meta editor, fisher m11 ea,what does it mean? Thank You!

'Fisher M11 ea.mq4' Fisher M11 ea.mq4 1 1

'stdlib.mqh' stdlib.mqh 1 1

'stderror.mqh' stderror.mqh 1 1

function must return a value Fisher M11 ea.mq4 94 5

variable 'cerrada' not used Fisher M11 ea.mq4 78 8

variable 'price' not used Fisher M11 ea.mq4 77 10

variable 'ticket' not used Fisher M11 ea.mq4 76 7

declaration of 'c' hides global declaration at line 57 Fisher M11 ea.mq4 191 82

variable 'i' not used Fisher M11 ea.mq4 356 18

declaration of 'slippage' hides global declaration at line 60 Fisher M11 ea.mq4 531 12

declaration of 'magic' hides global declaration at line 14 Fisher M11 ea.mq4 532 28

return value of 'OrderSelect' should be checked Fisher M11 ea.mq4 684 4

return value of 'OrderSelect' should be checked Fisher M11 ea.mq4 791 4

not all control paths return a value Fisher M11 ea.mq4 801 1

declaration of 'slippage' hides global declaration at line 60 Fisher M11 ea.mq4 841 12

declaration of 'magic' hides global declaration at line 14 Fisher M11 ea.mq4 842 28

return value of 'OrderSelect' should be checked Fisher M11 ea.mq4 1010 4

not all control paths return a value Fisher M11 ea.mq4 1020 1

return value of 'OrderSelect' should be checked Fisher M11 ea.mq4 1093 4

return value of 'OrderSelect' should be checked Fisher M11 ea.mq4 1187 3

declaration of 'slippage' hides global declaration at line 60 Fisher M11 ea.mq4 1267 11

return value of 'OrderSelect' should be checked Fisher M11 ea.mq4 1401 3

0 error(s), 19 warning(s) 1 20