I have already tried the
!StringCompare(sTypeOrder, "OP_BUY",false)
and the result is always the same:
2006.03.22 00:00 teste2 EURUSD,Daily: *** Função Modificação de ordens ***: Order Number = -1 TypeOrder: OP_BUY
I think string are alright and even with case sensitive it seems diferent!
Case function doesn't work, so can you help me?
I have already tried the
and the result is always the same:
2006.03.22 00:00 teste2 EURUSD,Daily: *** Função Modificação de ordens ***: Order Number = -1 TypeOrder: OP_BUY
I think string are alright and even with case sensitive it seems diferent!
Case function doesn't work, so can you help me?
OP_BUY
And those others are Trade operation enumerations, not strings.
EnumToString()
EnumToString(OrderType())
Or can use a switch in stead:
switch(OrderType()) { case OP_BUY: //Do something... break; case OP_SELL: //Do something else... break; case OP_BUYLIMIT: //Etc... break; case OP_SELLLIMIT: break; case OP_BUYSTOP: break; case OP_SELLSTOP: break; }
Those values already have integer values.
ID |
Value |
Description |
OP_BUY |
0 |
Buy operation |
OP_SELL |
1 |
Sell operation |
OP_BUYLIMIT |
2 |
Buy limit pending order |
OP_SELLLIMIT |
3 |
Sell limit pending order |
OP_BUYSTOP |
4 |
Buy stop pending order |
OP_SELLSTOP |
5 |
Sell stop pending order |
Have to use else if.
if(sTypeOrder == "OP_BUY") OrderTypeNum = 0; else if(sTypeOrder == "OP_SELL") OrderTypeNum = 1; else if(sTypeOrder == "OP_BUYLIMIT") OrderTypeNum = 2; else if(sTypeOrder == "OP_SELLLIMIT") OrderTypeNum = 3; else if(sTypeOrder == "OP_BUYSTOP") OrderTypeNum = 4; else if(sTypeOrder == "OP_SELLSTOP") OrderTypeNum = 5; else OrderTypeNum = -1;
And those others are Trade operation enumerations, not strings.
Or can use a switch in stead:
Those values already have integer values.
ID |
Value |
Description |
OP_BUY |
0 |
Buy operation |
OP_SELL |
1 |
Sell operation |
OP_BUYLIMIT |
2 |
Buy limit pending order |
OP_SELLLIMIT |
3 |
Sell limit pending order |
OP_BUYSTOP |
4 |
Buy stop pending order |
OP_SELLSTOP |
5 |
Sell stop pending order |
Hi Marco,
I understand that OP_BUY is an integer but i woul d like to use the string to be more explicit in the code when calling for modifyOrders Function. But Case it seems a good option and I didn't remenber how to use the integer because it isn't explicit ate firts view.
Thanks for you help.
Have to use else if.
Thanks for the help Ernst. Best regards.
- 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,
I'm making an EA to work with fratcal and I have a problem with string comparison with type of order. On a uptrend, when an Upper Fractal (new high) appears it should send an modify order but when I call the function the string comparison doesn´t work. Let's see:
When there is an order Sell running and it appear a breakout of last High:
Then on the function "ModifyOrders" this "ifs" aren't working: