Jump to content

⤴️-Paid Ad- Check advertising disclaimer here. Add your banner here.🔥

Recommended Posts

Posted

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);

}

//+------------------------------------------------------------------+

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


⤴️-Paid Ad- Check advertising disclaimer here. Add your banner here.🔥

×
×
  • Create New...