Swiss Army EA (Automatic order management) - page 46

 
gtudor:
And I do not understand why it occurs:

2013.03.20 14:02:00 Swiss Army EA v1.51 EURUSD,M1: Swiss Army EA is attempting to set takeprofits.

2013.03.20 14:02:02 Swiss Army EA v1.51 EURUSD,M1: Swiss Army EA is attempting to set stoplosses

We set stoplosses and take profit !

Settings :

id===== Identity Settings ====

Symbol_Specific=1

MagicNum_Specific=0

MagicNumber=9999

SelectiveScan=0

RequireAllConditions=0

cond===== Conditions: General ====

Immediate_Activation=1

Time_Activation=0

Time_Hour=23

Time_Minute=55

Minimum_FreeMargin=0

FreeMargin_LessThan=0

pro_cond===== Conditions: Profit-Based ====

MaxProfit_Dollar=0

MaxProfit_Pip=0

MaxProfit_Percent=0

loss_cond===== Conditions: Loss-Based ====

MaxLoss_Dollar=0

MaxLoss_Pip=0

MaxLoss_Percent=0

action===== Actions: General ====

CloseOrders=0

HedgeOrders=0

mod_action===== Actions: Modify Orders ====

SetTakeProfit=1

SetStoploss=1

RemoveTakeProfit=0

RemoveStoploss=0

input_action===== Action Inputs ====

TakeProfit=10

Stoploss=20

otype===== Order Types: Standard ====

Allow_All_Types=1

Buy_Active=1

Sell_Active=1

Buy_Stop=1

Sell_Stop=1

Buy_Limit=1

Sell_Limit=1

manage===== Stop Management ====

BreakEvenAt=3

BreakEvenSlide=1

TrailingStop=5

OnlyTrailProfits=1

extra===== Extra Settings ====

ExpertName=Swiss Army EA

Disable_Comments=1

Slippage=3

sep==============================

author=Programming: Ryan Klefas

contact=Email: rklefas@inbox.com

web=Website: Forex TSD - forex forum

hi,

sorry for my english

is suiss can disable the EA(wich do trades) when I arrive to X% loss ?thank's

haow?

 

why it can't close all my positions based on overall profit/loss in $. Whenever it hits the desired SL or TP during the test it closes almost everything except leaving the first trade alone. Is it a bug? Thanks

 
Togu:
why it can't close all my positions based on overall profit/loss in $. Whenever it hits the desired SL or TP during the test it closes almost everything except leaving the first trade alone. Is it a bug? Thanks

Togu

What version of the EA are you using?

 
mladen:
Togu What version of the EA are you using?

it's a Swiss Army EA v.1.51

I tried on IBFX demo mini account

 
Togu:
it's a Swiss Army EA v.1.51 I tried on IBFX demo mini account

Togu

Unfortunately that version is .ex4 only so I can not check the code nor can I alter it.

If it works like the version 1.35 then, in case of multiple orders, it can omit some orders when trying to close all orders (in version 1.35 the closing loop should be inverted to prevent that - but in version 1.51 I simply can not check that part of code nor make changes if needed due to lack of source code).

 
mladen:
Togu

Unfortunately that version is .ex4 only so I can not check the code nor can I alter it.

If it works like the version 1.35 then, in case of multiple orders, it can omit some orders when trying to close all orders (in version 1.35 the closing loop should be inverted to prevent that - but in version 1.51 I simply can not check that part of code nor make changes if needed due to lack of source code).

Thanks for trying to help

 
Togu:
Thanks for trying to help

Sorry that could not do more

The part of version 1.35 that I am talking about is this one :

void versatileOrderCloser(int simpleType)

{

int cnt, total = OrdersTotal();

for(cnt=0;cnt<total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if ( orderBelongsToMe() )

{

switch (simpleType)

{

case 4:

case 3:

if (OrderType()>OP_SELL) OrderDelete(OrderTicket());

break;

case 2:

if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),Slippage,CLR_NONE);

break;

case 1:

if (OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),Slippage,CLR_NONE);

break;

default:

Print ("versatileOrderCloser has been passed an invalid SimpleType parameter: " + simpleType);

}

}

}

}

[/PHP]

And it should be like this in order to avoid that closing error(s) :

[PHP]void versatileOrderCloser(int simpleType)

{

int cnt, total = OrdersTotal();

for(cnt=total-1;cnt>=0;cnt--) // this is the only change

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if ( orderBelongsToMe() )

{

switch (simpleType)

{

case 4:

case 3:

if (OrderType()>OP_SELL) OrderDelete(OrderTicket());

break;

case 2:

if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),Slippage,CLR_NONE);

break;

case 1:

if (OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),Slippage,CLR_NONE);

break;

default:

Print ("versatileOrderCloser has been passed an invalid SimpleType parameter: " + simpleType);

}

}

}

}

As you can see it is a very simple change but without a sorce it can not be done

 

So u r saying I could use 1.35? I must give it a try. Thanks buddy

 
Togu:
So u r saying I could use 1.35? I must give it a try. Thanks buddy

I don't know all the differences between version 1.51 and 1.35 but if you change the code in 1.35 to what I suggested in that post, it will work with order(s) closing as it should

 

Togu, same as what Mladen said don't know the difference between version 1.51 and 1.35, but did the change he was talking about and added auto 5 digit code so EA should work normally no matter the amount of digits the broker uses.

Files: