smurf43 Posted June 25, 2011 Report Posted June 25, 2011 Could someone please add maximum spread option to the Trade Script below. So that when I try to use the script to place a trade, it would not place the trade if the spread is wider than specified and instead it display a message "Spread is wider than specified". //+------------------------------------------------------------------+ //| trade.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #include <stdlib.mqh> #include <WinUser32.mqh> //+------------------------------------------------------------------+ //| script "trading for all money" | //+------------------------------------------------------------------+ int start() { //---- if(MessageBox("Do you really want to BUY 1.00 "+Symbol()+" at ASK price? ", "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) return(1); //---- int ticket=OrderSend(Symbol(),OP_BUY,1.0,Ask,3,0,0,"expert comment",255,0,CLR_NONE); if(ticket<1) { int error=GetLastError(); Print("Error = ",ErrorDescription(error)); return; } //---- OrderPrint(); return(0); } //+------------------------------------------------------------------+ Quote
smurf43 Posted June 25, 2011 Author Report Posted June 25, 2011 Anyone to help please, thank you! Quote
bgrtz Posted June 26, 2011 Report Posted June 26, 2011 MarketInfo(iSymbol,MODE_SPREAD); Regards smurf43 1 Quote
smurf43 Posted June 26, 2011 Author Report Posted June 26, 2011 MarketInfo(iSymbol,MODE_SPREAD); Regards Thank you! But how I could I use it the script. Please advise. I am not familiar with programming. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.