Hayseed, I tried to create a script that would automatically calculate the Lot size based on a risk percent which in turn is generated using a SL input and the account balance. I get one error about an expected "double".
Sorry guys, I wish I were better at this and didn't need to ask so many questions.
Here is the code I am trying to use to set the GlobalVariable. I need to beable to allow a user to set the Risk Percent and have the script generate the rest.
Sorry guys, I wish I were better at this and didn't need to ask so many questions.
Here is the code I am trying to use to set the GlobalVariable. I need to beable to allow a user to set the Risk Percent and have the script generate the rest.
Inserted Code
//+------------------------------------------------------------------+
//| |
//| |
//| |
//+------------------------------------------------------------------+
//#property copyright ""
//#property link ""
#property show_inputs
double Lots = 0.01;
bool UseMoneyMgmt = True;
extern double RiskPercent = 2;
extern double StopLoss = 15;
string Input = " Buy Price ";
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
double Risk = RiskPercent / 100;
if (UseMoneyMgmt)
Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
if(Lots > 0; GlobalVariableSet(string ordersize, double Lots,);
return(0);
}
//+------------------------------------------------------------------+