
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
No thats for verifying if it's a demo account or a live account, contest is rarely used.
Lot max can be very easy.
Thanks for prompt response.
I just need to apply lot size max only Demo account.
( but of course actually live account - this is just for test - I want to try if Demo account, if lot size better then lot size max won't open sell and buy orders - but if live account or contest account - so this lot size max won't apply both of them ( live or contest ) )
Could I use switch operator?
Thanks a lot.
( I will try later. )
// calculate lotsize here
//---
// check if lotsize is not too high
if(lotsize>lotsize_max)
{
lotsize=losize_max;
}
I want to ask - you wanna say - if " lotsize > lotsize_max " lot size should be " lotsize = lotsize_max " for Demo account? I understand you correctly, please?
Thanks a lot.
( I am working on it )
I want to ask - you wanna say - if " lotsize > lotsize_max " lot size should be " lotsize = lotsize_max " for Demo account? I understand you correctly, please?
Thanks a lot.
( I am working on it )
Try
Oh! Nice! Thanks a lot.
----
@Marco vd Heijden and @honest_knave is yours comments solved my issue. But I just little ( slightly ) improved my this concern. Thanks for your best helps.
----
Just I think if " lotsize > lotsize_max " before opens Sell and Buy orders that function should ask me - Yes or No - I think this could be better for now. ( I just need experience for this function that how is it works for me on demo ( of course live ) account - I will test this function on Monday - if I can finish this part of code )
( now I do not know enough about this function - I hope I can do till tomorrow )
Any good comment would be best help for me.
Thanks in advance.
Yes of course by all means go with it without the lotsmax and if you then later on want to fine tune your strategy or want to limit risk you can use it so it's not a necessity as such currently.
You can just eliminate it i just wanted to show you some lines of my security mechanism.
If you want confirmation you can use a
https://docs.mql4.com/common/messagebox
int result=MessageBox(" This is a Messagbox, Do you want to proceed?","Warning",MB_YESNO);
if(result==IDYES)
{
// Yes Pressed
Print("OK");
}
if(result==IDNO)
{
// No Pressed
}
Here are the main flags you set in the messagebox function after the message:
Constant
Value
Description
MB_OK
0x00000000
Message window contains only one button: OK. Default
MB_OKCANCEL
0x00000001
Message window contains two buttons: OK and Cancel
MB_ABORTRETRYIGNORE
0x00000002
Message window contains three buttons: Abort, Retry and Ignore
MB_YESNOCANCEL
0x00000003
Message window contains three buttons: Yes, No and Cancel
MB_YESNO
0x00000004
Message window contains two buttons: Yes and No
MB_RETRYCANCEL
0x00000005
Message window contains two buttons: Retry and Cancel
MB_CANCELTRYCONTINUE
0x00000006
Message window contains three buttons: Cancel, Try Again, Continue
And here the return values:
Constant
Value
Description
IDOK
1
"OK" button has been pressed
IDCANCEL
2
"Cancel" button has been pressed
IDABORT
3
"Abort" button has been pressed
IDRETRY
4
"Retry" button has been pressed
IDIGNORE
5
"Ignore" button has been pressed
IDYES
6
"Yes" button has been pressed
IDNO
7
"No" button has been pressed
IDTRYAGAIN
10
"Try Again" button has been pressed
IDCONTINUE
11
"Continue" button has been pressed
Messagebox() does not work in the tester.
Yes of course by all means go with it without the lotsmax and if you then later on want to fine tune your strategy or want to limit risk you can use it so it's not a necessity as such currently.
You can just eliminate it i just wanted to show you some lines of my security mechanism.
Thanks so much more for your one of great helps.
So, I just tried like below method, am I doing right, please?
( I needed to ask before I bring them to my main .mq4 file - I am working on it )
Thanks in advance.
{
result_message=MessageBox("Do you want to proceed?","Warning",MB_YESNO);
if(result_message==IDYES)
{
ordersell(); // Send Order function here
Print("Clicked YES"," Sell Order Applied");
}
if(result_message==IDNO)
{
Print("Clicked NO"," Sell Order Canceled");
}
ObjectSetInteger(0,sparam,OBJPROP_STATE,false);
}
Just a style tip, which will make your code run (very, very slightly) more efficient... but hey, it all adds up!
You have a message box with 2 buttons. If it isn't IDYES, it must be IDNO (or the function wasn't completed successfully).
So there is no need to test result_message twice.
{
result_message=MessageBox("Do you want to proceed?","Warning",MB_YESNO);
if(result_message==IDYES)
{
ordersell(); // Send Order function here
Print("Clicked YES"," Sell Order Applied");
}
else
{
Print("Clicked NO"," Sell Order Canceled");
}
ObjectSetInteger(0,sparam,OBJPROP_STATE,false);
}
If you prefer to see it written down, use an 'else if' statement:
{
result_message=MessageBox("Do you want to proceed?","Warning",MB_YESNO);
if(result_message==IDYES)
{
ordersell(); // Send Order function here
Print("Clicked YES"," Sell Order Applied");
}
else if(result_message==IDNO)
{
Print("Clicked NO"," Sell Order Canceled");
}
ObjectSetInteger(0,sparam,OBJPROP_STATE,false);
}
Just a style tip, which will make your code run (very, very slightly) more efficient... but hey, it all adds up!
You have a message box with 2 buttons. If it isn't IDYES, it must be IDNO (or the function wasn't completed successfully).
So there is no need to test result_message twice.
Thanks so much more for everything.
Now, I can put them in main EA's.
( also I need experience for MessageBox() )
Thanks so much more for everything.
Now, I can put them in main EA's.
( also I need experience for MessageBox() )