Hi guys,
Sorry -- I know this is nothing exciting...but as ibfx has switched to 5 digits, my buy and sell scripts have stopped working.
I have adjusted the stop loss and take profit parts (multiply by 10) but I can't figure out how to make the lot size calculation correct...
The problem seems to be the spread -- the script seems to be using a value of 20 instead of 2 for EUR/USD for example.
Can anybody tell me what I need to change to make this work again?
Thanks,
Bernie
int start()
{
double Risk = RiskPercent / 100;
if (UseMoneyMgmt)
Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
int Mode = OP_BUYSTOP;
if (Ask > Entry && Entry > 0) Mode = OP_BUYLIMIT;
if (Entry == 0) {Entry = Ask; Mode = OP_BUY;}
double SLB = Entry - StopLoss*Point, TPB = Entry + TakeProfit*Point;
if (UseStop == false) SLB = 0;
if (UseTakeProfit == false) TPB = 0;
if(Lots > 0)
OrderSend(Symbol(),Mode, Lots, Entry, 2,SLB , TPB, "Buy Script", 0, NULL, LimeGreen);
return(0);
}
Sorry -- I know this is nothing exciting...but as ibfx has switched to 5 digits, my buy and sell scripts have stopped working.
I have adjusted the stop loss and take profit parts (multiply by 10) but I can't figure out how to make the lot size calculation correct...
The problem seems to be the spread -- the script seems to be using a value of 20 instead of 2 for EUR/USD for example.
Can anybody tell me what I need to change to make this work again?
Thanks,
Bernie
int start()
{
double Risk = RiskPercent / 100;
if (UseMoneyMgmt)
Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
int Mode = OP_BUYSTOP;
if (Ask > Entry && Entry > 0) Mode = OP_BUYLIMIT;
if (Entry == 0) {Entry = Ask; Mode = OP_BUY;}
double SLB = Entry - StopLoss*Point, TPB = Entry + TakeProfit*Point;
if (UseStop == false) SLB = 0;
if (UseTakeProfit == false) TPB = 0;
if(Lots > 0)
OrderSend(Symbol(),Mode, Lots, Entry, 2,SLB , TPB, "Buy Script", 0, NULL, LimeGreen);
return(0);
}