Maybe I get you wrong, but let's say:
1. Like every extern variable is avaible for user:
extern double InputtedStopLoss=50;
extern double InputtedAccountCapital=3000;
extern double InputtedRisk=1.5;
those are 3 inputs from your code.
2. in your message box:
MessageBox(text, "Lot size", MB_YESNO|MB_ICONQUESTION);
you need to change into
MessageBox(text, "Lot size", MB_OK|MB_ICONQUESTION);
Maybe I get you wrong, but let's say:
1. Like every extern variable is avaible for user:
extern double InputtedStopLoss=50;
extern double InputtedAccountCapital=3000;
extern double InputtedRisk=1.5;
those are 3 inputs from your code.
2. in your message box:
MessageBox(text, "Lot size", MB_YESNO|MB_ICONQUESTION);
you need to change into
MessageBox(text, "Lot size", MB_OK|MB_ICONQUESTION);
Hi
Yes, but when I run the script, it doesn't ask for the external variables, the script just runs. I wanted it to come up with a box so I could enter these 3 variables (if they need changing from the default) and run the script.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How do you get user input for the external variables here?
Also, what is the function to have the message box say OK, rather than YESNO?
[quote]
//+------------------------------------------------------------------+
//| Lot amount based on SL.mq4 |
//| Copyright © 2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
extern double InputtedStopLoss=50;
extern double InputtedAccountCapital=3000;
extern double InputtedRisk=1.5;
#include <WinUser32.mqh>
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
double Answer = 0;
string text = "";
Answer = ((InputtedAccountCapital * (InputtedRisk/100)) / InputtedStopLoss) / 10;
text = DoubleToStr(Answer,2);
MessageBox(text, "Lot size", MB_YESNO|MB_ICONQUESTION);
//----
return(0);
}
//+------------------------------------------------------------------+
[/quote]