You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
#OrderType() string - Open
Below code gives me ' 1 ' for Sell OrderType but I need to get OrderType sting one of them ' Sell, Buy so on ', I do not want to get numeric.
I need useful comment, please, thanks.
Use a switch command.
{
case OP_SELL:
break;
case OP_BUY:
break;
}
Use a switch command.
You can also use #define directive if you want to simplify things even further:
#define sell OP_SELL
if(OrderType()==sell)
You can also use #define directive if you want to simplify things even further:
I already use #define which one it is copied for pip and point codes from Mr. William.
So after your comment I just a bit researched about it, I think I can use it in my any scripts.
Thanks for your useful comment.
Use a switch command.
Thanks a lot man.
I am first time trying Switch Operator for my this EA's.
So I would like to say I was learned a bit more about this, but I have not experience for this operator.
Before I try it in my test EA's I just need to ask, you mean I could use like below code, please? ( my test ea's already have 500 lines - and I am going to confused for OrderType() converting to string )
{
switch ( OrderType() )
{
case 0 : ObjectCreate( ... name + " Buy" ... );
ObjectSetInteger(chart_ID,name + " Buy",OBJPROP_COLOR,clr);
// ...
break;
case 1 : ObjectCreate( ... name + " Sell" ... );
// ...
break;
}
}
Thanks in advance.
// --- second times edited
Maybe my concern not clearly.
I already spent a lot of time for this issue I really playing this operator, but not result.
Below code gives me numeric.
Print( "OrderType: ", IntegerToString( OrderType() ) );
// EURAUD,M30: OrderType: 0
But I try to get below result.
Just I need useful comment.
Can you help me ( / give me advice ), please?
ID
Value
Description
OP_BUY
0
Buy operation
OP_SELL
1
Sell operation
{
case 0:
Print( "OrderType: buy" );
break;
case 1:
Print( "OrderType: sell" );
break;
}
or
{
Print("OrderType: buy");
}
if(OrderType()==1)
{
Print("OrderType: sell");
}
Thanks a lot @Marco.
Finally I got it, but I was expecting I would write code one of " Conversion Functions "... my wrong expectation was confusing me.
At this time, I am using 3 " HLine " objects, now I copied that for both cases ( 0 and 1 ). It works good so far.
Also " Order Properties " have 6 values, so I would like to apply same ( e.g object, color, style, width and so on... ) Print function to 0, 2, 4.
Q: Could I use below method?
( Print function just for example )
{
case 0: Print( "OrderType: buy" );
// ...
break;
case 2: Print( "OrderType: buy" );
// ...
break;
case 4: Print( "OrderType: buy" );
// ...
break;
}
Thanks a lot in advance!
No because the values are:
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
So case 2 and case 4 are not equal to OP_BUY
They are OP_BUYLIMIT and OP_BUYSTOP so they are different things.
Unless this is what you mean but it would clarify to say
{
case 0: Print( "OrderType: buy" );
// ...
break;
case 2: Print( "OrderType: buy Limit" );
// ...
break;
case 4: Print( "OrderType: buy Stop" );
// ...
break;
}
No because the values are:
So case 2 and case 4 are not equal to OP_BUY
#OrderType() string - Closed
After your latest comment I feel I can't combine case's 0, 2, 4.
Thanks @Marco vd Heijden for your time and your helps.