Skip to content

Instantly share code, notes, and snippets.

@matthewkastor
Created January 23, 2016 21:16
Show Gist options
  • Save matthewkastor/7bc641d36f4869a3efbd to your computer and use it in GitHub Desktop.
Save matthewkastor/7bc641d36f4869a3efbd to your computer and use it in GitHub Desktop.
function for placing a buy order in metatrader 4
// int result = OpenBuyOrder(0.01, 0.00300, 0.0900);
int OpenBuyOrder(double lots, double stopLossPips, double pipsProfit){
double takeProfit = NormalizeDouble(Ask + pipsProfit, Digits);
double stopLoss =NormalizeDouble(Ask - stopLossPips, Digits);
return OrderSend(Symbol(),OP_BUY,lots,Ask,3,stopLoss,takeProfit,"",MAGICMA,0,clrPurple);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment