25.10.2016 Views

Expert Advisor Programming by Andrew R. Young

Expert Advisor Programming by Andrew R. Young

Expert Advisor Programming by Andrew R. Young

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

EXPERT ADVISOR PROGRAMMING<br />

string ErrDesc = ErrorDescription(ErrorCode);<br />

string ErrAlert = StringConcatenate("Close Pending Order - Error: ",<br />

ErrorCode,": ",ErrDesc);<br />

Alert(ErrAlert);<br />

string ErrLog = StringConcatenate("Ticket: ",argCloseTicket," Bid: ",<br />

MarketInfo(argSymbol,MODE_BID)," Ask: ",MarketInfo(argSymbol,MODE_ASK));<br />

Print(ErrLog);<br />

}<br />

}<br />

return(Deleted);<br />

}<br />

double CalcBuyStopLoss(string argSymbol, int argStopLoss, double argOpenPrice)<br />

{<br />

if(argStopLoss == 0) return(0);<br />

}<br />

double BuyStopLoss = argOpenPrice - (argStopLoss * PipPoint(argSymbol));<br />

return(BuyStopLoss);<br />

double CalcSellStopLoss(string argSymbol, int argStopLoss, double argOpenPrice)<br />

{<br />

if(argStopLoss == 0) return(0);<br />

}<br />

double SellStopLoss = argOpenPrice + (argStopLoss * PipPoint(argSymbol));<br />

return(SellStopLoss);<br />

double CalcBuyTakeProfit(string argSymbol, int argTakeProfit, double argOpenPrice)<br />

{<br />

if(argTakeProfit == 0) return(0);<br />

}<br />

double BuyTakeProfit = argOpenPrice + (argTakeProfit * PipPoint(argSymbol));<br />

return(BuyTakeProfit);<br />

double CalcSellTakeProfit(string argSymbol, int argTakeProfit, double argOpenPrice)<br />

{<br />

if(argTakeProfit == 0) return(0);<br />

}<br />

double SellTakeProfit = argOpenPrice - (argTakeProfit * PipPoint(argSymbol));<br />

return(SellTakeProfit);<br />

186

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!